Debian Codegraph @

.github/workflows/ci.yml

raw symbols SCIP
1 name: CI
2
3 on:
4 push:
5 branches:
6 - main
7 pull_request:
8 branches:
9 - main
10
11 env:
12 CARGO_TERM_COLOR: always
13
14 jobs:
15 fmt:
16 runs-on: ubuntu-latest
17 steps:
18 - uses: actions/checkout@v4
19 - uses: actions/setup-python@v5
20 with:
21 python-version: "3.13"
22 - run: pip install black==24.10.0
23 - uses: dtolnay/rust-toolchain@stable
24 with:
25 toolchain: stable
26 components: rustfmt
27 - name: Check python formatting (black)
28 run: black --check .
29 - name: Check rust formatting (rustfmt)
30 run: cargo fmt --all -- --check
31
32 resolve:
33 runs-on: ubuntu-latest
34 outputs:
35 MSRV: ${{ steps.resolve-msrv.outputs.MSRV }}
36 verbose: ${{ runner.debug == '1' }}
37 steps:
38 - uses: actions/[email protected]
39 - uses: actions/setup-python@v6
40 with:
41 python-version: "3.x"
42 - name: resolve MSRV
43 id: resolve-msrv
44 run: echo MSRV=`python -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["workspace"]["package"]["rust-version"])'` >> $GITHUB_OUTPUT
45
46 clippy:
47 runs-on: ubuntu-latest
48 steps:
49 - uses: actions/checkout@v4
50 - uses: dtolnay/rust-toolchain@stable
51 with:
52 toolchain: stable
53 components: clippy
54 - run: make clippy
55
56 build:
57 needs: [fmt, resolve] # don't wait for clippy as fails rarely and takes longer
58 name: python${{ matrix.python-version }}-${{ matrix.platform.python-architecture }} ${{ matrix.platform.os }} ${{ matrix.msrv }}
59 runs-on: ${{ matrix.platform.os }}
60 strategy:
61 fail-fast: false # If one platform fails, allow the rest to keep testing.
62 matrix:
63 rust: [stable]
64 python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13t", "3.14-dev", "3.14t-dev", "pypy-3.11"]
65 platform: [{os: "macos-latest", python-architecture: "arm64", rust-target: "aarch64-apple-darwin"}, {os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu"}, {os: "windows-latest", python-architecture: "x64", rust-target: "x86_64-pc-windows-msvc"}]
66 include:
67 # Test minimal supported Rust version
68 - rust: ${{ needs.resolve.outputs.MSRV }}
69 python-version: "3.13"
70 platform: {os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu"}
71 msrv: "MSRV"
72
73 # Test the `nightly` feature
74 - rust: nightly
75 python-version: "3.13"
76 platform: {os: "ubuntu-latest", python-architecture: "x64", rust-target: "x86_64-unknown-linux-gnu"}
77 msrv: "nightly"
78 extra_features: "nightly"
79
80 # Test 32-bit windows just on latest Python
81 - rust: stable
82 python-version: "3.13"
83 platform: {os: "windows-latest", python-architecture: "x86", rust-target: "i686-pc-windows-msvc"}
84
85 steps:
86 - uses: actions/checkout@v4
87
88 - name: Set up Python ${{ matrix.python-version }}
89 uses: actions/setup-python@v5
90 with:
91 python-version: ${{ matrix.python-version }}
92 architecture: ${{ matrix.platform.python-architecture }}
93
94 - name: Install Rust toolchain
95 uses: dtolnay/rust-toolchain@stable
96 with:
97 toolchain: ${{ matrix.rust }}
98 target: ${{ matrix.platform.rust-target }}
99
100 - if: ${{ matrix.msrv == 'MSRV' }}
101 name: Lock package versions for MSRV
102 run: cargo +stable update
103 env:
104 CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback
105
106 - name: Build (no features)
107 run: cargo build --no-default-features --verbose --target ${{ matrix.platform.rust-target }}
108
109 - name: Build
110 run: cargo build --features=${{env.features}} --verbose --target ${{ matrix.platform.rust-target }}
111
112 # uvloop doesn't compile under
113 # Windows, https://github.com/MagicStack/uvloop/issues/536,
114 # nor PyPy, https://github.com/MagicStack/uvloop/issues/537
115 # nor for free-threaded Python, see https://github.com/MagicStack/uvloop/issues/642
116 # nor on 3.14, see https://github.com/MagicStack/uvloop/issues/637
117 - if: ${{ matrix.platform.os != 'windows-latest' && !startsWith(matrix.python-version, 'pypy') && !endsWith(matrix.python-version, 't') && !startsWith(matrix.python-version, '3.14') }}
118 name: Install uvloop
119 run: |
120 python -m pip install -U uvloop
121
122 - if: ${{ !startsWith(matrix.python-version, 'pypy') }}
123 name: Test
124 run: cargo test --all-features --target ${{ matrix.platform.rust-target }}
125
126 env:
127 RUST_BACKTRACE: 1
128 RUSTFLAGS: "-D warnings"
129
130 coverage:
131 needs: [fmt]
132 runs-on: ubuntu-latest
133 steps:
134 - uses: actions/checkout@v4
135 - uses: dtolnay/rust-toolchain@stable
136 - uses: taiki-e/install-action@cargo-llvm-cov
137
138 - name: Install pyo3-asyncio test dependencies
139 run: python -m pip install -U uvloop
140
141 - run: cargo llvm-cov --all-features --codecov --output-path coverage.json
142 - uses: codecov/codecov-action@v5
143 with:
144 files: coverage.json