1- name : linux
1+ name : artifact
22on : push
3+ env :
4+ RUST_TOOLCHAIN : " nightly-2024-04-15"
5+ CARGO_UNSTABLE_SPARSE_REGISTRY : " true"
6+ UNSAFE_PYO3_SKIP_VERSION_CHECK : " 1"
37jobs :
48
59 sdist :
913 env :
1014 RUST_TOOLCHAIN : " 1.72" # MSRV
1115 steps :
12- - run : curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain $RUST_TOOLCHAIN -y
13- - run : rustup default $RUST_TOOLCHAIN
16+ - name : rustup stable
17+ run : |
18+ curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain "${RUST_TOOLCHAIN}" -y
19+ rustup default "${RUST_TOOLCHAIN}"
1420
1521 - uses : actions/checkout@v4
1622
1723 - run : python3 -m pip install --user --upgrade pip "maturin>=1,<2" wheel
1824
19- - run : maturin build
20- - run : cargo fetch
21- - run : mkdir .cargo
22- - run : cp ci/sdist.toml .cargo/config.toml
23- - run : cargo vendor include/cargo --versioned-dirs
25+ - name : Vendor dependencies
26+ run : |
27+ maturin build
28+ cargo fetch
29+ mkdir .cargo
30+ cp ci/sdist.toml .cargo/config.toml
31+ cargo vendor include/cargo --versioned-dirs
2432
2533 - run : maturin sdist --out=dist
2634
@@ -61,37 +69,40 @@ jobs:
6169 { version: '3.8', abi: 'cp38-cp38' },
6270 ]
6371 env :
64- PATH : /github/home/.local/bin:/github/home/.cargo/bin:/opt/python/${{ matrix.python.abi }}/bin:/opt/rh/gcc-toolset-12/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
6572 CC : " clang"
6673 CFLAGS : " -Os -fstrict-aliasing -flto=full"
6774 LDFLAGS : " -fuse-ld=lld -Wl,--as-needed"
68- RUSTFLAGS : " -C linker=clang -C lto=fat -C link-arg=-fuse-ld=lld -Z mir-opt-level=4 -Z virtual-function-elimination -D warnings"
69- CARGO_UNSTABLE_SPARSE_REGISTRY : " true"
70- UNSAFE_PYO3_SKIP_VERSION_CHECK : " 1"
75+ RUSTFLAGS : " -C linker=clang -C lto=fat -C link-arg=-fuse-ld=lld -Z mir-opt-level=4 -Z virtual-function-elimination -Z threads=4 -D warnings"
76+ 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"
7177 container :
72- image : quay.io/pypa/manylinux_2_28_x86_64:latest
78+ image : fedora:41
7379 options : --user 0
7480 steps :
75- - run : yum install -y clang lld
76- - run : curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2024-03-27 --profile minimal -y
77- - run : rustup component add rust-src --toolchain nightly-2024-03-27-x86_64-unknown-linux-gnu
81+
7882 - uses : actions/checkout@v4
7983
80- - name : build-std
84+ - name : Build environment
8185 run : |
86+ dnf install -y rustup clang lld python${{ matrix.python.version }}
87+
88+ rustup-init --default-toolchain "${RUST_TOOLCHAIN}-x86_64-unknown-linux-gnu" --profile minimal --component rust-src -y
89+ cargo fetch --target=x86_64-unknown-linux-gnu &
90+
91+ curl -LsSf https://astral.sh/uv/install.sh | sh
92+ uv venv --python python${{ matrix.python.version }}
93+ uv pip install --upgrade "maturin>=1,<2" -r test/requirements.txt -r integration/requirements.txt
94+
8295 mkdir .cargo
8396 cp ci/config.toml .cargo/config.toml
8497
85- - run : python3 -m pip install --user --upgrade pip " maturin>=1,<2" wheel
86- - run : |
98+ - name : maturin
99+ run : |
87100 maturin build --release --strip \
88- --out=dist \
89101 --features=no-panic,unstable-simd,yyjson \
90102 --compatibility manylinux_2_17 \
91103 --interpreter python${{ matrix.python.version }} \
92104 --target=x86_64-unknown-linux-gnu
93- - run : python3 -m pip install --user dist/orjson*.whl
94- - run : python3 -m pip install --user -r test/requirements.txt -r integration/requirements.txt
105+ uv pip install target/wheels/orjson*.whl
95106
96107 - run : pytest -s -rxX -v -n 4 test
97108 env :
@@ -106,7 +117,7 @@ jobs:
106117 uses : actions/upload-artifact@v4
107118 with :
108119 name : orjson_manylinux_2_17_amd64_${{ matrix.python.version }}
109- path : dist
120+ path : target/wheels
110121 overwrite : true
111122 retention-days : 1
112123
@@ -143,21 +154,19 @@ jobs:
143154 CC : " gcc"
144155 CFLAGS : " -Os"
145156 LDFLAGS : " -Wl,--as-needed"
146- RUSTFLAGS : " -Z mir-opt-level=4 -D warnings -C target-feature=-crt-static"
147- CARGO_UNSTABLE_SPARSE_REGISTRY : " true"
148- UNSAFE_PYO3_SKIP_VERSION_CHECK : " 1"
157+ RUSTFLAGS : " -Z mir-opt-level=4 -Z threads=4 -D warnings -C target-feature=-crt-static"
149158 with :
150- rust-toolchain : nightly-2024-03-27
159+ rust-toolchain : nightly-2024-04-15
151160 rustup-components : rust-src
152161 target : ${{ matrix.platform.target }}
153162 manylinux : musllinux_1_2
154163 args : --release --strip --out=dist --features=no-panic,unstable-simd,yyjson -i python${{ matrix.python.version }}
155164
156- - name : Set up QEMU
165+ - name : QEMU
157166 if : matrix.platform.arch != 'x86_64'
158167 uses : docker/setup-qemu-action@v3
159168 with :
160- image : tonistiigi/binfmt:qemu-v8.1.4
169+ image : tonistiigi/binfmt:qemu-v8.1.5
161170 platforms : ${{ matrix.platform.platform }}
162171
163172 - name : Test
@@ -174,7 +183,7 @@ jobs:
174183 venv/bin/pip install -U pip wheel
175184 venv/bin/pip install -r test/requirements.txt
176185 venv/bin/pip install orjson --no-index --find-links dist/ --force-reinstall
177- venv/bin/python -m pytest -s -rxX -v test
186+ venv/bin/python -m pytest -s -rxX -v -n 4 test
178187
179188 - name : Store wheels
180189 if : " startsWith(github.ref, 'refs/tags/')"
@@ -222,7 +231,6 @@ jobs:
222231 {
223232 arch : ' s390x' ,
224233 cflags : ' -Os -flto=full -fstrict-aliasing -march=z10' ,
225- # no unstable-simd as rotate_elements_left() causes exit 125 in at least QEMU
226234 features : ' no-panic,yyjson' ,
227235 rustflags : ' -Z mir-opt-level=4 -C lto=fat -D warnings -C target-cpu=z10' ,
228236 target : ' s390x-unknown-linux-gnu' ,
@@ -241,12 +249,10 @@ jobs:
241249 PYO3_CROSS_LIB_DIR : " /opt/python/${{ matrix.python.abi }}"
242250 CFLAGS : " ${{ matrix.target.cflags }}"
243251 LDFLAGS : " -Wl,--as-needed"
244- CARGO_UNSTABLE_SPARSE_REGISTRY : " true"
245252 RUSTFLAGS : " ${{ matrix.target.rustflags }}"
246- UNSAFE_PYO3_SKIP_VERSION_CHECK : " 1"
247253 with :
248254 target : ${{ matrix.target.target }}
249- rust-toolchain : nightly-2024-03-27
255+ rust-toolchain : nightly-2024-04-15
250256 rustup-components : rust-src
251257 manylinux : auto
252258 args : --release --strip --out=dist --features=${{ matrix.target.features }} -i python${{ matrix.python.version }}
@@ -281,19 +287,167 @@ jobs:
281287 overwrite : true
282288 retention-days : 1
283289
290+ macos_universal2_aarch64 :
291+ runs-on : macos-14
292+ strategy :
293+ fail-fast : false
294+ matrix :
295+ python : [
296+ { version: '3.12', macosx_target: "10.15" },
297+ { version: '3.11', macosx_target: "10.15" },
298+ { version: '3.10', macosx_target: "10.15" },
299+ ]
300+ env :
301+ CC : " clang"
302+ CFLAGS : " -Os -fstrict-aliasing -flto=full"
303+ LDFLAGS : " -Wl,--as-needed"
304+ CFLAGS_x86_64_apple_darwin : " -O2 -fstrict-aliasing -flto=full -march=x86-64-v2 -mtune=generic"
305+ CFLAGS_aarch64_apple_darwin : " -O2 -fstrict-aliasing -flto=full -mcpu=apple-m1 -mtune=generic"
306+ RUSTFLAGS : " -C lto=fat -Z mir-opt-level=4 -Z virtual-function-elimination -Z threads=3 -D warnings"
307+ PATH : " /Users/runner/work/orjson/orjson/.venv/bin:/Users/runner/.cargo/bin:/usr/local/opt/curl/bin:/usr/local/bin:/usr/local/sbin:/Users/runner/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin"
308+ steps :
309+
310+ - uses : actions/checkout@v4
311+
312+ - uses : actions/setup-python@v5
313+ with :
314+ python-version : " ${{ matrix.python.version }}"
315+
316+ - uses : dtolnay/rust-toolchain@master
317+ with :
318+ toolchain : " nightly-2024-04-15"
319+ targets : " aarch64-apple-darwin, x86_64-apple-darwin"
320+ components : " rust-src"
321+
322+ - name : Build environment
323+ run : |
324+ cargo fetch --target aarch64-apple-darwin &
325+
326+ curl -LsSf https://astral.sh/uv/install.sh | sh
327+ uv venv --python python${{ matrix.python.version }}
328+ uv pip install --upgrade "maturin>=1,<2" -r test/requirements.txt -r integration/requirements.txt
329+
330+ mkdir .cargo
331+ cp ci/config.toml .cargo/config.toml
332+
333+ - name : maturin
334+ run : |
335+ PATH=$HOME/.cargo/bin:$PATH \
336+ MACOSX_DEPLOYMENT_TARGET="${{ matrix.python.macosx_target }}" \
337+ PYO3_CROSS_LIB_DIR=$(python -c "import sysconfig;print(sysconfig.get_config_var('LIBDIR'))") \
338+ maturin build --release --strip \
339+ --features=no-panic,unstable-simd,yyjson \
340+ --interpreter python${{ matrix.python.version }} \
341+ --target=universal2-apple-darwin
342+ uv pip install target/wheels/orjson*.whl
343+
344+ - run : pytest -s -rxX -v -n 3 test
345+ env :
346+ PYTHONMALLOC : " debug"
347+
348+ - run : source .venv/bin/activate && ./integration/run thread
349+ - run : source .venv/bin/activate && ./integration/run http
350+ - run : source .venv/bin/activate && ./integration/run init
351+
352+ - name : Store wheels
353+ if : " startsWith(github.ref, 'refs/tags/')"
354+ uses : actions/upload-artifact@v4
355+ with :
356+ name : orjson_universal2_aarch64_${{ matrix.python.version }}
357+ path : target/wheels
358+ overwrite : true
359+ retention-days : 1
360+
361+ macos_universal2_amd64 :
362+ runs-on : macos-13
363+ strategy :
364+ fail-fast : false
365+ matrix :
366+ python : [
367+ { version: '3.9', macosx_target: "10.15" },
368+ { version: '3.8', macosx_target: "10.15" },
369+ ]
370+ env :
371+ CC : " clang"
372+ CFLAGS : " -Os -fstrict-aliasing -flto=full"
373+ LDFLAGS : " -Wl,--as-needed"
374+ CFLAGS_x86_64_apple_darwin : " -O2 -fstrict-aliasing -flto=full -march=x86-64-v2 -mtune=generic"
375+ CFLAGS_aarch64_apple_darwin : " -O2 -fstrict-aliasing -flto=full -mcpu=apple-m1 -mtune=generic"
376+ RUSTFLAGS : " -C lto=fat -Z mir-opt-level=4 -Z virtual-function-elimination -Z threads=3 -D warnings"
377+ PATH : " /Users/runner/work/orjson/orjson/.venv/bin:/Users/runner/.cargo/bin:/usr/local/opt/curl/bin:/usr/local/bin:/usr/local/sbin:/Users/runner/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin"
378+ steps :
379+
380+ - uses : actions/checkout@v4
381+
382+ - uses : actions/setup-python@v5
383+ with :
384+ python-version : " ${{ matrix.python.version }}"
385+
386+ - uses : dtolnay/rust-toolchain@master
387+ with :
388+ toolchain : " nightly-2024-04-15"
389+ targets : " aarch64-apple-darwin, x86_64-apple-darwin"
390+ components : " rust-src"
391+
392+ - name : Build environment
393+ run : |
394+ cargo fetch --target aarch64-apple-darwin &
395+
396+ curl -LsSf https://astral.sh/uv/install.sh | sh
397+ uv venv --python python${{ matrix.python.version }}
398+ uv pip install --upgrade "maturin>=1,<2" -r test/requirements.txt -r integration/requirements.txt
399+
400+ mkdir .cargo
401+ cp ci/config.toml .cargo/config.toml
402+
403+ - name : maturin
404+ run : |
405+ PATH=$HOME/.cargo/bin:$PATH \
406+ MACOSX_DEPLOYMENT_TARGET="${{ matrix.python.macosx_target }}" \
407+ PYO3_CROSS_LIB_DIR=$(python -c "import sysconfig;print(sysconfig.get_config_var('LIBDIR'))") \
408+ maturin build --release --strip \
409+ --features=no-panic,unstable-simd,yyjson \
410+ --interpreter python${{ matrix.python.version }} \
411+ --target=universal2-apple-darwin
412+ uv pip install target/wheels/orjson*.whl
413+
414+ - run : pytest -s -rxX -v -n 3 test
415+ env :
416+ PYTHONMALLOC : " debug"
417+
418+ - run : source .venv/bin/activate && ./integration/run thread
419+ - run : source .venv/bin/activate && ./integration/run http
420+ - run : source .venv/bin/activate && ./integration/run init
421+
422+ - name : Store wheels
423+ if : " startsWith(github.ref, 'refs/tags/')"
424+ uses : actions/upload-artifact@v4
425+ with :
426+ name : orjson_universal2_amd64_${{ matrix.python.version }}
427+ path : target/wheels
428+ overwrite : true
429+ retention-days : 1
430+
284431 pypi :
285432 name : PyPI
286433 runs-on : ubuntu-22.04
287434 if : " startsWith(github.ref, 'refs/tags/')"
288- needs : [ manylinux_2_17_amd64, manylinux_2_17_non_amd64, musllinux_1_2, sdist ]
435+ needs : [
436+ sdist,
437+ manylinux_2_17_amd64,
438+ musllinux_1_2,
439+ manylinux_2_17_non_amd64,
440+ macos_universal2_aarch64,
441+ macos_universal2_amd64,
442+ ]
289443 steps :
290444 - uses : actions/download-artifact@v4
291445 with :
292446 pattern : orjson_*
293447 merge-multiple : true
294448 - uses : actions/setup-python@v5
295449 with :
296- python-version : " 3.11 "
450+ python-version : " 3.12 "
297451 - run : pip install pip "maturin>=1,<2"
298452 - run : ls -1 .
299453 - name : deploy wheel
0 commit comments