Wheels: also build for riscv64 #1032
Workflow file for this run
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: Python package build and publish | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: {} | |
| repository_dispatch: {} | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: wheels-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build_wheels: | |
| name: ${{ matrix.image }} wheels | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| matrix: | |
| include: | |
| - image: manylinux_2_28_x86_64 | |
| build: "*manylinux*" | |
| - image: musllinux_1_2_x86_64 | |
| build: "*musllinux*" | |
| steps: | |
| - uses: actions/checkout@v5 | |
| if: ${{ github.event_name != 'repository_dispatch' }} | |
| with: | |
| fetch-depth: 0 # slow, but gets all the tags | |
| - uses: actions/checkout@v5 | |
| if: ${{ github.event_name == 'repository_dispatch' }} | |
| with: | |
| fetch-depth: 0 # slow, but gets all the tags | |
| ref: ${{ github.event.client_payload.ref }} | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| - name: install cibuildwheel | |
| run: | | |
| python -m pip install -r cibw-requirements.txt | |
| - name: Build wheels | |
| run: python -m cibuildwheel --output-dir wheelhouse | |
| env: | |
| CIBW_BUILD: ${{ matrix.build }} | |
| CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/${{ matrix.image }} | |
| CIBW_MUSLLINUX_X86_64_IMAGE: quay.io/pypa/${{ matrix.image }} | |
| # configure cibuildwheel to build native 64-bit archs ('auto64'), and some | |
| # emulated ones | |
| # Linux arm64 wheels are built on circleci | |
| CIBW_ARCHS_LINUX: auto64 # ppc64le s390x | |
| CIBW_ENVIRONMENT_LINUX: PATH=/usr/local/bin:/usr/lib/ccache:$PATH CCACHE_DIR=/host${{ github.workspace }}/.ccache CCACHE_CONFIGPATH=/host/home/runner/.config/ccache/ccache.conf SCHEMA_SALAD_USE_MYPYC=1 MYPYPATH="$(pwd)/mypy-stubs" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-${{ matrix.image }} | |
| path: ./wheelhouse/*.whl | |
| build_sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| if: ${{ github.event_name != 'repository_dispatch' }} | |
| with: | |
| fetch-depth: 0 # slow, but gets all the tags | |
| - uses: actions/checkout@v5 | |
| if: ${{ github.event_name == 'repository_dispatch' }} | |
| with: | |
| fetch-depth: 0 # slow, but gets all the tags | |
| ref: ${{ github.event.client_payload.ref }} | |
| - name: Build sdist | |
| run: pipx run build --sdist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-source | |
| path: dist/*.tar.gz | |
| build_wheels_macos: | |
| name: Build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| # macos-13 is an intel runner, macos-14+ is apple silicon | |
| os: [macos-13, macos-latest] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| if: ${{ github.event_name != 'repository_dispatch' }} | |
| with: | |
| fetch-depth: 0 # slow, but gets all the tags | |
| - uses: actions/checkout@v5 | |
| if: ${{ github.event_name == 'repository_dispatch' }} | |
| with: | |
| fetch-depth: 0 # slow, but gets all the tags | |
| ref: ${{ github.event.client_payload.ref }} | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| - name: install cibuildwheel | |
| run: | | |
| python -m pip install -r cibw-requirements.txt | |
| - name: Build wheels | |
| run: python -m cibuildwheel --output-dir wheelhouse | |
| env: | |
| CIBW_ENVIRONMENT_MACOS: PATH=/usr/local/opt/ccache/libexec:$PATH SCHEMA_SALAD_USE_MYPYC=1 MYPYPATH="$(pwd)/mypy-stubs" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-${{ matrix.os }}-${{ strategy.job-index }} | |
| path: ./wheelhouse/*.whl | |
| build_wheels_riscv64: | |
| name: riscv64 ${{ matrix.target }} wheels | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| target: [ 'many', 'musl' ] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| if: ${{ github.event_name != 'repository_dispatch' }} | |
| with: | |
| fetch-depth: 0 # slow, but gets all the tags | |
| - uses: actions/checkout@v5 | |
| if: ${{ github.event_name == 'repository_dispatch' }} | |
| with: | |
| fetch-depth: 0 # slow, but gets all the tags | |
| ref: ${{ github.event.client_payload.ref }} | |
| - name: Skip manylinux for musllinux target | |
| if: ${{ matrix.target == 'musl' }} | |
| run: | | |
| echo "CIBW_SKIP=*manylinux*" >> "$GITHUB_ENV" | |
| - name: Skip musllinux for manylinux target | |
| if: ${{ matrix.target == 'many' }} | |
| run: | | |
| echo "CIBW_SKIP=*musllinux*" >> "$GITHUB_ENV" | |
| - name: ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| key: ${{ github.job }}-${{ matrix.target }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| with: | |
| platforms: all | |
| # This should be temporary | |
| # xref https://github.com/docker/setup-qemu-action/issues/188 | |
| # xref https://github.com/tonistiigi/binfmt/issues/215 | |
| image: tonistiigi/binfmt:qemu-v8.1.5 | |
| id: qemu | |
| - name: install cibuildwheel | |
| run: | | |
| python -m pip install -r cibw-requirements.txt | |
| - name: Build wheels | |
| run: python -m cibuildwheel --output-dir wheelhouse | |
| env: | |
| CIBW_ARCHS_LINUX: riscv64 | |
| CIBW_ENVIRONMENT_LINUX: PATH=/usr/local/bin:/usr/lib/ccache:$PATH CCACHE_DIR=/host${{ github.workspace }}/.ccache CCACHE_CONFIGPATH=/host/home/runner/.config/ccache/ccache.conf SCHEMA_SALAD_USE_MYPYC=1 MYPYPATH="$(pwd)/mypy-stubs" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-riscv64-${{ matrix.target }} | |
| path: ./wheelhouse/*.whl | |
| upload_pypi: | |
| needs: [build_wheels, build_sdist, build_wheels_riscv64] | |
| runs-on: ubuntu-24.04 | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| if: (github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'repository_dispatch' && github.event.client_payload.publish_wheel == true) | |
| steps: | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| # unpacks default artifact into dist/ | |
| pattern: artifact-* | |
| merge-multiple: true | |
| path: dist | |
| - uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| skip-existing: true |