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
9 env:
10 CARGO_TERM_COLOR: always
11
12 jobs:
13 resolve:
14 runs-on: ubuntu-latest
15 outputs:
16 MSRV: ${{ steps.resolve-msrv.outputs.MSRV }}
17 steps:
18 - uses: actions/checkout@v4
19 - uses: actions/setup-python@v5
20 with:
21 python-version: "3.12"
22 - name: resolve MSRV
23 id: resolve-msrv
24 run: echo MSRV=`python -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["package"]["rust-version"])'` >> $GITHUB_OUTPUT
25
26 fmt:
27 runs-on: ubuntu-latest
28 steps:
29 - uses: actions/checkout@v4
30 - uses: dtolnay/rust-toolchain@stable
31 with:
32 components: rustfmt
33 - name: Check rust formatting (rustfmt)
34 run: cargo fmt --all -- --check
35
36 clippy:
37 runs-on: ubuntu-latest
38 steps:
39 - uses: actions/checkout@v4
40 - uses: dtolnay/rust-toolchain@stable
41 with:
42 components: clippy
43 - run: cargo clippy --all
44
45 build:
46 needs: [resolve, fmt] # don't wait for clippy as fails rarely and takes longer
47 name: python${{ matrix.python-version }} ${{ matrix.os }} rust-${{ matrix.rust}}
48 runs-on: ${{ matrix.os }}
49 strategy:
50 fail-fast: false # If one platform fails, allow the rest to keep testing.
51 matrix:
52 python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"]
53 os: ["macos-latest", "ubuntu-latest", "windows-latest"]
54 rust: [stable]
55 include:
56 - python-version: "3.14"
57 os: "ubuntu-latest"
58 rust: ${{ needs.resolve.outputs.MSRV }}
59 - python-version: "3.14"
60 os: "macos-15-intel"
61 rust: "stable"
62 - python-version: "3.14"
63 os: "ubuntu-24.04-arm"
64 rust: "stable"
65 - python-version: "3.14"
66 os: "windows-11-arm"
67 rust: "stable"
68
69 steps:
70 - uses: actions/checkout@v4
71
72 - name: Set up Python ${{ matrix.python-version }}
73 uses: actions/setup-python@v5
74 with:
75 python-version: ${{ matrix.python-version }}
76
77 - name: Install Rust toolchain
78 uses: dtolnay/rust-toolchain@master
79 with:
80 toolchain: ${{ matrix.rust }}
81
82 - uses: Swatinem/rust-cache@v2
83 continue-on-error: true
84
85 - if: ${{ matrix.rust == needs.resolve.outputs.MSRV }}
86 name: Set dependencies on MSRV
87 run: cargo +stable update
88 env:
89 CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback
90
91 - name: Test
92 run: cargo test --verbose
93
94 - name: Test (abi3)
95 run: cargo test --verbose --features pyo3/abi3-py37
96
97 - name: Test (arbitrary_precision)
98 run: cargo test --verbose --features arbitrary_precision
99
100 env:
101 RUST_BACKTRACE: 1
102
103 coverage:
104 needs: [fmt]
105 runs-on: ubuntu-latest
106 steps:
107 - uses: actions/checkout@v4
108 - uses: Swatinem/rust-cache@v2
109 continue-on-error: true
110 - name: Install cargo-llvm-cov
111 uses: taiki-e/install-action@cargo-llvm-cov
112 - uses: dtolnay/rust-toolchain@stable
113 with:
114 components: llvm-tools-preview
115 - run: |
116 cargo llvm-cov clean
117 cargo llvm-cov --codecov --output-path codecov.json
118 - uses: codecov/codecov-action@v4
119 with:
120 file: codecov.json
121 token: ${{ secrets.CODECOV_TOKEN }}