|
| 1 | +--- |
| 2 | +name: Build zstandard wheels (riscv64) |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + version: |
| 8 | + description: 'zstandard version to build (git tag, e.g. 0.25.0)' |
| 9 | + required: true |
| 10 | + default: '0.25.0' |
| 11 | + pull_request: |
| 12 | + paths: |
| 13 | + - '.github/workflows/build-zstandard.yml' |
| 14 | + - 'actions/publish-to-gitlab/**' |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.workflow }}-${{ inputs.version || '0.25.0' }}-${{ github.head_ref || github.run_id }} |
| 18 | + cancel-in-progress: true |
| 19 | + |
| 20 | +permissions: |
| 21 | + contents: read # to fetch code (actions/checkout) |
| 22 | + |
| 23 | +env: |
| 24 | + # `inputs.version` is empty on pull_request events; default to 0.25.0 there. |
| 25 | + ZSTANDARD_VERSION: ${{ inputs.version || '0.25.0' }} |
| 26 | + UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ |
| 27 | + UV_INDEX_STRATEGY: unsafe-best-match |
| 28 | + UV_ONLY_BINARY: ':all:' |
| 29 | + |
| 30 | +jobs: |
| 31 | + build_wheels: |
| 32 | + name: Build zstandard ${{ inputs.version || '0.25.0' }} ${{ matrix.python }}-manylinux_riscv64 |
| 33 | + runs-on: ubuntu-24.04-riscv |
| 34 | + strategy: |
| 35 | + fail-fast: false |
| 36 | + matrix: |
| 37 | + python: ["cp312", "cp313", "cp314", "cp314t"] |
| 38 | + |
| 39 | + steps: |
| 40 | + - name: Checkout python-wheels |
| 41 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 42 | + with: |
| 43 | + path: python-wheels-repo |
| 44 | + persist-credentials: false |
| 45 | + |
| 46 | + # zstandard vendors the zstd C library as a submodule and, unlike numpy, |
| 47 | + # tags releases without a leading `v` (e.g. `0.25.0`), so the ref is the |
| 48 | + # bare version. |
| 49 | + - name: Checkout zstandard ${{ env.ZSTANDARD_VERSION }} |
| 50 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 51 | + with: |
| 52 | + repository: indygreg/python-zstandard |
| 53 | + ref: ${{ env.ZSTANDARD_VERSION }} |
| 54 | + submodules: recursive |
| 55 | + persist-credentials: false |
| 56 | + |
| 57 | + - name: Build wheels |
| 58 | + uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0 |
| 59 | + env: |
| 60 | + CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64 |
| 61 | + # Upstream pins `build-frontend = "build[uv]"` in pyproject.toml, which |
| 62 | + # fails on riscv64: uv is not present in the manylinux_riscv64 image, so |
| 63 | + # cibuildwheel aborts on `which uv`. Force the plain build frontend. |
| 64 | + CIBW_BUILD_FRONTEND: build |
| 65 | + |
| 66 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 67 | + with: |
| 68 | + name: zstandard-${{ env.ZSTANDARD_VERSION }}-${{ matrix.python }}-manylinux_riscv64 |
| 69 | + path: ./wheelhouse/*.whl |
| 70 | + if-no-files-found: error |
| 71 | + |
| 72 | + publish: |
| 73 | + name: Publish zstandard ${{ inputs.version || '0.25.0' }} to GitLab |
| 74 | + needs: build_wheels |
| 75 | + # Only publish when the workflow was triggered from main with a specific |
| 76 | + # version. Manual trigger is the only entry point, so checking the ref is |
| 77 | + # enough to gate uploads. |
| 78 | + if: github.ref == 'refs/heads/main' |
| 79 | + runs-on: ubuntu-24.04-riscv |
| 80 | + permissions: |
| 81 | + contents: read |
| 82 | + |
| 83 | + steps: |
| 84 | + - name: Checkout python-wheels |
| 85 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 86 | + with: |
| 87 | + path: python-wheels-repo |
| 88 | + persist-credentials: false |
| 89 | + |
| 90 | + - name: Download wheels |
| 91 | + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
| 92 | + with: |
| 93 | + pattern: zstandard-${{ env.ZSTANDARD_VERSION }}-*-manylinux_riscv64 |
| 94 | + path: dist |
| 95 | + merge-multiple: true |
| 96 | + |
| 97 | + - name: Publish to GitLab PyPI registry |
| 98 | + uses: ./python-wheels-repo/actions/publish-to-gitlab |
| 99 | + with: |
| 100 | + gitlab-username: ${{ vars.GITLAB_DEPLOY_USER }} |
| 101 | + gitlab-token: ${{ secrets.GITLAB_DEPLOY_TOKEN }} |
| 102 | + gitlab-project-id: ${{ vars.GITLAB_PROJECT_ID }} |
| 103 | + files: | |
| 104 | + dist/*.whl |
0 commit comments