|
11 | 11 | pull_request: |
12 | 12 | paths: |
13 | 13 | - '.github/workflows/build-zstandard.yml' |
14 | | - - 'actions/publish-to-gitlab/**' |
| 14 | + - 'patches/zstandard/**' |
15 | 15 |
|
16 | 16 | concurrency: |
17 | 17 | group: ${{ github.workflow }}-${{ inputs.version || '0.25.0' }}-${{ github.head_ref || github.run_id }} |
|
26 | 26 | UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ |
27 | 27 | UV_INDEX_STRATEGY: unsafe-best-match |
28 | 28 | UV_ONLY_BINARY: ':all:' |
| 29 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 30 | + # The version upstream runs in wheel.yml since they moved off 3.1.4 |
| 31 | + CIBUILDWHEEL_VERSION: '4.1.0' |
29 | 32 |
|
30 | 33 | jobs: |
31 | | - build_wheels: |
32 | | - name: Build zstandard ${{ inputs.version || '0.25.0' }} ${{ matrix.python }}-manylinux_riscv64 |
| 34 | + # Upstream's Linux job builds a py x arch x abi x image matrix. On riscv64 |
| 35 | + # only one image exists, and musllinux is left out for now, so the matrix |
| 36 | + # collapses to the Python versions. |
| 37 | + linux: |
| 38 | + name: Build zstandard ${{ inputs.version || '0.25.0' }} ${{ matrix.py }}-manylinux_riscv64 |
33 | 39 | runs-on: ubuntu-24.04-riscv |
34 | 40 | strategy: |
35 | 41 | fail-fast: false |
36 | 42 | matrix: |
37 | | - python: ["cp311", "cp312", "cp313", "cp314", "cp314t"] |
| 43 | + py: ["cp312", "cp313", "cp314", "cp314t"] |
38 | 44 |
|
39 | 45 | steps: |
40 | | - # zstandard vendors the zstd C library as a submodule and, unlike numpy, |
41 | | - # tags releases without a leading `v` (e.g. `0.25.0`), so the ref is the |
42 | | - # bare version. |
| 46 | + # zstandard tags releases without a leading `v` (e.g. `0.25.0`), so the ref |
| 47 | + # is the bare version. |
43 | 48 | - name: Checkout zstandard ${{ env.ZSTANDARD_VERSION }} |
44 | 49 | uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
45 | 50 | with: |
46 | 51 | repository: indygreg/python-zstandard |
47 | 52 | ref: ${{ env.ZSTANDARD_VERSION }} |
48 | | - submodules: recursive |
49 | 53 | persist-credentials: false |
50 | 54 |
|
51 | | - # zstandard 0.25.0 targets cibuildwheel 3.x and pins |
52 | | - # `enable = ["cpython-freethreading", "cpython-prerelease"]`. cibuildwheel |
53 | | - # 4.x dropped the cpython-freethreading group (freethreaded builds are on |
54 | | - # by default now) and errors out on it at config-parse. Strip it so the |
55 | | - # pinned 4.1.0 can read the config; freethreaded cp314t still builds. |
56 | | - # Upstream HEAD already removed it, so this is only needed for this tag. |
57 | | - - name: Make pyproject enable groups compatible with cibuildwheel 4.x |
58 | | - working-directory: ${{ github.workspace }} |
| 55 | + - name: Checkout python-wheels |
| 56 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 57 | + with: |
| 58 | + path: python-wheels |
| 59 | + persist-credentials: false |
| 60 | + |
| 61 | + # 0.25.0 still lists the cpython-freethreading enable group, which |
| 62 | + # cibuildwheel 4.x rejects. Upstream dropped it after the tag. |
| 63 | + - name: Patch zstandard source |
59 | 64 | run: | |
60 | | - python3 - <<'PY' |
61 | | - import pathlib |
62 | | - p = pathlib.Path("pyproject.toml") |
63 | | - t = p.read_text() |
64 | | - for tok in ('"cpython-freethreading", ', ', "cpython-freethreading"', |
65 | | - '"cpython-freethreading"'): |
66 | | - t = t.replace(tok, "") |
67 | | - p.write_text(t) |
68 | | - PY |
| 65 | + git apply python-wheels/patches/zstandard/${{ env.ZSTANDARD_VERSION }}/00*.patch |
69 | 66 |
|
| 67 | + - name: Install uv |
| 68 | + uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 |
| 69 | + with: |
| 70 | + python-version: '3.12' |
| 71 | + activate-environment: true |
| 72 | + enable-cache: false |
| 73 | + |
| 74 | + # Upstream runs `uvx -p 3.13 cibuildwheel@4.1.0`. We build with the 3.12 |
| 75 | + # environment the development guide standardises on for these runners. |
| 76 | + # Everything else (build-frontend, environment, test-command, test-groups, |
| 77 | + # test-sources) comes from [tool.cibuildwheel] in the project's own |
| 78 | + # pyproject.toml. PIP_EXTRA_INDEX_URL is forwarded rather than set through |
| 79 | + # CIBW_ENVIRONMENT so that upstream's ZSTD_WARNINGS_AS_ERRORS survives; it |
| 80 | + # gets cffi and the dev test group from our registry instead of building |
| 81 | + # them in the container. |
70 | 82 | - name: Build wheels |
71 | | - uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0 |
| 83 | + run: uvx cibuildwheel@${{ env.CIBUILDWHEEL_VERSION }} |
72 | 84 | env: |
73 | | - CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64 |
| 85 | + CIBW_ARCHS: riscv64 |
| 86 | + CIBW_BUILD: ${{ matrix.py }}-manylinux_riscv64 |
| 87 | + CIBW_BUILD_VERBOSITY: '1' |
| 88 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 89 | + CIBW_ENVIRONMENT_PASS_LINUX: PIP_EXTRA_INDEX_URL |
| 90 | + PIP_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ |
74 | 91 |
|
| 92 | + # Upstream skips the upload for freethreaded builds; we keep ours, since |
| 93 | + # cp314t is part of the matrix we publish. |
75 | 94 | - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
76 | 95 | with: |
77 | | - name: zstandard-${{ env.ZSTANDARD_VERSION }}-${{ matrix.python }}-manylinux_riscv64 |
| 96 | + name: zstandard-${{ env.ZSTANDARD_VERSION }}-${{ matrix.py }}-manylinux_riscv64 |
78 | 97 | path: ./wheelhouse/*.whl |
79 | 98 | if-no-files-found: error |
80 | 99 |
|
81 | 100 | publish: |
82 | 101 | name: Publish zstandard ${{ inputs.version || '0.25.0' }} to GitLab |
83 | | - needs: build_wheels |
84 | | - # Only publish when the workflow was triggered from main with a specific |
85 | | - # version. Manual trigger is the only entry point, so checking the ref is |
86 | | - # enough to gate uploads. |
87 | | - if: github.ref == 'refs/heads/main' |
| 102 | + needs: [linux] |
88 | 103 | runs-on: ubuntu-latest |
89 | 104 | permissions: |
90 | | - contents: read |
| 105 | + contents: write |
| 106 | + pull-requests: write |
91 | 107 |
|
92 | 108 | steps: |
93 | | - - name: Download wheels |
94 | | - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 |
95 | | - with: |
96 | | - pattern: zstandard-${{ env.ZSTANDARD_VERSION }}-*-manylinux_riscv64 |
97 | | - path: dist |
98 | | - merge-multiple: true |
99 | | - |
100 | | - - name: Publish to GitLab PyPI registry |
101 | | - uses: riseproject-dev/python-wheels/actions/publish-to-gitlab@main |
| 109 | + - name: Publish wheels and open docs PR |
| 110 | + uses: riseproject-dev/python-wheels/actions/publish-wheels@main |
102 | 111 | with: |
| 112 | + artifact-pattern: zstandard-${{ env.ZSTANDARD_VERSION }}-*-manylinux_riscv64 |
103 | 113 | gitlab-username: ${{ vars.GITLAB_DEPLOY_USER }} |
104 | 114 | gitlab-token: ${{ secrets.GITLAB_DEPLOY_TOKEN }} |
105 | 115 | gitlab-project-id: ${{ vars.GITLAB_PROJECT_ID }} |
106 | | - files: | |
107 | | - dist/*.whl |
| 116 | + gh-token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments