Build wheels #117
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build wheels | |
on: | |
workflow_dispatch: | |
inputs: | |
flavours: | |
type: boolean | |
default: true | |
sdist: | |
type: boolean | |
default: true | |
wheels_linux_aarch64: | |
type: boolean | |
default: true | |
wheels_linux_auto: | |
type: boolean | |
default: true | |
wheels_linux_pyodide: | |
type: boolean | |
default: false | |
wheels_windows_auto: | |
type: boolean | |
default: true | |
wheels_macos_arm64: | |
type: boolean | |
default: true | |
wheels_macos_auto: | |
type: boolean | |
default: true | |
wheels_cps: | |
description: 'wheels_cps: sets $CIBW_BUILD, E.g. "cp310* cp311*".' | |
type: string | |
PYMUPDF_SETUP_MUPDF_BUILD: | |
description: 'Value for PYMUPDF_SETUP_MUPDF_BUILD' | |
type: string | |
default: '-' | |
# We can't currently have more than 10 inputs | |
jobs: | |
build_sdist: | |
if: ${{ inputs.sdist }} | |
name: Build sdist | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
#with: | |
# fetch-depth: 0 # Optional, use if you use setuptools_scm | |
# submodules: true # Optional, use if you have submodules | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v2 | |
with: | |
path: dist/*.tar.gz | |
build_wheels: | |
#if: ${{ inputs.wheels }} | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-2019, macos-latest] | |
# Avoid cancelling of all cibuildwheel runs after a single failure. | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v2 | |
# Get Python 3.12 x32 and x64 on Windows. (As of 2023-10-09 these are not | |
# always available by default.) | |
# | |
- name: Install Python 3.12 x64 on Windows. | |
if: runner.os == 'Windows' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
architecture: x64 | |
- name: Install Python 3.12 x32 on Windows. | |
if: runner.os == 'Windows' | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
architecture: x86 | |
# Get a modern Python for running cibuildwheel. This ensures that things | |
# work on MacOS, where it seems only a very old (without f-strings) | |
# python is available by default. | |
# | |
- name: Install Python. | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
# On Linux, get qemu so we can build for aarch64. | |
# | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v1 | |
with: | |
platforms: all | |
- name: gh_release | |
# Doesn't seem to be a way to passing inputs.* on command | |
# line, so we set environment instead. E.g. see: | |
# https://github.com/orgs/community/discussions/27088 | |
# | |
env: | |
inputs_flavours: ${{inputs.flavours}} | |
inputs_sdist: ${{inputs.sdist}} | |
inputs_wheels_linux_aarch64: ${{inputs.wheels_linux_aarch64}} | |
inputs_wheels_linux_auto: ${{inputs.wheels_linux_auto}} | |
inputs_wheels_linux_pyodide: ${{inputs.wheels_linux_pyodide}} | |
inputs_wheels_macos_arm64: ${{inputs.wheels_macos_arm64}} | |
inputs_wheels_macos_auto: ${{inputs.wheels_macos_auto}} | |
inputs_wheels_windows_auto: ${{inputs.wheels_windows_auto}} | |
inputs_PYMUPDF_SETUP_MUPDF_BUILD: ${{inputs.PYMUPDF_SETUP_MUPDF_BUILD}} | |
inputs_wheels_cps: ${{inputs.wheels_cps}} | |
run: | |
python scripts/gh_release.py | |
# Upload generated wheels, to be accessible from github Actions page. | |
# | |
- uses: actions/upload-artifact@v2 | |
with: | |
path: ./wheelhouse/*.whl |