Build zstandard wheels (riscv64) #11
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: Build zstandard wheels (riscv64) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'zstandard version to build (git tag, e.g. 0.25.0)' | |
| required: true | |
| default: '0.25.0' | |
| pull_request: | |
| paths: | |
| - '.github/workflows/build-zstandard.yml' | |
| - 'patches/zstandard/**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ inputs.version || '0.25.0' }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read # to fetch code (actions/checkout) | |
| env: | |
| # `inputs.version` is empty on pull_request events; default to 0.25.0 there. | |
| ZSTANDARD_VERSION: ${{ inputs.version || '0.25.0' }} | |
| UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ | |
| UV_INDEX_STRATEGY: unsafe-best-match | |
| UV_ONLY_BINARY: ':all:' | |
| MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 | |
| # The version upstream runs in wheel.yml since they moved off 3.1.4 | |
| CIBUILDWHEEL_VERSION: '4.1.0' | |
| jobs: | |
| # Upstream's Linux job builds a py x arch x abi x image matrix. On riscv64 | |
| # only one image exists, and musllinux is left out for now, so the matrix | |
| # collapses to the Python versions. | |
| linux: | |
| name: Build zstandard ${{ inputs.version || '0.25.0' }} ${{ matrix.py }}-manylinux_riscv64 | |
| runs-on: ubuntu-24.04-riscv | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| py: ["cp312", "cp313", "cp314", "cp314t"] | |
| steps: | |
| # zstandard tags releases without a leading `v` (e.g. `0.25.0`), so the ref | |
| # is the bare version. | |
| - name: Checkout zstandard ${{ env.ZSTANDARD_VERSION }} | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| repository: indygreg/python-zstandard | |
| ref: ${{ env.ZSTANDARD_VERSION }} | |
| persist-credentials: false | |
| - name: Checkout python-wheels | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| path: python-wheels | |
| persist-credentials: false | |
| # 0.25.0 still lists the cpython-freethreading enable group, which | |
| # cibuildwheel 4.x rejects. Upstream dropped it after the tag. | |
| - name: Patch zstandard source | |
| run: | | |
| git apply python-wheels/patches/zstandard/${{ env.ZSTANDARD_VERSION }}/00*.patch | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 | |
| with: | |
| python-version: '3.12' | |
| activate-environment: true | |
| enable-cache: false | |
| # Upstream runs `uvx -p 3.13 cibuildwheel@4.1.0`. We build with the 3.12 | |
| # environment the development guide standardises on for these runners. | |
| # Everything else (build-frontend, environment, test-command, test-groups, | |
| # test-sources) comes from [tool.cibuildwheel] in the project's own | |
| # pyproject.toml. PIP_EXTRA_INDEX_URL is forwarded rather than set through | |
| # CIBW_ENVIRONMENT so that upstream's ZSTD_WARNINGS_AS_ERRORS survives; it | |
| # gets cffi and the dev test group from our registry instead of building | |
| # them in the container. | |
| - name: Build wheels | |
| run: uvx cibuildwheel@${{ env.CIBUILDWHEEL_VERSION }} | |
| env: | |
| CIBW_ARCHS: riscv64 | |
| CIBW_BUILD: ${{ matrix.py }}-manylinux_riscv64 | |
| CIBW_BUILD_VERBOSITY: '1' | |
| CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} | |
| CIBW_ENVIRONMENT_PASS_LINUX: PIP_EXTRA_INDEX_URL | |
| PIP_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ | |
| # Upstream skips the upload for freethreaded builds; we keep ours, since | |
| # cp314t is part of the matrix we publish. | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: zstandard-${{ env.ZSTANDARD_VERSION }}-${{ matrix.py }}-manylinux_riscv64 | |
| path: ./wheelhouse/*.whl | |
| if-no-files-found: error | |
| publish: | |
| name: Publish zstandard ${{ inputs.version || '0.25.0' }} to GitLab | |
| needs: [linux] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Publish wheels and open docs PR | |
| uses: riseproject-dev/python-wheels/actions/publish-wheels@main | |
| with: | |
| artifact-pattern: zstandard-${{ env.ZSTANDARD_VERSION }}-*-manylinux_riscv64 | |
| gitlab-username: ${{ vars.GITLAB_DEPLOY_USER }} | |
| gitlab-token: ${{ secrets.GITLAB_DEPLOY_TOKEN }} | |
| gitlab-project-id: ${{ vars.GITLAB_PROJECT_ID }} | |
| gh-token: ${{ secrets.GITHUB_TOKEN }} |