Repository navigation
93 lines (76 loc) · 3.16 KB
/
Copy pathpython-tests.yml
File metadata and controls
93 lines (76 loc) · 3.16 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
name: Python tests
# Called once per OS, so each OS's tests wait only for that OS's wheels.
on:
workflow_call:
inputs:
os:
required: true
type: string
python-versions:
description: JSON array of CPython versions to test.
required: true
type: string
# Fat LTO with a single codegen unit is for published wheels; tests do not need it.
env:
CARGO_PROFILE_RELEASE_LTO: "false"
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "16"
jobs:
# Both extensions are abi3, so one build serves every CPython version under test.
build:
name: Build Python wheels on ${{ inputs.os }}
runs-on: ${{ inputs.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
with:
save-if: ${{ github.ref == 'refs/heads/master' }}
key: python-wheels-${{ inputs.os }}
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: '3.13'
- run: uvx --from "maturin>=1.0,<2.0" maturin build --release -m crates/jsonschema-py/Cargo.toml --out dist
- run: uvx --from "maturin>=1.0,<2.0" maturin build -m crates/jsonschema-testsuite-pyo3/Cargo.toml --features abi3 --out dist
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: python-wheels-${{ inputs.os }}
path: dist
retention-days: 1
test:
needs: build
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJSON(inputs.python-versions) }}
name: Test Python ${{ matrix.python-version }} on ${{ inputs.os }}
runs-on: ${{ inputs.os }}
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
submodules: true
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
id: python
with:
python-version: ${{ matrix.python-version }}
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: python-wheels-${{ inputs.os }}
path: crates/jsonschema-py/dist
- shell: bash
run: |
uv venv --python '${{ steps.python.outputs.python-path }}'
uv pip install "$(ls dist/jsonschema_rs-*.whl)[tests]" dist/jsonschema_testsuite_pyo3-*.whl
uv run --no-project pytest tests-py
working-directory: crates/jsonschema-py
# Compares the stubs with the installed wheel; one interpreter is enough.
- if: inputs.os == 'ubuntu-24.04' && matrix.python-version == '3.13'
run: |
uv pip install mypy
uv run --no-project python -m mypy.stubtest jsonschema_rs --allowlist stubtest-allowlist.txt
working-directory: crates/jsonschema-py