|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# Based on upstream's wheel builder: |
| 5 | +# https://github.com/Legrandin/pycryptodome/blob/v3.23.0/.github/workflows/wheels.yml |
| 6 | +name: Build pycryptodome wheels (riscv64) |
| 7 | + |
| 8 | +on: |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + version: |
| 12 | + description: 'pycryptodome version to build (git tag without leading v, e.g. 3.23.0)' |
| 13 | + required: true |
| 14 | + default: '3.23.0' |
| 15 | + pull_request: |
| 16 | + paths: |
| 17 | + - '.github/workflows/build-pycryptodome.yml' |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ inputs.version || '3.23.0' }}-${{ 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 | + PYCRYPTODOME_VERSION: ${{ inputs.version || '3.23.0' }} |
| 28 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 29 | + # Upstream's requirements-test.txt; without it SelfTest skips its Wycheproof vectors. |
| 30 | + TEST_REQUIRES: pycryptodome-test-vectors==1.0.22 |
| 31 | + TEST_COMMAND: python -m Crypto.SelfTest --skip-slow-tests |
| 32 | + |
| 33 | +jobs: |
| 34 | + # setup.py passes py_limited_api=cp37 to bdist_wheel, so one wheel covers every |
| 35 | + # non-free-threaded CPython; cibuildwheel builds it on cp312 and re-tests it on |
| 36 | + # cp313/cp314 (find_compatible_wheel). |
| 37 | + build_abi3: |
| 38 | + name: Build pycryptodome ${{ inputs.version || '3.23.0' }} cp37-abi3-manylinux_riscv64 |
| 39 | + runs-on: ubuntu-24.04-riscv |
| 40 | + timeout-minutes: 180 |
| 41 | + |
| 42 | + steps: |
| 43 | + - name: Checkout pycryptodome v${{ env.PYCRYPTODOME_VERSION }} |
| 44 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 45 | + with: |
| 46 | + repository: Legrandin/pycryptodome |
| 47 | + ref: v${{ env.PYCRYPTODOME_VERSION }} |
| 48 | + persist-credentials: false |
| 49 | + |
| 50 | + - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 51 | + env: |
| 52 | + CIBW_ARCHS: riscv64 |
| 53 | + CIBW_BUILD: cp312-manylinux_riscv64 cp313-manylinux_riscv64 cp314-manylinux_riscv64 |
| 54 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 55 | + CIBW_TEST_REQUIRES: ${{ env.TEST_REQUIRES }} |
| 56 | + CIBW_TEST_COMMAND: ${{ env.TEST_COMMAND }} |
| 57 | + |
| 58 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 59 | + with: |
| 60 | + name: pycryptodome-${{ env.PYCRYPTODOME_VERSION }}-cp37-abi3-manylinux_riscv64 |
| 61 | + path: ./wheelhouse/*.whl |
| 62 | + if-no-files-found: error |
| 63 | + |
| 64 | + # Free-threaded builds get no abi3 wheel (setup.py skips py_limited_api under |
| 65 | + # Py_GIL_DISABLED); cp314t is the only free-threaded interpreter in the image. |
| 66 | + build_freethreaded: |
| 67 | + name: Build pycryptodome ${{ inputs.version || '3.23.0' }} cp314t-manylinux_riscv64 |
| 68 | + runs-on: ubuntu-24.04-riscv |
| 69 | + timeout-minutes: 180 |
| 70 | + |
| 71 | + steps: |
| 72 | + - name: Checkout pycryptodome v${{ env.PYCRYPTODOME_VERSION }} |
| 73 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 74 | + with: |
| 75 | + repository: Legrandin/pycryptodome |
| 76 | + ref: v${{ env.PYCRYPTODOME_VERSION }} |
| 77 | + persist-credentials: false |
| 78 | + |
| 79 | + - uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 80 | + env: |
| 81 | + CIBW_ARCHS: riscv64 |
| 82 | + CIBW_BUILD: cp314t-manylinux_riscv64 |
| 83 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 84 | + CIBW_TEST_REQUIRES: ${{ env.TEST_REQUIRES }} |
| 85 | + CIBW_TEST_COMMAND: ${{ env.TEST_COMMAND }} |
| 86 | + |
| 87 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 88 | + with: |
| 89 | + name: pycryptodome-${{ env.PYCRYPTODOME_VERSION }}-cp314t-manylinux_riscv64 |
| 90 | + path: ./wheelhouse/*.whl |
| 91 | + if-no-files-found: error |
| 92 | + |
| 93 | + publish: |
| 94 | + name: Publish pycryptodome ${{ inputs.version || '3.23.0' }} to GitLab |
| 95 | + needs: [build_abi3, build_freethreaded] |
| 96 | + runs-on: ubuntu-latest |
| 97 | + permissions: |
| 98 | + contents: write |
| 99 | + pull-requests: write |
| 100 | + |
| 101 | + steps: |
| 102 | + - name: Publish wheels and open docs PR |
| 103 | + uses: riseproject-dev/python-wheels/actions/publish-wheels@main |
| 104 | + with: |
| 105 | + artifact-pattern: pycryptodome-${{ env.PYCRYPTODOME_VERSION }}-*-manylinux_riscv64 |
| 106 | + gitlab-username: ${{ vars.GITLAB_DEPLOY_USER }} |
| 107 | + gitlab-token: ${{ secrets.GITLAB_DEPLOY_TOKEN }} |
| 108 | + gitlab-project-id: ${{ vars.GITLAB_PROJECT_ID }} |
| 109 | + gh-token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments