Repository navigation
86 lines (70 loc) · 2.82 KB
/
Copy pathpython-tests.yml
File metadata and controls
86 lines (70 loc) · 2.82 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
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@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
save-if: ${{ github.ref == 'refs/heads/master' }}
key: python-wheels-${{ inputs.os }}
- uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.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