Skip to content

Commit ccc5ca2

Browse files
authored
ci: add code coverage tracking (#123)
1 parent a92d3bd commit ccc5ca2

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

.github/workflows/rust.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ jobs:
4141
steps:
4242
- uses: actions/checkout@v4
4343
- run: sudo apt-get update && sudo apt-get install -y -qq build-essential pkg-config jq dpkg curl wget zstd cmake clang libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libdbus-1-dev libwebkit2gtk-4.1-dev libjavascriptcoregtk-4.1-dev valac libibus-1.0-dev libglib2.0-dev sqlite3 libxdo-dev protobuf-compiler libfuse2 bash fish zsh shellcheck
44-
- uses: dtolnay/rust-toolchain@stable
44+
- uses: dtolnay/rust-toolchain@nightly
4545
id: toolchain
46+
with:
47+
components: llvm-tools-preview
48+
- name: Install cargo-llvm-cov
49+
uses: taiki-e/install-action@cargo-llvm-cov
4650
- uses: actions/cache@v4
4751
with:
4852
path: |
@@ -51,8 +55,14 @@ jobs:
5155
~/.cargo/git/db/
5256
target/
5357
key: cargo-test-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}-${{ steps.toolchain.outputs.cachekey }}
54-
- run: cargo build --locked --workspace --tests
55-
- run: cargo test --locked --workspace
58+
- name: Generate code coverage
59+
run: cargo llvm-cov --locked --workspace --lcov --output-path lcov.info
60+
- name: Upload coverage to Codecov
61+
uses: codecov/codecov-action@v5
62+
with:
63+
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
64+
files: lcov.info
65+
fail_ci_if_error: true
5666

5767
cargo-fmt:
5868
name: Fmt

0 commit comments

Comments
 (0)