Build: Syntax fix. #268
This file contains hidden or 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: Wheel build | |
| on: | |
| release: | |
| types: [created] | |
| schedule: | |
| # ┌───────────── minute (0 - 59) | |
| # │ ┌───────────── hour (0 - 23) | |
| # │ │ ┌───────────── day of the month (1 - 31) | |
| # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) | |
| # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) | |
| # │ │ │ │ │ | |
| - cron: "42 3 * * 4" | |
| push: | |
| paths: | |
| - .github/workflows/wheels.yml | |
| - requirements.txt | |
| - pyproject.toml | |
| - MANIFEST.in | |
| - Makefile | |
| - setup.py | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| paths: | |
| - .github/workflows/wheels.yml | |
| - requirements.txt | |
| - pyproject.toml | |
| - MANIFEST.in | |
| - Makefile | |
| - setup.py | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| sdist: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check out project | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: "3.x" | |
| - name: Install Python dependencies | |
| run: python -m pip install -U pip setuptools && python -m pip install -U -r requirements.txt | |
| - name: Build sdist | |
| run: make sdist | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: sdist | |
| path: dist/*.tar.gz | |
| generate-wheels-matrix: | |
| # Create a matrix of all architectures & versions to build. | |
| # This enables the next step to run cibuildwheel in parallel. | |
| # From https://iscinumpy.dev/post/cibuildwheel-2-10-0/#only-210 | |
| name: Generate wheels matrix | |
| runs-on: ubuntu-latest | |
| outputs: | |
| include: ${{ steps.set-matrix.outputs.include }} | |
| steps: | |
| - name: Check out project | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Install cibuildwheel | |
| # Nb. keep cibuildwheel version pin consistent with job below | |
| run: pipx install cibuildwheel==3.4.1 | |
| - id: set-matrix | |
| run: | | |
| MATRIX=$( | |
| { | |
| cibuildwheel --print-build-identifiers --platform linux --archs x86_64 \ | |
| | jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \ | |
| | sed -e '/aarch64\|armv7l/s|ubuntu-latest|ubuntu-24.04-arm|' \ | |
| && cibuildwheel --print-build-identifiers --platform macos \ | |
| | jq -nRc '{"only": inputs, "os": "macos-latest"}' \ | |
| && cibuildwheel --print-build-identifiers --platform windows --archs x86,AMD64 \ | |
| | jq -nRc '{"only": inputs, "os": "windows-2022"}' \ | |
| && cibuildwheel --print-build-identifiers --platform windows --archs ARM64 \ | |
| | jq -nRc '{"only": inputs, "os": "windows-11-arm"}' | |
| } | jq -sc | |
| ) | |
| echo "include=$MATRIX" | |
| echo "include=$MATRIX" >> $GITHUB_OUTPUT | |
| env: | |
| # Skip abi3 targets here: | |
| CIBW_SKIP: "cp3{9,1?}-win_arm64 cp3{9,1?}-win32 cp3{9,1?}-macosx_x86_64 pp* *musllinux*" | |
| build_wheels: | |
| name: Build ${{ matrix.only }} | |
| needs: generate-wheels-matrix | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }} | |
| steps: | |
| - name: Check out project | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up QEMU | |
| if: runner.os == 'Linux' && !contains(matrix.only, 'x86_64') && !contains(matrix.only, 'i686') && !contains(matrix.only, 'aarch64') | |
| uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 | |
| with: | |
| platforms: all | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 | |
| with: | |
| only: ${{ matrix.only }} | |
| - name: Build faster Linux wheels | |
| # also build wheels with the most recent manylinux images and gcc | |
| if: runner.os == 'Linux' && !contains(matrix.only, 'i686') | |
| uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 | |
| env: | |
| CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_34 | |
| CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_34 # manylinux_2_39 ? | |
| CIBW_MANYLINUX_ARMV7L_IMAGE: manylinux_2_35 | |
| CIBW_MANYLINUX_PPC64LE_IMAGE: manylinux_2_34 | |
| CIBW_MANYLINUX_S390X_IMAGE: manylinux_2_34 | |
| CIBW_MANYLINUX_RISCV64_IMAGE: manylinux_2_39 | |
| CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux_2_34 | |
| CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: manylinux_2_34 | |
| CIBW_MUSLLINUX_X86_64_IMAGE: musllinux_1_2 | |
| CIBW_MUSLLINUX_AARCH64_IMAGE: musllinux_1_2 | |
| CIBW_MUSLLINUX_PPC64LE_IMAGE: musllinux_1_2 | |
| CIBW_MUSLLINUX_S390X_IMAGE: musllinux_1_2 | |
| with: | |
| only: ${{ matrix.only }} | |
| - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| path: ./wheelhouse/*.whl | |
| name: wheels-${{ matrix.only }} | |
| build_limited_api_wheels: | |
| name: Build ${{ matrix.target }} Stable ABI ${{ matrix.lapiversion }} wheels | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: | |
| # Smaller set of platforms that we only provide Stable ABI wheels for: | |
| - 'musllinux_x86_64' | |
| - 'musllinux_aarch64' | |
| - 'manylinux_i686' | |
| - 'musllinux_i686' | |
| - 'manylinux_ppc64le' | |
| - 'musllinux_ppc64le' | |
| - 'manylinux_riscv64' | |
| - 'musllinux_riscv64' | |
| - 'manylinux_armv7l' | |
| - 'musllinux_armv7l' | |
| - 'macosx_x86_64' | |
| - 'win32' | |
| - 'win_arm64' | |
| lapiversion: | |
| - "3.9" | |
| - "3.12" | |
| runs-on: ${{ | |
| contains(matrix.target, 'aarch64') && 'ubuntu-24.04-arm' || | |
| contains(matrix.target, 'armv7l') && 'ubuntu-24.04-arm' || | |
| contains(matrix.target, 'win_arm64') && 'windows-11-arm' || | |
| contains(matrix.target, 'win32') && 'windows-latest' || | |
| contains(matrix.target, 'macosx') && 'macos-latest' || | |
| 'ubuntu-latest' | |
| }} | |
| steps: | |
| - name: Check out project | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Set up Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: '3.x' | |
| - name: Set up QEMU | |
| if: runner.os == 'Linux' && !contains(matrix.target, 'x86_64') && !contains(matrix.target, 'i686') && !contains(matrix.target, 'aarch64') | |
| uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0 | |
| with: | |
| platforms: all | |
| - name: Setup Visual Studio on Windows | |
| if: startsWith(matrix.target, 'win') | |
| uses: TheMrMilchmann/setup-msvc-dev@79dac248aac9d0059f86eae9d8b5bfab4e95e97c # v4.0.0 | |
| with: | |
| arch: ${{ matrix.target == 'win32' && 'x86' || matrix.target == 'win_arm64' && 'arm64' || matrix.target == 'win_amd64' && 'amd64' || '' }} | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@8d2b08b68458a16aeb24b64e68a09ab1c8e82084 # v3.4.1 | |
| env: | |
| CIBW_BUILD: "*${{ matrix.target }}" | |
| CIBW_SKIP: "cp31*t-* pp3*" | |
| CIBW_PROJECT_REQUIRES_PYTHON: ">=${{ matrix.lapiversion }}" | |
| QUICKTIONS_LIMITED_API: "${{ matrix.lapiversion }}" | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: wheels-Stable-ABI-${{ matrix.target }}-${{ matrix.lapiversion }} | |
| path: ./wheelhouse/*.whl | |
| merge_wheels: | |
| name: Merge wheel archives | |
| needs: [build_wheels, build_limited_api_wheels] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Merge wheels | |
| uses: actions/upload-artifact/merge@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: all_wheels | |
| pattern: wheels-* | |
| delete-merged: true | |
| compression-level: 9 | |
| validate_wheels: | |
| name: Validate wheels | |
| needs: [ merge_wheels ] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download files | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: all_wheels | |
| path: ./dist_downloads | |
| merge-multiple: true | |
| - name: abi3audit wheels | |
| run: | | |
| python -m pip install abi3audit | |
| ERRORS=0 | |
| for wheel in ./dist_downloads/*abi3*.whl; do abi3audit --strict --report ${wheel} || ERRORS=$((ERRORS + 1)); done | |
| exit $ERRORS | |
| - name: Twine-check wheels | |
| run: | | |
| python -m pip install twine | |
| ERRORS=0 | |
| for wheel in ./dist_downloads/*.whl; do twine check ${wheel} || ERRORS=$((ERRORS + 1)); done | |
| exit $ERRORS | |
| upload_release_assets: | |
| name: Upload packages | |
| needs: [ sdist, validate_wheels ] | |
| runs-on: ubuntu-latest | |
| if: github.ref_type == 'tag' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Check out project | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Download files | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| path: ./dist_downloads | |
| merge-multiple: true | |
| - name: List downloaded artifacts | |
| run: ls -la ./dist_downloads | |
| - name: Deduplicate wheels | |
| run: python3 dedup_wheels.py -d ./dist_downloads | |
| - name: Release | |
| uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1 | |
| with: | |
| files: ./dist_downloads/* |