Skip to content

Commit a99e306

Browse files
committed
ci(codecov): simplify codecov configuration
1 parent 9acedd0 commit a99e306

File tree

3 files changed

+32
-100
lines changed

3 files changed

+32
-100
lines changed

.codecov.yml

Lines changed: 0 additions & 97 deletions
This file was deleted.

.codecov_header.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
codecov:
2+
require_ci_to_pass: false
3+
4+
comment:
5+
layout: "condensed_header, diff, flags, components, condensed_footer"
6+
hide_project_coverage: false
7+
8+
coverage:
9+
precision: 2
10+
round: down
11+
range: "70...95"
12+
13+
ignore:
14+
- "bin_tests/**"
15+
16+
components:
17+
individual_components:

.github/workflows/coverage.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ jobs:
2626
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
2727
- name: Install Rust
2828
run: rustup install nightly-2024-12-16 && rustup default nightly-2024-12-16
29+
- name: Cache
30+
uses: Swatinem/rust-cache@f13886b937689c021905a6b90929199931d60db1 # 2.8.1
31+
with:
32+
cache-targets: true # cache build artifacts
33+
cache-bin: true # cache the ~/.cargo/bin directory
2934
- name: Install cargo-llvm-cov
3035
uses: taiki-e/install-action@2c41309d51ede152b6f2ee6bf3b71e6dc9a8b7df # 2.49.27
3136
with:
@@ -37,13 +42,20 @@ jobs:
3742
cache-bin: true # cache the ~/.cargo/bin directory
3843
- name: Generate code coverage (including doc tests)
3944
run: |
40-
cargo llvm-cov --all-features --workspace --no-report nextest
45+
cargo llvm-cov --all-features --workspace --no-report nextest --exclude bin_tests
4146
cargo llvm-cov --all-features --workspace --no-report --doc
4247
cargo llvm-cov report --doctests --lcov --output-path lcov.info
43-
cargo clean
48+
- name: Generate Codecov components configuration
49+
run: |
50+
cat .codecov_header.yml >| .codecov.yml
51+
find . -name Cargo.toml | cut -c 3- | grep -v "^Cargo.toml\$" | xargs -n 1 dirname | grep -v / | grep -v "^bin_tests$"| sort | \
52+
while read -r name; do echo -e " - component-id: ${name}\n name: ${name}\n paths:\n - ${name}/**" >> .codecov.yml ; done
53+
echo "----- .codecov.yml -----"
54+
cat .codecov.yml
4455
- name: Upload coverage to Codecov
4556
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # 5.5.1
57+
env:
58+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4659
with:
47-
token: ${{ secrets.CODECOV_TOKEN }}
4860
files: lcov.info
4961
fail_ci_if_error: true

0 commit comments

Comments
 (0)