Skip to content

Commit 411c959

Browse files
committed
feat: simplify test converage generation
1 parent bde7c86 commit 411c959

File tree

1 file changed

+12
-44
lines changed

1 file changed

+12
-44
lines changed

.github/workflows/linux.yml

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,15 @@ jobs:
2626

2727
steps:
2828
- name: Install Dependencies
29-
run: sudo apt-get update; sudo apt-get install libarchive-dev protobuf-compiler socat; rustup component add llvm-tools-preview
29+
run: sudo apt-get update -y; sudo apt-get install -y libarchive-dev libclang-dev protobuf-compiler socat
30+
3031
- name: Checkout sources
31-
uses: actions/checkout@v2
32+
uses: actions/checkout@v4
33+
3234
- name: Install ${{ matrix.version }}
33-
uses: actions-rs/toolchain@v1
35+
uses: dtolnay/rust-toolchain@v1
3436
with:
3537
toolchain: ${{ matrix.version }}-x86_64-unknown-linux-gnu
36-
profile: minimal
37-
override: true
38-
- name: Install grcov tool
39-
if: matrix.name == 'nightly'
40-
uses: actions-rs/install@v0.1
41-
with:
42-
crate: grcov
43-
use-tool-cache: true
44-
45-
- name: Install cargo bloat tool
46-
if: matrix.name == 'MSRV' && 0
47-
uses: actions-rs/install@v0.1
48-
with:
49-
crate: cargo-bloat
50-
use-tool-cache: true
5138

5239
- name: Install cargo tree tool
5340
if: matrix.name == 'MSRV'
@@ -104,41 +91,22 @@ jobs:
10491
exit 4
10592
fi
10693
107-
- name: Run cargo bloat
108-
if: matrix.name == 'MSRV' && 0
109-
uses: orf/cargo-bloat-action@v1
110-
with:
111-
token: ${{ secrets.GITHUB_TOKEN }}
112-
bloat_args: --release --package updatehub
113-
114-
- name: Run cargo test with coverage
94+
- name: Install cargo-llvm-cov
11595
if: matrix.name == 'nightly'
116-
uses: actions-rs/cargo@v1
117-
with:
118-
command: test
119-
args: --locked --all --all-features --no-fail-fast -- --nocapture
120-
env:
121-
CARGO_INCREMENTAL: '0'
122-
RUSTFLAGS: '-Cinstrument-coverage'
123-
LLVM_PROFILE_FILE: 'target/coverage/%p-%m.profraw'
96+
uses: taiki-e/install-action@cargo-llvm-cov
12497

125-
- name: Generate coverage report
98+
- name: Generate code coverage
12699
if: matrix.name == 'nightly'
127-
run: |
128-
grcov target/coverage/ --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --llvm-path "$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/bin" --ignore "/*" --ignore "tests/*" -o target/coverage/lcov.info
100+
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
129101

130-
- name: Coveralls upload
102+
- name: Upload coverage to Coveralls
131103
if: matrix.name == 'nightly'
132104
uses: coverallsapp/github-action@v2
133105
with:
134106
github-token: ${{ secrets.GITHUB_TOKEN }}
135-
path-to-lcov: target/coverage/lcov.info
136-
- name: Clear the coverage files from cache
137-
if: matrix.name == 'nightly'
138-
run: |
139-
find target/coverage/ -name "*.profraw" -exec rm {} +
107+
path-to-lcov: lcov.info
140108

141109
- name: Clear the cargo caches
142110
run: |
143-
cargo +stable install cargo-cache --no-default-features --features ci-autoclean
111+
cargo install cargo-cache --no-default-features --features ci-autoclean
144112
cargo-cache

0 commit comments

Comments
 (0)