Skip to content

Commit

Permalink
cargo update, build misc
Browse files Browse the repository at this point in the history
  • Loading branch information
ijl committed Oct 29, 2024
1 parent b97efea commit db9433d
Show file tree
Hide file tree
Showing 19 changed files with 180 additions and 105 deletions.
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
include linguist-vendored
include/pyo3/pyo3-build-config/**/* linguist-vendored
include/pyo3/pyo3-ffi/**/* linguist-vendored
include/yyjson/* linguist-vendored
91 changes: 52 additions & 39 deletions .github/workflows/artifact.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: artifact
on: push
env:
RUST_TOOLCHAIN: "nightly-2024-09-25"
RUST_TOOLCHAIN: "nightly-2024-10-25"
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
UNSAFE_PYO3_BUILD_FREE_THREADED: "1"
UNSAFE_PYO3_SKIP_VERSION_CHECK: "1"
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
overwrite: true
retention-days: 1

manylinux_2_17_amd64:
manylinux_amd64:
runs-on: ubuntu-24.04
timeout-minutes: 10
strategy:
Expand All @@ -70,17 +70,17 @@ jobs:
cflags: "-Os -fstrict-aliasing -fno-plt -flto=full -emit-llvm",
features: "avx512,no-panic,unstable-simd,yyjson",
ldflags: "-fuse-ld=lld -Wl,-plugin-opt=also-emit-llvm -Wl,--as-needed -Wl,-zrelro,-znow",
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",
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 threads=4 -D warnings",
tag: null,
target: "x86_64-unknown-linux-gnu",
},
]
python: [
{ interpreter: 'python3.13', package: 'python3.13' },
{ interpreter: 'python3.12', package: 'python3.12' },
{ interpreter: 'python3.11', package: 'python3.11' },
{ interpreter: 'python3.10', package: 'python3.10' },
{ interpreter: 'python3.9', package: 'python3.9' },
{ interpreter: 'python3.13', package: 'python3.13', compatibility: "manylinux_2_17" },
{ interpreter: 'python3.12', package: 'python3.12', compatibility: "manylinux_2_17" },
{ interpreter: 'python3.11', package: 'python3.11', compatibility: "manylinux_2_17" },
{ interpreter: 'python3.10', package: 'python3.10', compatibility: "manylinux_2_17" },
{ interpreter: 'python3.9', package: 'python3.9', compatibility: "manylinux_2_17" },
]
env:
PYTHON: "${{ matrix.python.interpreter }}"
Expand All @@ -93,6 +93,7 @@ jobs:
LDFLAGS: "${{ matrix.arch.ldflags }}"
RUSTFLAGS: "${{ matrix.arch.rustflags }}"
CARGO_TARGET_DIR: "/tmp/orjson"
COMPATIBILITY: "${{ matrix.python.compatibility }}"
steps:

- name: cpuinfo
Expand All @@ -105,6 +106,7 @@ jobs:
with:
container: registry.fedoraproject.org/fedora:42
arch: ${{ matrix.arch.tag }}
initial_delay: 5s
podman_args: "-v .:/orjson -v /tmp:/tmp --workdir /orjson"

- name: setup-shell-wrapper
Expand All @@ -127,7 +129,7 @@ jobs:
maturin build --release --strip \
--features="${FEATURES}" \
--compatibility=manylinux_2_17 \
--compatibility="${COMPATIBILITY}" \
--interpreter="${PYTHON}" \
--target="${TARGET}"
Expand All @@ -150,7 +152,7 @@ jobs:
retention-days: 1


manylinux_2_17_aarch64:
manylinux_aarch64:
runs-on: ubuntu-24.04
timeout-minutes: 45
strategy:
Expand All @@ -162,13 +164,13 @@ jobs:
cflags: "-Os -fstrict-aliasing -fno-plt -flto=full -emit-llvm",
features: "no-panic,unstable-simd,yyjson",
ldflags: "-fuse-ld=lld -Wl,-plugin-opt=also-emit-llvm -Wl,--as-needed -Wl,-zrelro,-znow",
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",
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 threads=4 -D warnings",
tag: "aarch64",
target: "aarch64-unknown-linux-gnu",
},
]
python: [
{ interpreter: 'python3.13', package: 'python3.13' },
{ interpreter: 'python3.13', package: 'python3.13', compatibility: "manylinux_2_17" },
]
env:
PYTHON: "${{ matrix.python.interpreter }}"
Expand All @@ -181,6 +183,7 @@ jobs:
LDFLAGS: "${{ matrix.arch.ldflags }}"
RUSTFLAGS: "${{ matrix.arch.rustflags }}"
CARGO_TARGET_DIR: "/tmp/orjson"
COMPATIBILITY: "${{ matrix.python.compatibility }}"
steps:

- name: cpuinfo
Expand Down Expand Up @@ -216,7 +219,7 @@ jobs:
maturin build --release --strip \
--features="${FEATURES}" \
--compatibility=manylinux_2_17 \
--compatibility="${COMPATIBILITY}" \
--interpreter="${PYTHON}" \
--target="${TARGET}"
Expand All @@ -230,12 +233,12 @@ jobs:
if: "startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v4
with:
name: orjson_manylinux_2_17_aarch64_${{ matrix.python.interpreter }}
name: orjson_manylinux_aarch64_${{ matrix.python.interpreter }}
path: dist
overwrite: true
retention-days: 1

musllinux_1_2:
musllinux:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
Expand Down Expand Up @@ -270,7 +273,7 @@ jobs:
CC: "gcc"
CFLAGS: "-Os"
LDFLAGS: "-Wl,--as-needed"
RUSTFLAGS: "-C lto=fat -Z mir-opt-level=4 -Z virtual-function-elimination -Z threads=2 -D warnings -C target-feature=-crt-static"
RUSTFLAGS: "-C lto=fat -Z mir-opt-level=4 -Z threads=2 -D warnings -C target-feature=-crt-static"
with:
rust-toolchain: "${{ env.RUST_TOOLCHAIN }}"
rustup-components: rust-src
Expand Down Expand Up @@ -305,12 +308,12 @@ jobs:
if: "startsWith(github.ref, 'refs/tags/')"
uses: actions/upload-artifact@v4
with:
name: orjson_musllinux_1_2_${{ matrix.platform.arch }}_${{ matrix.python.version }}
name: orjson_musllinux_${{ matrix.platform.arch }}_${{ matrix.python.version }}
path: dist
overwrite: true
retention-days: 1

manylinux_2_17_non_amd64:
manylinux_non_amd64:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
Expand Down Expand Up @@ -382,7 +385,7 @@ jobs:
overwrite: true
retention-days: 1

macos_universal2_aarch64:
macos_aarch64:
runs-on: macos-14
strategy:
fail-fast: false
Expand All @@ -399,7 +402,7 @@ jobs:
LDFLAGS: "-Wl,--as-needed"
CFLAGS_x86_64_apple_darwin: "-O2 -fstrict-aliasing -flto=full -march=x86-64-v2 -mtune=generic"
CFLAGS_aarch64_apple_darwin: "-O2 -fstrict-aliasing -flto=full -mcpu=apple-m1 -mtune=generic"
RUSTFLAGS: "-C lto=fat -Z mir-opt-level=4 -Z virtual-function-elimination -Z threads=3 -D warnings"
RUSTFLAGS: "-C lto=fat -Z mir-opt-level=4 -Z threads=3 -D warnings"
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"
steps:

Expand Down Expand Up @@ -455,7 +458,7 @@ jobs:
overwrite: true
retention-days: 1

macos_universal2_amd64:
macos_amd64:
runs-on: macos-13
strategy:
fail-fast: false
Expand All @@ -469,7 +472,7 @@ jobs:
LDFLAGS: "-Wl,--as-needed"
CFLAGS_x86_64_apple_darwin: "-O2 -fstrict-aliasing -flto=full -march=x86-64-v2 -mtune=generic"
CFLAGS_aarch64_apple_darwin: "-O2 -fstrict-aliasing -flto=full -mcpu=apple-m1 -mtune=generic"
RUSTFLAGS: "-C lto=fat -Z mir-opt-level=4 -Z virtual-function-elimination -Z threads=3 -D warnings"
RUSTFLAGS: "-C lto=fat -Z mir-opt-level=4 -Z threads=3 -D warnings"
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"
steps:

Expand Down Expand Up @@ -529,29 +532,39 @@ jobs:
runs-on: ubuntu-24.04
if: "startsWith(github.ref, 'refs/tags/')"
needs: [
macos_universal2_aarch64,
macos_universal2_amd64,
manylinux_2_17_aarch64,
manylinux_2_17_amd64,
manylinux_2_17_non_amd64,
musllinux_1_2,
macos_aarch64,
macos_amd64,
manylinux_aarch64,
manylinux_amd64,
manylinux_non_amd64,
musllinux,
sdist,
]
environment:
name: pypi
url: https://pypi.org/p/orjson
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: orjson_*
merge-multiple: true
name: python-package-distributions
path: dist/
pattern: orjson_*

- run: ls -1 dist/

- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install pip "maturin>=1,<2"
- run: ls -1 .
- name: deploy wheel
run: maturin upload --skip-existing --username "$MATURIN_USERNAME" *.whl
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
- name: deploy sdist
run: maturin upload --skip-existing --username "$MATURIN_USERNAME" *.tar.gz
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
packages-dir: dist
repository-url: https://github.com/ijl/orjson
skip-existing: true
user: ijl
verbose: true
8 changes: 2 additions & 6 deletions .github/workflows/debug.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
profile: [
{ rust: "1.72", features: "" },
{ rust: "1.72", features: "--features=yyjson" },
{ rust: "nightly-2024-09-25", features: "--features=yyjson,unstable-simd"},
{ rust: "nightly-2024-09-25", features: "--features=avx512,yyjson,unstable-simd"},
{ rust: "nightly-2024-10-25", features: "--features=yyjson,unstable-simd" },
{ rust: "nightly-2024-10-25", features: "--features=avx512,yyjson,unstable-simd" },
]
python: [
{ version: '3.13' },
Expand All @@ -27,12 +27,8 @@ jobs:
steps:
- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain ${{ matrix.profile.rust }} --profile minimal -y

- name: cpuinfo
run: cat /proc/cpuinfo

- uses: actions/setup-python@v5
with:
allow-prereleases: true
python-version: '${{ matrix.python.version }}'

- run: python -m pip install --user --upgrade pip "maturin>=1,<2" wheel
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
with:
python-version: "3.12"
- run: curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=stable --profile=default -y
- run: pip install -U ruff mypy types-python-dateutil types-pytz types-simplejson types-ujson
- run: pip install -U ruff==0.7.1 mypy==1.13.0

- uses: actions/checkout@v4

Expand Down
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ unwind = ["unwinding"]
yyjson = []

# Features detected by build.rs. Do not specify.
inline_int = []
intrinsics = []
optimize = []
strict_provenance = []
inline_int = []
setitem_knownhash = []

[dependencies]
associative-cache = { version = "2", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ It benefits from also having a C build environment to compile a faster
deserialization backend. See this project's `manylinux_2_28` builds for an
example using clang and LTO.

The project's own CI tests against `nightly-2024-09-25` and stable 1.72. It
The project's own CI tests against `nightly-2024-10-25` and stable 1.72. It
is prudent to pin the nightly version because that channel can introduce
breaking changes.

Expand Down
11 changes: 6 additions & 5 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ fn main() {
println!("cargo:rustc-check-cfg=cfg(Py_3_9)");
println!("cargo:rustc-check-cfg=cfg(Py_GIL_DISABLED)");

for cfg in pyo3_build_config::get().build_script_outputs() {
let python_config = pyo3_build_config::get();
for cfg in python_config.build_script_outputs() {
println!("{cfg}");
}

if python_config.version.minor != 13 {
println!("cargo:rustc-cfg=feature=\"setitem_knownhash\"");
}

if let Some(true) = version_check::supports_feature("core_intrinsics") {
println!("cargo:rustc-cfg=feature=\"intrinsics\"");
}
Expand All @@ -34,10 +39,6 @@ fn main() {
println!("cargo:rustc-cfg=feature=\"optimize\"");
}

if let Some(true) = version_check::supports_feature("strict_provenance") {
println!("cargo:rustc-cfg=feature=\"strict_provenance\"");
}

#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
if env::var("ORJSON_DISABLE_SIMD").is_err() {
// auto build unstable SIMD on nightly
Expand Down
2 changes: 1 addition & 1 deletion ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
variables:
toolchain: nightly-2024-09-25
toolchain: nightly-2024-10-25

jobs:

Expand Down
Loading

0 comments on commit db9433d

Please sign in to comment.