Skip to content

Commit 413d242

Browse files
committed
Update CI and use nextest
This updates the CI definitions a bit: - Invokes `rustup` directly instead of using an action - Updates the `setup-python` action to the latest version - Adds a separate `doctest` run to run doctests and emit `cargo doc` errors - Switches to `nextest` for running test, which also has builtin junit output - Always run tests with coverage
1 parent 98cb909 commit 413d242

3 files changed

Lines changed: 42 additions & 61 deletions

File tree

.config/nextest.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[profile.default.junit]
2+
path = "core-test-results.xml"

.github/workflows/ci.yml

Lines changed: 38 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- main
77
pull_request:
88

9+
env:
10+
RUSTFLAGS: -Dwarnings
11+
912
concurrency:
1013
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1114
cancel-in-progress: true
@@ -15,81 +18,55 @@ jobs:
1518
name: Lint (rustfmt + clippy)
1619
runs-on: ubuntu-latest
1720
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v4
20-
- name: Install Rust
21-
uses: dtolnay/rust-toolchain@nightly
22-
with:
23-
toolchain: nightly
24-
components: clippy, rustfmt
25-
- name: Run lint
26-
run: make lint.rust
21+
- uses: actions/checkout@v4
22+
23+
- run: rustup toolchain install nightly --profile minimal --component rustfmt --component clippy --no-self-update
24+
25+
- run: cargo fmt --all -- --check
26+
- run: cargo clippy --all-features --workspace --tests --examples -- -D clippy::all
2727

2828
lint-python:
2929
name: Lint Python (ruff, mypy)
3030
runs-on: ubuntu-latest
3131
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v4
34-
- uses: actions/setup-python@v3
35-
- name: Set up venv
36-
run: make ci.setup_venv
37-
- name: Build and run lint
38-
run: |
32+
- uses: actions/checkout@v4
33+
34+
- uses: actions/setup-python@v5
35+
- run: make ci.setup_venv
36+
37+
- run: |
3938
maturin develop
4039
make lint.python
4140
42-
test:
43-
name: Test
41+
doctest:
42+
name: Documentation (and Tests)
4443
runs-on: ubuntu-latest
45-
strategy:
46-
fail-fast: false
44+
env:
45+
RUSTDOCFLAGS: -Dwarnings
4746
steps:
48-
- name: Checkout
49-
uses: actions/checkout@v4
50-
- name: Install Rust
51-
uses: dtolnay/rust-toolchain@nightly
52-
with:
53-
toolchain: nightly
54-
- name: Run Rust tests
55-
run: |
56-
cargo test
47+
- uses: actions/checkout@v4
5748

58-
- uses: actions/setup-python@v3
59-
- name: Set up venv
60-
run: make ci.setup_venv
61-
- name: Run Python tests
62-
run: |
63-
maturin develop
64-
pytest
65-
66-
# This job runs tests, generates coverage data, and generates JUnit test
67-
# results in a single test invocation and then uploads it all to Codecov.
68-
# However, it doesn't print test results to stdout. If Codecov's failed test
69-
# reporting is solid and we never need to see the results in the CI logs, we
70-
# can delete the "normal" test step and just use this.
71-
test-for-codecov:
72-
name: Test (Upload to Codecov)
49+
- run: rustup toolchain install nightly --profile minimal --no-self-update
50+
51+
- run: cargo test --workspace --all-features --doc
52+
- run: cargo doc --workspace --all-features --document-private-items --no-deps
53+
54+
test:
55+
name: Test
7356
runs-on: ubuntu-latest
74-
strategy:
75-
fail-fast: false
7657
steps:
77-
- name: Checkout
78-
uses: actions/checkout@v4
79-
- name: Install Rust
80-
uses: dtolnay/rust-toolchain@nightly
81-
with:
82-
toolchain: nightly
83-
- name: Install `cargo llvm-cov`
84-
uses: taiki-e/install-action@cargo-llvm-cov
85-
- name: Run tests
86-
run: |
87-
cargo install cargo2junit
88-
cargo llvm-cov --lcov --output-path core.lcov -- -Z unstable-options --format json --report-time | cargo2junit > core-test-results.xml
58+
- uses: actions/checkout@v4
59+
60+
- run: rustup toolchain install nightly --profile minimal --no-self-update
61+
- uses: taiki-e/install-action@cargo-llvm-cov
62+
- uses: taiki-e/install-action@nextest
63+
64+
- run: cargo llvm-cov nextest --lcov --output-path core.lcov --workspace --all-features --all-targets
65+
- run: mv target/nextest/default/core-test-results.xml .
66+
67+
- uses: actions/setup-python@v5
68+
- run: make ci.setup_venv
8969

90-
- uses: actions/setup-python@v3
91-
- name: Set up venv
92-
run: make ci.setup_venv
9370
- name: Run Python tests
9471
run: |
9572
# Clear prior profile data

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ __pycache__/
2828

2929
.git
3030
lcov.info
31+
/*test-results.xml
32+
/*.lcov

0 commit comments

Comments
 (0)