Skip to content

Commit 516e752

Browse files
committed
workflows: build-orjson: add workflow
Ref: #42 Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
1 parent 9744d32 commit 516e752

1 file changed

Lines changed: 100 additions & 0 deletions

File tree

.github/workflows/build-orjson.yml

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

0 commit comments

Comments
 (0)