|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# This workflow is based on the `build_wheels` job of |
| 5 | +# https://github.com/ilanschnell/bitarray/blob/3.10.1/.github/workflows/build_wheels.yml |
| 6 | +name: Build bitarray wheels (riscv64) |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + version: |
| 12 | + description: 'bitarray version to build (git tag, e.g. 3.10.1)' |
| 13 | + required: true |
| 14 | + default: '3.10.1' |
| 15 | + pull_request: |
| 16 | + paths: |
| 17 | + - '.github/workflows/build-bitarray.yml' |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ inputs.version || '3.10.1' }}-${{ github.head_ref || github.run_id }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +permissions: |
| 24 | + contents: read # to fetch code (actions/checkout) |
| 25 | + |
| 26 | +env: |
| 27 | + BITARRAY_VERSION: ${{ inputs.version || '3.10.1' }} |
| 28 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 29 | + |
| 30 | +jobs: |
| 31 | + build_wheels: |
| 32 | + name: Build bitarray ${{ inputs.version || '3.10.1' }} ${{ matrix.python }}-manylinux_riscv64 |
| 33 | + runs-on: ubuntu-24.04-riscv |
| 34 | + strategy: |
| 35 | + fail-fast: false |
| 36 | + matrix: |
| 37 | + python: |
| 38 | + - "cp312" |
| 39 | + - "cp313" |
| 40 | + - "cp314" |
| 41 | + - "cp314t" |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Checkout bitarray ${{ env.BITARRAY_VERSION }} |
| 45 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 46 | + with: |
| 47 | + repository: ilanschnell/bitarray |
| 48 | + ref: ${{ env.BITARRAY_VERSION }} |
| 49 | + persist-credentials: false |
| 50 | + |
| 51 | + - name: Build wheels |
| 52 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 53 | + with: |
| 54 | + output-dir: wheelhouse/ |
| 55 | + only: ${{ matrix.python }}-manylinux_riscv64 |
| 56 | + env: |
| 57 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 58 | + CIBW_TEST_COMMAND: python -c "import bitarray; assert bitarray.test().wasSuccessful()" |
| 59 | + |
| 60 | + - name: Check the C extensions made it into the wheel |
| 61 | + run: | |
| 62 | + python3 - wheelhouse/*.whl <<'EOF' |
| 63 | + import sys, zipfile |
| 64 | + for whl in sys.argv[1:]: |
| 65 | + names = zipfile.ZipFile(whl).namelist() |
| 66 | + for mod in ("_bitarray", "_util"): |
| 67 | + assert any(mod in n and n.endswith(".so") for n in names), (whl, mod) |
| 68 | + print(whl, "ok") |
| 69 | + EOF |
| 70 | +
|
| 71 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 72 | + with: |
| 73 | + name: bitarray-${{ env.BITARRAY_VERSION }}-${{ matrix.python }}-manylinux_riscv64 |
| 74 | + path: wheelhouse/*.whl |
| 75 | + if-no-files-found: error |
| 76 | + |
| 77 | + publish: |
| 78 | + name: Publish bitarray ${{ inputs.version || '3.10.1' }} to GitLab |
| 79 | + needs: [build_wheels] |
| 80 | + runs-on: ubuntu-latest |
| 81 | + permissions: |
| 82 | + contents: write |
| 83 | + pull-requests: write |
| 84 | + |
| 85 | + steps: |
| 86 | + - name: Publish wheels and open docs PR |
| 87 | + uses: riseproject-dev/python-wheels/actions/publish-wheels@main |
| 88 | + with: |
| 89 | + artifact-pattern: bitarray-${{ env.BITARRAY_VERSION }}-*-manylinux_riscv64 |
| 90 | + gitlab-username: ${{ vars.GITLAB_DEPLOY_USER }} |
| 91 | + gitlab-token: ${{ secrets.GITLAB_DEPLOY_TOKEN }} |
| 92 | + gitlab-project-id: ${{ vars.GITLAB_PROJECT_ID }} |
| 93 | + gh-token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments