Repository navigation
71 lines (67 loc) · 3.05 KB
/
Copy pathpython-binding.yml
File metadata and controls
71 lines (67 loc) · 3.05 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
name: Python binding
on:
workflow_call:
# Tags are excluded: release tags point at commits already tested on a branch.
push:
branches: [main, "release/**"]
pull_request:
# Superseded pull request runs are cancelled. Pushes to main and release
# branches get their own group, so every pushed commit is tested.
concurrency:
group: ${{ github.workflow }}-python-binding-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
scope:
uses: ./.github/workflows/change-scope.yml
installed-wheel:
needs: scope
if: ${{ !cancelled() && (github.event_name != 'pull_request' || needs.scope.outputs.code != 'false') }}
name: CPython ${{ matrix.python-version }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
# The abi3 wheel covers every version; Linux runs the version matrix and
# one macOS job keeps platform coverage without queueing for macOS runners.
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
include:
- os: macos-15
python-version: "3.12"
steps:
- uses: actions/checkout@v4
- id: rust-version
run: echo "version=$(./scripts/pin.sh rust)" >> "$GITHUB_OUTPUT"
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.rust-version.outputs.version }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
# Pull requests reuse caches from main without adding their own.
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
name: Test publication check without downloading models
run: |
python scripts/test-model-publish-check.py
python scripts/test-model-manifest.py
- run: python -m pip install maturin
- run: maturin build --manifest-path bindings/python/Cargo.toml --release
- run: |
python -m venv .venv
.venv/bin/python -m pip install target/wheels/*.whl
.venv/bin/python -m pip install -r bindings/python/tests/requirements-typing.txt
.venv/bin/python bindings/python/tests/test_installed.py
.venv/bin/python bindings/python/tests/test_typing.py
- if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
name: Verify typing survives a source distribution rebuild
run: |
maturin sdist --manifest-path bindings/python/Cargo.toml --out target/sdist
.venv/bin/python -m pip wheel --no-deps target/sdist/*.tar.gz --wheel-dir target/rebuilt-wheels
.venv/bin/python -m pip install --force-reinstall target/rebuilt-wheels/*.whl
.venv/bin/python bindings/python/tests/test_installed.py
.venv/bin/python bindings/python/tests/test_typing.py