Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Tarpaulin by cargo-llvm-cov for coverage #935

Merged
merged 3 commits into from
Jan 30, 2025
Merged
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
34 changes: 23 additions & 11 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
# Branch coverage requires Rust nightly: https://github.com/taiki-e/cargo-llvm-cov/issues/8
- name: Setup Rust Nightly
shell: bash
run: >
Expand All @@ -30,8 +31,8 @@ jobs:
echo RUST_VERSION=$(rustc --version | awk -F '[( ]' '{print $4}') >> $GITHUB_ENV
- name: Install Binstall
uses: cargo-bins/cargo-binstall@main
- name: Install Tarpaulin
run: cargo binstall cargo-tarpaulin
- name: Install cargo-llvm-cov
run: cargo binstall cargo-llvm-cov
- name: Install Nextest
run: cargo binstall cargo-nextest
- name: Cargo cache
Expand All @@ -46,20 +47,25 @@ jobs:
./backend/target/
key: ${{ runner.os }}-cargo-${{ env.RUST_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-${{ env.RUST_VERSION }}-
- name: Run tests
run: cargo nextest run --profile ci
- name: Run tests with coverage
run: cargo llvm-cov --branch nextest --profile ci
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./target/nextest/ci/junit.xml
- name: Generate code coverage
run: cargo --verbose --locked tarpaulin --timeout 120 --out xml
files: backend/target/nextest/ci/junit.xml
disable_search: true
fail_ci_if_error: true
- name: Create code coverage report
run: cargo llvm-cov report --cobertura --output-path ./target/llvm-cov-target/codecov.json
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: backend/target/llvm-cov-target/codecov.json
disable_search: true
fail_ci_if_error: true

frontend:
name: Frontend
Expand All @@ -84,12 +90,18 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Run tests with coverage
run: npx vitest run --coverage --reporter=junit --outputFile=test-report.junit.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: frontend/test-report.junit.xml
disable_search: true
fail_ci_if_error: true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: frontend/coverage/coverage-final.json
disable_search: true
fail_ci_if_error: true