10000 setup-qemu-container, restrict inline_int, cargo update · ijl/orjson@e1f64bf · GitHub
[go: up one dir, main page]

Skip to content

Commit e1f64bf

Browse files
committed
setup-qemu-container, restrict inline_int, cargo update
1 parent e331c52 commit e1f64bf

File tree

4 files changed

+156
-33
lines changed

4 files changed

+156
-33
lines changed

.github/workflows/artifact.yaml

Lines changed: 139 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040

4141
- run: python3 -m pip install --user -r test/requirements.txt -r integration/requirements.txt mypy
4242

43-
- run: pytest -s -rxX -v -n 2 test
43+
- run: pytest -s -rxX -v -n 4 test
4444
env:
4545
PYTHONMALLOC: "debug"
4646

@@ -60,9 +60,21 @@ jobs:
6060

6161
manylinux_2_17_amd64:
6262
runs-on: ubuntu-24.04
63+
timeout-minutes: 10
6364
strategy:
6465
fail-fast: false
6566
matrix:
67+
arch: [
68+
{
69+
cc: "clang",
70+
cflags: "-Os -fstrict-aliasing -fno-plt -flto=full -emit-llvm",
71+
features: "avx512,no-panic,unstable-simd,yyjson",
72+
ldflags: "-fuse-ld=lld -Wl,-plugin-opt=also-emit-llvm -Wl,--as-needed -Wl,-zrelro,-znow",
73+
rustflags: "-C linker=clang -C link-arg=-fuse-ld=lld -C linker-plugin-lto -C lto=fat -C link-arg=-Wl,-zrelro,-znow -Z mir-opt-level=4 -Z virtual-function-elimination -Z threads=4 -D warnings",
74+
tag: null,
75+
target: "x86_64-unknown-linux-gnu",
76+
},
77+
]
6678
python: [
6779
{ interpreter: 'python3.13', package: 'python3.13' },
6880
{ interpreter: 'python3.12', package: 'python3.12' },
@@ -74,48 +86,153 @@ jobs:
7486
env:
7587
PYTHON: "${{ matrix.python.interpreter }}"
7688
PYTHON_PACKAGE: "${{ matrix.python.package }}"
77-
TARGET: "x86_64-unknown-linux-gnu"
78-
CC: "clang"
89+
TARGET: "${{ matrix.arch.target }}"
90+
CC: "${{ matrix.arch.cc }}"
7991
VENV: ".venv"
80-
CFLAGS: "-Os -fstrict-aliasing -fno-plt -flto=full -emit-llvm"
81-
LDFLAGS: "-fuse-ld=lld -Wl,-plugin-opt=also-emit-llvm -Wl,--as-needed -Wl,-zrelro,-znow"
82-
RUSTFLAGS: "-C linker=clang -C link-arg=-fuse-ld=lld -C linker-plugin-lto -C lto=fat -C link-arg=-Wl,-zrelro,-znow -Z mir-opt-level=4 -Z virtual-function-elimination -Z threads=2 -D warnings"
83-
PATH: "/__w/orjson/orjson/.venv/bin:/github/home/.cargo/bin:/root/.local/bin:/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
84-
container:
85-
image: fedora:42
92+
FEATURES: "${{ matrix.arch.features }}"
93+
CFLAGS: "${{ matrix.arch.cflags }}"
94+
LDFLAGS: "${{ matrix.arch.ldflags }}"
95+
RUSTFLAGS: "${{ matrix.arch.rustflags }}"
96+
CARGO_TARGET_DIR: "/tmp/orjson"
8697
steps:
8798

8899
- name: cpuinfo
89100
run: cat /proc/cpuinfo
90101

91-
- name: Build environment pre-clone
92-
run: dnf install -y git
93-
94102
- uses: actions/checkout@v4
95103

96-
- name: Build environment post-clone
104+
- name: setup-qemu-container
105+
uses: sandervocke/setup-qemu-container@v1
106+
with:
107+
container: registry.fedoraproject.org/fedora:42
108+
arch: ${{ matrix.arch.tag }}
109+
podman_args: "-v .:/orjson -v /tmp:/tmp --workdir /orjson"
110+
111+
- name: setup-shell-wrapper
112+
uses: sandervocke/setup-shell-wrapper@v1
113+
114+
- name: Build and test
115+
shell: wrap-shell {0}
116+
env:
117+
WRAP_SHELL: run-in-container.sh
97118
run: |
119+
set -eou pipefail
120+
121+
mkdir dist
122+
123+
export PATH="/root/.cargo/bin:/home/runner/work/orjson/orjson/.venv:/home/runner/.cargo/bin:$PATH"
124+
98125
./script/install-fedora
99126
127+
source "${VENV}/bin/activate"
128+
100129
maturin build --release --strip \
101-
--features=avx512,no-panic,unstable-simd,yyjson \
130+
--features="${FEATURES}" \
102131
--compatibility=manylinux_2_17 \
103132
--interpreter="${PYTHON}" \
104133
--target="${TARGET}"
105134
106-
uv pip install target/wheels/orjson*.whl
135+
uv pip install ${CARGO_TARGET_DIR}/wheels/orjson*.whl
107136
108-
pytest -s -rxX -v -n 2 test
137+
pytest -s -rxX -v -n 4 test
109138
./integration/run thread
110139
./integration/run http
111140
./integration/run init
112141
142+
cp ${CARGO_TARGET_DIR}/wheels/orjson*.whl dist
143+
113144
- name: Store wheels
114145
if: "startsWith(github.ref, 'refs/tags/')"
115146
uses: actions/upload-artifact@v4
116147
with:
117148
name: orjson_manylinux_2_17_amd64_${{ matrix.python.interpreter }}
118-
path: target/wheels
149+
path: dist
150+
overwrite: true
151+
retention-days: 1
152+
153+
154+
manylinux_2_17_aarch64:
155+
runs-on: ubuntu-24.04
156+
timeout-minutes: 45
157+
strategy:
158+
fail-fast: false
159+
matrix:
160+
arch: [
161+
{
162+
cc: "clang",
163+
cflags: "-Os -fstrict-aliasing -fno-plt -flto=full -emit-llvm",
164+
features: "no-panic,unstable-simd,yyjson",
165+
ldflags: "-fuse-ld=lld -Wl,-plugin-opt=also-emit-llvm -Wl,--as-needed -Wl,-zrelro,-znow",
166+
rustflags: "-C linker=clang -C link-arg=-fuse-ld=lld -C linker-plugin-lto -C lto=fat -C link-arg=-Wl,-zrelro,-znow -Z mir-opt-level=4 -Z virtual-function-elimination -Z threads=4 -D warnings",
167+
tag: "aarch64",
168+
target: "aarch64-unknown-linux-gnu",
169+
},
170+
]
171+
python: [
172+
{ interpreter: 'python3.13', package: 'python3.13' },
173+
]
174+
env:
175+
PYTHON: "${{ matrix.python.interpreter }}"
176+
PYTHON_PACKAGE: "${{ matrix.python.package }}"
177+
TARGET: "${{ matrix.arch.target }}"
178+
CC: "${{ matrix.arch.cc }}"
179+
VENV: ".venv"
180+
FEATURES: "${{ matrix.arch.features }}"
181+
CFLAGS: "${{ matrix.arch.cflags }}"
182+
LDFLAGS: "${{ matrix.arch.ldflags }}"
183+
RUSTFLAGS: "${{ matrix.arch.rustflags }}"
184+
CARGO_TARGET_DIR: "/tmp/orjson"
185+
steps:
186+
187+
- name: cpuinfo
188+
run: cat /proc/cpuinfo
189+
190+
- uses: actions/checkout@v4
191+
192+
- name: setup-qemu-container
193+
uses: sandervocke/setup-qemu-container@v1
194+
with:
195+
container: registry.fedoraproject.org/fedora:42
196+
arch: ${{ matrix.arch.tag }}
197+
podman_args: "-v .:/orjson -v /tmp:/tmp --workdir /orjson"
198+
199+
- name: setup-shell-wrapper
200+
uses: sandervocke/setup-shell-wrapper@v1
201+
202+
- name: Build and test
203+
shell: wrap-shell {0}
204+
env:
205+
WRAP_SHELL: run-in-container.sh
206+
run: |
207+
set -eou pipefail
208+
209+
mkdir dist
210+
211+
export PATH="/root/.cargo/bin:/home/runner/work/orjson/orjson/.venv:/home/runner/.cargo/bin:$PATH"
212+
213+
./script/install-fedora
214+
215+
source "${HOME}/.cargo/env"
216+
source "${VENV}/bin/activate"
217+
218+
maturin build --release --strip \
219+
--features="${FEATURES}" \
220+
--compatibility=manylinux_2_17 \
221+
--interpreter="${PYTHON}" \
222+
--target="${TARGET}"
223+
224+
uv pip install ${CARGO_TARGET_DIR}/wheels/orjson*.whl
225+
226+
pytest -s -rxX -v -n 2 test
227+
228+
cp ${CARGO_TARGET_DIR}/wheels/orjson*.whl dist
229+
230+
- name: Store wheels
231+
if: "startsWith(github.ref, 'refs/tags/')"
232+
uses: actions/upload-artifact@v4
233+
with:
234+
name: orjson_manylinux_2_17_aarch64_${{ matrix.python.interpreter }}
235+
path: dist
119236
overwrite: true
120237
retention-days: 1
121238

@@ -416,12 +533,13 @@ jobs:
416533
runs-on: ubuntu-24.04
417534
if: "startsWith(github.ref, 'refs/tags/')"
418535
needs: [
419-
sdist,
420-
manylinux_2_17_amd64,
421-
musllinux_1_2,
422-
manylinux_2_17_non_amd64,
423536
macos_universal2_aarch64,
424537
macos_universal2_amd64,
538+
manylinux_2_17_aarch64,
539+
manylinux_2_17_amd64,
540+
manylinux_2_17_non_amd64,
541+
musllinux_1_2,
542+
sdist,
425543
]
426544
steps:
427545
- uses: actions/download-artifact@v4

Cargo.lock

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ fn main() {
5454
}
5555
}
5656

57-
#[cfg(target_pointer_width = "64")]
57+
#[cfg(all(
58+
target_pointer_width = "64",
59+
any(target_arch = "x86_64", target_arch = "aarch64")
60+
))]
5861
println!("cargo:rustc-cfg=feature=\"inline_int\"");
5962

6063
if env::var("ORJSON_DISABLE_YYJSON").is_ok() {

script/install-fedora

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff lin A42A e change
@@ -1,4 +1,6 @@
1-
#!/bin/sh -e
1+
#!/usr/bin/env bash
2+
3+
set -eou pipefail
24

35
# export PYTHON=python3.11
46
# export PYTHON_PACKAGE=python3.11
@@ -10,9 +12,9 @@
1012
export VENV="${VENV:-.venv}"
1113
export CARGO_TARGET_DIR="${CARGO_TARGET_DIR:-target}"
1214

13-
sudo rm /etc/yum.repos.d/fedora-cisco-openh264.repo || true
15+
rm /etc/yum.repos.d/fedora-cisco-openh264.repo || true
1416

15-
dnf install -y rustup clang lld "${PYTHON_PACKAGE}"
17+
dnf install --setopt=install_weak_deps=false -y rustup clang lld "${PYTHON_PACKAGE}"
1618

1719
rustup-init --default-toolchain "${RUST_TOOLCHAIN}-${TARGET}" --profile minimal --component rust-src -y
1820
source "${HOME}/.cargo/env"

0 commit comments

Comments
 (0)
0