|
| 1 | +--- |
| 2 | +name: Build orjson wheels (riscv64) |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + version: |
| 8 | + description: 'orjson version to build (git tag without leading v, e.g. 3.12.0)' |
| 9 | + required: true |
| 10 | + default: '3.12.0' |
| 11 | + pull_request: |
| 12 | + paths: |
| 13 | + - '.github/workflows/build-orjson.yml' |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ inputs.version || '3.12.0' }}-${{ github.head_ref || github.run_id }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + |
| 22 | +env: |
| 23 | + # `inputs.version` is empty on pull_request events; default to 3.12.0 there. |
| 24 | + ORJSON_VERSION: ${{ inputs.version || '3.12.0' }} |
| 25 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 26 | + MUSLLINUX_RISCV64_IMAGE: quay.io/pypa/musllinux_1_2_riscv64 |
| 27 | + RUST_TOOLCHAIN: "nightly-2026-08-01" |
| 28 | + |
| 29 | +jobs: |
| 30 | + manylinux: |
| 31 | + name: Build orjson ${{ inputs.version || '3.12.0' }} ${{ matrix.python }}-manylinux_riscv64 |
| 32 | + runs-on: ubuntu-24.04-riscv |
| 33 | + strategy: |
| 34 | + fail-fast: false |
| 35 | + matrix: |
| 36 | + # No freethreaded (3.14t) entry: upstream only builds freethreaded |
| 37 | + # wheels in manylinux_fedora, which forwards the |
| 38 | + # ORJSON_BUILD_FREETHREADED/UNSAFE_PYO3_BUILD_FREE_THREADED env vars |
| 39 | + # into its container automatically. This job's `podman run` only |
| 40 | + # forwards the -e vars listed below, matching manylinux_pypa upstream. |
| 41 | + python: ['python3.12', 'python3.13', 'python3.14'] |
| 42 | + |
| 43 | + steps: |
| 44 | + - name: Checkout orjson v${{ env.ORJSON_VERSION }} |
| 45 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 46 | + with: |
| 47 | + repository: ijl/orjson |
| 48 | + ref: ${{ env.ORJSON_VERSION }} |
| 49 | + persist-credentials: false |
| 50 | + |
| 51 | + - name: Build and test |
| 52 | + shell: bash |
| 53 | + run: | |
| 54 | + podman run -t \ |
| 55 | + --log-driver=none \ |
| 56 | + -v $(pwd):/workspace \ |
| 57 | + --workdir /workspace \ |
| 58 | + -e CFLAGS="-O2 -fstrict-aliasing" \ |
| 59 | + -e LDFLAGS="-Wl,--as-needed" \ |
| 60 | + -e PYTHON="${{ matrix.python }}" \ |
| 61 | + -e RUST_TOOLCHAIN="${{ env.RUST_TOOLCHAIN }}" \ |
| 62 | + -e ORJSON_COMPATIBILITY="manylinux_2_39" \ |
| 63 | + -e ORJSON_TAG="manylinux_2_39_riscv64" \ |
| 64 | + -e ORJSON_FEATURES="no_panic,optimize" \ |
| 65 | + -e RUSTFLAGS="-Z unstable-options -C panic=immediate-abort -Z mir-opt-level=4 -D warnings" \ |
| 66 | + -e TARGET="riscv64gc-unknown-linux-gnu" \ |
| 67 | + --pull=newer \ |
| 68 | + "${{ env.MANYLINUX_RISCV64_IMAGE }}" \ |
| 69 | + bash -c "ci/manylinux.sh" |
| 70 | +
|
| 71 | + - name: Store wheels |
| 72 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 73 | + with: |
| 74 | + name: "orjson-${{ env.ORJSON_VERSION }}-${{ matrix.python }}-manylinux_riscv64" |
| 75 | + path: target/wheels |
| 76 | + overwrite: true |
| 77 | + retention-days: 1 |
| 78 | + if-no-files-found: error |
| 79 | + compression-level: 0 |
| 80 | + |
| 81 | + # Mirrors upstream's musllinux job. |
| 82 | + musllinux: |
| 83 | + name: Build orjson ${{ inputs.version || '3.12.0' }} ${{ matrix.python }}-musllinux_riscv64 |
| 84 | + runs-on: ubuntu-24.04-riscv |
| 85 | + strategy: |
| 86 | + fail-fast: false |
| 87 | + matrix: |
| 88 | + python: ['python3.12', 'python3.13', 'python3.14'] |
| 89 | + |
| 90 | + steps: |
| 91 | + - name: Checkout orjson v${{ env.ORJSON_VERSION }} |
| 92 | + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 93 | + with: |
| 94 | + repository: ijl/orjson |
| 95 | + ref: ${{ env.ORJSON_VERSION }} |
| 96 | + persist-credentials: false |
| 97 | + |
| 98 | + - name: Build and test |
| 99 | + shell: bash |
| 100 | + run: | |
| 101 | + podman run -t \ |
| 102 | + --log-driver=none \ |
| 103 | + -v $(pwd):/workspace \ |
| 104 | + --workdir /workspace \ |
| 105 | + -e CFLAGS="-O2 -fstrict-aliasing" \ |
| 106 | + -e LDFLAGS="-Wl,--as-needed" \ |
| 107 | + -e PYTHON="${{ matrix.python }}" \ |
| 108 | + -e RUST_TOOLCHAIN="${{ env.RUST_TOOLCHAIN }}" \ |
| 109 | + -e ORJSON_COMPATIBILITY="musllinux_1_2" \ |
| 110 | + -e ORJSON_TAG="musllinux_1_2_riscv64" \ |
| 111 | + -e ORJSON_FEATURES="no_panic,optimize,unwind" \ |
| 112 | + -e RUSTFLAGS="-Z unstable-options -C panic=immediate-abort -Z mir-opt-level=4 -D warnings" \ |
| 113 | + -e TARGET="riscv64gc-unknown-linux-musl" \ |
| 114 | + --pull=newer \ |
| 115 | + "${{ env.MUSLLINUX_RISCV64_IMAGE }}" \ |
| 116 | + bash -c "ci/manylinux.sh" |
| 117 | +
|
| 118 | + - name: Store wheels |
| 119 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 120 | + with: |
| 121 | + name: "orjson-${{ env.ORJSON_VERSION }}-${{ matrix.python }}-musllinux_riscv64" |
| 122 | + path: target/wheels |
| 123 | + overwrite: true |
| 124 | + retention-days: 1 |
| 125 | + if-no-files-found: error |
| 126 | + compression-level: 0 |
| 127 | + |
| 128 | + publish: |
| 129 | + name: Publish orjson ${{ inputs.version || '3.12.0' }} to GitLab |
| 130 | + needs: [manylinux, musllinux] |
| 131 | + runs-on: ubuntu-latest |
| 132 | + permissions: |
| 133 | + contents: write |
| 134 | + pull-requests: write |
| 135 | + |
| 136 | + steps: |
| 137 | + - name: Publish wheels and open docs PR |
| 138 | + uses: riseproject-dev/python-wheels/actions/publish-wheels@main |
| 139 | + with: |
| 140 | + artifact-pattern: orjson-${{ env.ORJSON_VERSION }}-* |
| 141 | + gitlab-username: ${{ vars.GITLAB_DEPLOY_USER }} |
| 142 | + gitlab-token: ${{ secrets.GITLAB_DEPLOY_TOKEN }} |
| 143 | + gitlab-project-id: ${{ vars.GITLAB_PROJECT_ID }} |
| 144 | + gh-token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments