|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | +--- |
| 4 | +# This workflow is based on the Linux `maturin build` steps of |
| 5 | +# https://github.com/ngrok/ngrok-python/blob/v1.7.0/.github/workflows/build.yml |
| 6 | +# and the `test` job of |
| 7 | +# https://github.com/ngrok/ngrok-python/blob/v1.7.0/.github/workflows/ci.yml |
| 8 | +name: Build ngrok wheels (riscv64) |
| 9 | + |
| 10 | +on: |
| 11 | + workflow_dispatch: |
| 12 | + inputs: |
| 13 | + version: |
| 14 | + description: 'Version glob to (re)build; empty builds every version of docs/packages/ngrok.yaml not released yet' |
| 15 | + required: false |
| 16 | + default: '' |
| 17 | + pull_request: |
| 18 | + branches: [main] |
| 19 | + paths: |
| 20 | + - '.github/workflows/build-ngrok.yml' |
| 21 | + - 'docs/packages/ngrok.yaml' |
| 22 | + push: |
| 23 | + branches: [main] |
| 24 | + paths: |
| 25 | + - '.github/workflows/build-ngrok.yml' |
| 26 | + - 'docs/packages/ngrok.yaml' |
| 27 | + |
| 28 | +concurrency: |
| 29 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 30 | + cancel-in-progress: true |
| 31 | + |
| 32 | +permissions: |
| 33 | + contents: read # to fetch code (actions/checkout) |
| 34 | + |
| 35 | +env: |
| 36 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 37 | + |
| 38 | +jobs: |
| 39 | + setup: |
| 40 | + uses: $/.github/workflows/_setup.yml |
| 41 | + with: |
| 42 | + package: ngrok |
| 43 | + version: ${{ inputs.version }} |
| 44 | + |
| 45 | + build_wheels: |
| 46 | + needs: [setup] |
| 47 | + if: needs.setup.outputs.versions != '[]' |
| 48 | + strategy: |
| 49 | + fail-fast: false |
| 50 | + matrix: |
| 51 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 52 | + name: Build ngrok ${{ matrix.version }} cp310-abi3-manylinux_riscv64 |
| 53 | + runs-on: ubuntu-24.04-riscv |
| 54 | + timeout-minutes: 360 |
| 55 | + |
| 56 | + env: |
| 57 | + NGROK_VERSION: ${{ matrix.version }} |
| 58 | + |
| 59 | + steps: |
| 60 | + - name: Checkout ngrok-python v${{ env.NGROK_VERSION }} |
| 61 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 62 | + with: |
| 63 | + repository: ngrok/ngrok-python |
| 64 | + ref: v${{ env.NGROK_VERSION }} |
| 65 | + persist-credentials: false |
| 66 | + |
| 67 | + - name: Build wheels |
| 68 | + uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 |
| 69 | + with: |
| 70 | + output-dir: wheelhouse/ |
| 71 | + env: |
| 72 | + # pyo3 carries abi3-py310 unconditionally, so cp313/cp314 re-test the |
| 73 | + # cp312 build. pyo3 0.22 cannot build for free-threaded CPython. |
| 74 | + CIBW_BUILD: cp312-manylinux_riscv64 cp313-manylinux_riscv64 cp314-manylinux_riscv64 |
| 75 | + CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} |
| 76 | + # aws-lc-sys is built with its `bindgen` feature, which needs libclang. |
| 77 | + CIBW_BEFORE_ALL_LINUX: >- |
| 78 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal && |
| 79 | + dnf -y install clang-devel |
| 80 | + CIBW_ENVIRONMENT_LINUX: >- |
| 81 | + PATH="$PATH:$HOME/.cargo/bin" |
| 82 | + PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ |
| 83 | + CIBW_TEST_SOURCES: test examples pytest.ini |
| 84 | + CIBW_TEST_REQUIRES: pytest pytest-timeout aiohttp requests mypy |
| 85 | + # Upstream's suite needs an NGROK_AUTHTOKEN secret; these tests need |
| 86 | + # none, and test_ca_cert/test_invalid_authtoken still complete a TLS |
| 87 | + # handshake with the ngrok service. |
| 88 | + CIBW_TEST_COMMAND: >- |
| 89 | + python -c "import ngrok.ngrok as m; assert m.__file__.endswith('.so'), m.__file__" && |
| 90 | + python -m mypy |
| 91 | + examples/ngrok-forward-minimal.py examples/ngrok-forward-full.py |
| 92 | + examples/ngrok-http-minimal.py examples/ngrok-http-full.py |
| 93 | + examples/ngrok-labeled.py examples/ngrok-tcp.py examples/ngrok-tls.py && |
| 94 | + python -m pytest -v test/test_main.py test/test.py |
| 95 | + -k "TestNgrokMain or test_import or test_pipe_name or test_ca_cert or test_invalid_authtoken" |
| 96 | +
|
| 97 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 98 | + with: |
| 99 | + name: ngrok-${{ env.NGROK_VERSION }}-cp310-abi3-manylinux_riscv64 |
| 100 | + path: wheelhouse/*.whl |
| 101 | + if-no-files-found: error |
| 102 | + |
| 103 | + publish: |
| 104 | + name: Publish ngrok ${{ matrix.version }} |
| 105 | + needs: [setup, build_wheels] |
| 106 | + if: needs.setup.outputs.versions != '[]' |
| 107 | + strategy: |
| 108 | + fail-fast: false |
| 109 | + matrix: |
| 110 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 111 | + permissions: |
| 112 | + contents: write |
| 113 | + pull-requests: write |
| 114 | + uses: $/.github/workflows/_publish-wheel.yml |
| 115 | + secrets: |
| 116 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 117 | + with: |
| 118 | + artifact-pattern: ngrok-${{ matrix.version }}-*-manylinux_riscv64 |
0 commit comments