Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[profile.default]
failure-output = "final"

[profile.ci]
fail-fast = false
junit.path = "junit.xml"
79 changes: 69 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ jobs:
uses: actions/checkout@v4

- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
run: rustup install --profile minimal --component clippy

- name: Cache build artifacts
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Lint Rust code
run: cargo clippy --all-targets --workspace --locked
Expand Down Expand Up @@ -74,31 +74,88 @@ jobs:
uses: actions/checkout@v4

- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
run: rustup install --profile minimal --component rustfmt

- name: Cache build artifacts
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Check formatting
run: cargo fmt --check --all

test:
name: Run tests
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: read
steps:
- name: Check out sources
uses: actions/checkout@v4

- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
run: rustup install --profile minimal --component llvm-tools

- name: Cache build artifacts
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Install nextest (if not cached)
run: cargo nextest --version || cargo install --locked cargo-nextest

- name: Install llvm-cov (if not cached)
run: cargo llvm-cov --version || cargo install --locked cargo-llvm-cov

- name: Run tests
run: >-
cargo llvm-cov nextest
--no-report
--no-fail-fast
--locked
--workspace
--all-targets
--all-features
--profile ci

- name: Generate coverage reports
if: ${{ !cancelled() }} # Generate reports even if tests failed
shell: bash
run: |
cargo llvm-cov report --html
cargo llvm-cov report --codecov --output-path target/llvm-cov/codecov.json

- name: Run default tests
run: cargo test --workspace --all-targets --no-fail-fast --locked
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: ${{ !cancelled() }} # Upload reports even if tests failed
with:
check_run: false
comment_mode: ${{ (github.event_name == 'pull_request') && 'always' || 'off' }}
files: |
target/nextest/ci/junit.xml

- name: Upload test results to Codecov
if: ${{ !cancelled() }} # Upload reports even if tests failed
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: target/nextest/ci/junit.xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: ${{ !cancelled() }} # Upload reports even if tests failed
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: target/llvm-cov/codecov.json

- name: Upload HTML coverage report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }} # Upload reports even if tests failed
with:
name: coverage-html
path: target/llvm-cov/html/

# Adding this because we don't want to run the whole build workflow on each
# push
Expand All @@ -110,10 +167,12 @@ jobs:
uses: actions/checkout@v4

- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
run: rustup install --profile minimal

- name: Cache build artifacts
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true

- name: Compile project
run: cargo build --workspace --all-targets --release --locked
Expand Down
Loading