-
-
Notifications
You must be signed in to change notification settings - Fork 123
111 lines (96 loc) · 3.71 KB
/
python-release-verify.yml
File metadata and controls
111 lines (96 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Python Release Verify
on:
pull_request:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
PACKAGE_NAME: jsonschema_rs
PYTHON_ABI_VERSION: "3.10"
PYODIDE_RUST_TOOLCHAIN: "nightly-2025-02-01"
jobs:
wheel-smoke-test:
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ["3.10", "pypy3.11"]
name: Verify wheel for ${{ matrix.python-version }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- name: Setup Python interpreter
run: |
uv python install ${{ matrix.python-version }}
interp=$(uv python find ${{ matrix.python-version }})
echo "PYTHON_INTERPRETER=$interp" >> "$GITHUB_ENV"
"$interp" --version
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build wheel
run: |
uvx --python "$PYTHON_INTERPRETER" maturin build --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter "$PYTHON_INTERPRETER"
- name: Install built wheel
run: |
uvx --python "$PYTHON_INTERPRETER" --with dist/${{ env.PACKAGE_NAME }}-*.whl python - <<'PY'
import jsonschema_rs
schema = {'type': 'object', 'properties': {'name': {'type': 'string'}}}
assert jsonschema_rs.is_valid(schema, {'name': 'test'}), 'Valid instance failed'
assert not jsonschema_rs.is_valid(schema, {'name': 123}), 'Invalid instance passed'
print('Validation tests passed!')
PY
cross-compile-check:
runs-on: ubuntu-24.04
timeout-minutes: 30
name: Verify cross-compilation for aarch64
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_ABI_VERSION }}
- name: Build wheel for aarch64
uses: messense/maturin-action@v1
with:
target: aarch64
manylinux: 2_28
args: --release -m crates/jsonschema-py/Cargo.toml --out dist --interpreter ${{ env.PYTHON_ABI_VERSION }}
pyodide-check:
runs-on: ubuntu-24.04
timeout-minutes: 30
name: Verify pyodide build (wasm32-unknown-emscripten)
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@nightly
with:
# nightly-2025-02-01 = rustc 1.86-nightly; 1.87+ is incompatible with pyodide as of now
toolchain: ${{ env.PYODIDE_RUST_TOOLCHAIN }}
components: rust-src
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- run: |
pip install "pyodide-build>=0.28.0"
echo EMSCRIPTEN_VERSION=$(pyodide config get emscripten_version) >> $GITHUB_ENV
- uses: mymindstorm/setup-emsdk@v16
with:
version: ${{ env.EMSCRIPTEN_VERSION }}
- name: Install Pyodide Rust sysroot
run: |
toolchain_root=$(rustup run "${{ env.PYODIDE_RUST_TOOLCHAIN }}" rustc --print sysroot)
rustlib="$toolchain_root/lib/rustlib"
sysroot_tag="emcc-${EMSCRIPTEN_VERSION}_${{ env.PYODIDE_RUST_TOOLCHAIN }}"
curl -fsSL --retry 5 --retry-all-errors \
-o "/tmp/${sysroot_tag}.tar.bz2" \
"https://github.com/pyodide/rust-emscripten-wasm-eh-sysroot/releases/download/${sysroot_tag}/${sysroot_tag}.tar.bz2"
tar -xjf "/tmp/${sysroot_tag}.tar.bz2" --directory="$rustlib"
- run: pyodide build
working-directory: crates/jsonschema-py
env:
RUSTUP_TOOLCHAIN: ${{ env.PYODIDE_RUST_TOOLCHAIN }}
RUSTFLAGS: "-C link-arg=-sSIDE_MODULE=2 -Z link-native-libraries=no -Z emscripten-wasm-eh"