Skip to content

Commit 163f416

Browse files
committed
ci(codecov): simplify codecov configuration
1 parent 35314d9 commit 163f416

File tree

3 files changed

+34
-101
lines changed

3 files changed

+34
-101
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: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
env:
1313
CARGO_TERM_COLOR: always
14+
CARGO_INCREMENTAL: 0
1415
steps:
1516
- name: Free Disk Space
1617
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
@@ -25,19 +26,31 @@ jobs:
2526
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 4.2.2
2627
- name: Install Rust
2728
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
2834
- name: Install cargo-llvm-cov
2935
uses: taiki-e/install-action@2c41309d51ede152b6f2ee6bf3b71e6dc9a8b7df # 2.49.27
3036
with:
3137
tool: cargo-llvm-cov@0.6.13,nextest@0.9.96
3238
- name: Generate code coverage (including doc tests)
3339
run: |
34-
cargo llvm-cov --all-features --workspace --no-report nextest
40+
cargo llvm-cov --all-features --workspace --no-report nextest --exclude bin_tests
3541
cargo llvm-cov --all-features --workspace --no-report --doc
3642
cargo llvm-cov report --doctests --lcov --output-path lcov.info
37-
cargo clean
43+
- name: Generate Codecov components configuration
44+
run: |
45+
cat .codecov_header.yml >| .codecov.yml
46+
find . -name Cargo.toml | cut -c 3- | grep -v "^Cargo.toml\$" | xargs -n 1 dirname | grep -v / | grep -v "^bin_tests$"| sort | \
47+
while read -r name; do echo -e " - component-id: ${name}\n name: ${name}\n paths:\n - ${name}/**" >> .codecov.yml ; done
48+
echo "----- .codecov.yml -----"
49+
cat .codecov.yml
3850
- name: Upload coverage to Codecov
39-
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # 4.6.0
51+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # 5.5.1
52+
env:
53+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
4054
with:
41-
token: ${{ secrets.CODECOV_TOKEN }}
4255
files: lcov.info
4356
fail_ci_if_error: true

0 commit comments

Comments
 (0)