|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# This workflow is based on: https://github.com/Init7/pyicu/blob/v2.15.2/.github/workflows/build.yml |
| 5 | +name: Build pyicu-wheels wheels (riscv64) |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + version: |
| 11 | + description: 'Version glob to (re)build; empty builds every version of docs/packages/pyicu-wheels.yaml not released yet' |
| 12 | + required: false |
| 13 | + default: '' |
| 14 | + pull_request: |
| 15 | + branches: [main] |
| 16 | + paths: |
| 17 | + - '.github/workflows/build-pyicu-wheels.yml' |
| 18 | + - 'docs/packages/pyicu-wheels.yaml' |
| 19 | + - 'patches/pyicu-wheels/**' |
| 20 | + push: |
| 21 | + branches: [main] |
| 22 | + paths: |
| 23 | + - '.github/workflows/build-pyicu-wheels.yml' |
| 24 | + - 'docs/packages/pyicu-wheels.yaml' |
| 25 | + - 'patches/pyicu-wheels/**' |
| 26 | + |
| 27 | +concurrency: |
| 28 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 29 | + cancel-in-progress: true |
| 30 | + |
| 31 | +permissions: |
| 32 | + contents: read # to fetch code (actions/checkout) |
| 33 | + |
| 34 | +env: |
| 35 | + UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ |
| 36 | + UV_INDEX_STRATEGY: unsafe-best-match |
| 37 | + UV_ONLY_BINARY: ':all:' |
| 38 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 39 | + |
| 40 | +jobs: |
| 41 | + setup: |
| 42 | + uses: $/.github/workflows/_setup.yml |
| 43 | + with: |
| 44 | + package: pyicu-wheels |
| 45 | + version: ${{ inputs.version }} |
| 46 | + |
| 47 | + linux: |
| 48 | + needs: [setup] |
| 49 | + if: needs.setup.outputs.versions != '[]' |
| 50 | + name: Build pyicu-wheels ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 |
| 51 | + runs-on: ubuntu-24.04-riscv |
| 52 | + timeout-minutes: 240 |
| 53 | + strategy: |
| 54 | + fail-fast: false |
| 55 | + matrix: |
| 56 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 57 | + python: ["cp312", "cp313", "cp314", "cp314t"] |
| 58 | + |
| 59 | + env: |
| 60 | + PYICU_WHEELS_VERSION: ${{ matrix.version }} |
| 61 | + # A container-local ICU prefix; upstream's /host/tmp/.build only exists to feed its actions/cache. |
| 62 | + _LIBICU_DIR: "/tmp/.build" |
| 63 | + |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 66 | + with: |
| 67 | + repository: Init7/pyicu |
| 68 | + ref: v${{ env.PYICU_WHEELS_VERSION }} |
| 69 | + persist-credentials: false |
| 70 | + |
| 71 | + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 72 | + with: |
| 73 | + path: python-wheels |
| 74 | + persist-credentials: false |
| 75 | + |
| 76 | + - name: Apply riscv64 patches |
| 77 | + run: git apply -v python-wheels/patches/pyicu-wheels/${{ env.PYICU_WHEELS_VERSION }}/*.patch |
| 78 | + |
| 79 | + - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 |
| 80 | + with: |
| 81 | + python-version: '3.12' |
| 82 | + activate-environment: true |
| 83 | + enable-cache: false |
| 84 | + |
| 85 | + - name: Install Hatch |
| 86 | + run: uv pip install --upgrade hatch |
| 87 | + |
| 88 | + - name: Export PYICU_VERSION and LIBICU_VERSION |
| 89 | + run: | |
| 90 | + python - >> "$GITHUB_ENV" <<'EOF' |
| 91 | + import tomllib |
| 92 | + env = tomllib.load(open("pyproject.toml", "rb"))["tool"]["hatch"]["envs"]["default"]["env-vars"] |
| 93 | + for key in ("PYICU_VERSION", "LIBICU_VERSION"): |
| 94 | + print(f"{key}={env[key]}") |
| 95 | + EOF |
| 96 | +
|
| 97 | + - name: Fetch pyicu source |
| 98 | + run: hatch run pyicu:clone |
| 99 | + |
| 100 | + - name: Copy src and tests |
| 101 | + run: | |
| 102 | + hatch run pyicu:src |
| 103 | + hatch run pyicu:tests |
| 104 | +
|
| 105 | + - name: Build wheels |
| 106 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 107 | + with: |
| 108 | + output-dir: wheelhouse |
| 109 | + only: ${{ matrix.python }}-manylinux_riscv64 |
| 110 | + env: |
| 111 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 112 | + CIBW_ENVIRONMENT: MAKEFLAGS="-j$(nproc)" |
| 113 | + |
| 114 | + - name: Check the wheel bundles ICU and its licences |
| 115 | + run: | |
| 116 | + python - wheelhouse/*.whl <<'EOF' |
| 117 | + import sys, zipfile |
| 118 | + for whl in sys.argv[1:]: |
| 119 | + names = zipfile.ZipFile(whl).namelist() |
| 120 | + assert any(n.startswith("icu/_icu_") and n.endswith(".so") for n in names), (whl, names) |
| 121 | + assert any(n.startswith("pyicu_wheels.libs/libicudata") for n in names), (whl, names) |
| 122 | + for lic in ("LICENSE.txt", "licenses/icu.txt", "licenses/pyicu.txt"): |
| 123 | + assert any(n.endswith(".dist-info/licenses/" + lic) for n in names), (whl, lic, names) |
| 124 | + print(whl, "OK") |
| 125 | + EOF |
| 126 | +
|
| 127 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 128 | + with: |
| 129 | + name: pyicu-wheels-${{ env.PYICU_WHEELS_VERSION }}-${{ matrix.python }}-manylinux_riscv64 |
| 130 | + path: wheelhouse/*.whl |
| 131 | + if-no-files-found: error |
| 132 | + |
| 133 | + publish: |
| 134 | + name: Publish pyicu-wheels ${{ matrix.version }} |
| 135 | + needs: [setup, linux] |
| 136 | + if: needs.setup.outputs.versions != '[]' |
| 137 | + strategy: |
| 138 | + fail-fast: false |
| 139 | + matrix: |
| 140 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 141 | + permissions: |
| 142 | + contents: write |
| 143 | + pull-requests: write |
| 144 | + uses: $/.github/workflows/_publish-wheel.yml |
| 145 | + secrets: |
| 146 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 147 | + with: |
| 148 | + artifact-pattern: pyicu-wheels-${{ matrix.version }}-*-manylinux_riscv64 |
0 commit comments