-
Notifications
You must be signed in to change notification settings - Fork 3
114 lines (93 loc) · 3.59 KB
/
ci.yml
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: CI
on:
push:
branches:
- main
pull_request:
env:
RUSTFLAGS: -Dwarnings
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install stable --profile minimal --component rustfmt --component clippy --no-self-update
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v5
- run: cargo fmt --all -- --check
- run: cargo clippy --all-features --workspace --tests --examples -- -D clippy::all
doctest:
name: Documentation (and Tests)
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install stable --profile minimal --no-self-update
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-python@v5
- run: cargo test --workspace --all-features --doc
- run: cargo doc --workspace --all-features --document-private-items --no-deps
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install stable --profile minimal --component llvm-tools-preview --no-self-update
- uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: taiki-e/install-action@nextest
- uses: actions/setup-python@v5
- uses: astral-sh/setup-uv@v3
- run: uv sync --all-extras --dev
- run: cargo llvm-cov nextest --lcov --output-path core.lcov --workspace --all-features --all-targets
- run: mv target/nextest/default/core-test-results.xml .
- name: Run Python tests
run: |
source .venv/bin/activate
# Clear prior profile data
cargo llvm-cov clean --workspace
# Set env vars so maturin will build our Rust code with coverage instrumentation
source <(cargo llvm-cov show-env --export-prefix)
maturin develop --uv
# Run Python tests. Any Rust code exercised by these tests will emit coverage data
pytest --cov --junitxml=python-test-results.xml
# Turn the Rust coverage data into an lcov file
cargo llvm-cov --no-run --lcov --output-path bindings.lcov
- name: Upload coverage data to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5
with:
files: ./core.lcov,./bindings.lcov,./.coverage
token: ${{ secrets.CODECOV_ORG_TOKEN }}
url: ${{ secrets.CODECOV_URL }}
disable_search: true
verbose: true
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
files: ./core-test-results.xml,./python-test-results.xml
token: ${{ secrets.CODECOV_ORG_TOKEN }}
url: ${{ secrets.CODECOV_URL }}
disable_search: true
verbose: true
- name: Upload coverage data to Codecov (Staging)
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v5
with:
files: ./core.lcov,./bindings.lcov,./.coverage
token: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
url: ${{ secrets.CODECOV_STAGING_API_URL }}
disable_search: true
verbose: true
- name: Upload test results to Codecov (Staging)
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
files: ./core-test-results.xml,./python-test-results.xml
token: ${{ secrets.CODECOV_ORG_TOKEN_STAGING }}
url: ${{ secrets.CODECOV_STAGING_API_URL }}
disable_search: true
verbose: true