Skip to content

Commit 6dc28e1

Browse files
committed
test with workflow from binrw
1 parent b6b4974 commit 6dc28e1

1 file changed

Lines changed: 38 additions & 18 deletions

File tree

.github/workflows/coverage.yml

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,51 @@ on: [push]
33

44
jobs:
55
coverage:
6+
name: Code coverage
67
runs-on: windows-latest
8+
env:
9+
RUST_BACKTRACE: 1
710
steps:
8-
- name: Checkout
11+
- name: Check out code
912
uses: actions/checkout@v4
10-
with:
11-
submodules: true
12-
1313
- name: Install Rust toolchain
14-
run: rustup toolchain install stable --profile minimal -c rustfmt,clippy
15-
14+
uses: dtolnay/rust-toolchain@master
15+
with:
16+
toolchain: nightly
17+
components: llvm-tools-preview
1618
- name: Install llvm-cov
17-
uses: taiki-e/install-action@cargo-llvm-cov
18-
19+
uses: taiki-e/install-action@v2
20+
with:
21+
tool: cargo-llvm-cov
22+
- name: Generate default features
23+
run: >
24+
cargo llvm-cov --doctests
25+
--no-report
26+
- name: Generate all features
27+
run: >
28+
cargo llvm-cov --doctests --all-features
29+
--no-report
1930
- name: Generate no features
20-
run: cargo llvm-cov --no-default-features --no-report
21-
31+
run: >
32+
cargo llvm-cov --doctests --no-default-features
33+
--no-report
2234
- name: Show coverage results
23-
run: cargo llvm-cov report
24-
35+
run: >
36+
cargo llvm-cov report --doctests
37+
--ignore-filename-regex 'binrw/(tests|src/docs)'
38+
# https://github.com/actions/runner/issues/520
39+
- name: Determine whether codecov.io secret is available
40+
id: has_codecov
41+
run: echo 'result=${{ secrets.CODECOV_TOKEN }}' >> $GITHUB_OUTPUT
2542
- name: Generate coverage file
26-
run: cargo llvm-cov report --lcov --output-path lcov.info
27-
28-
- name: Upload report to codecov.io
29-
uses: codecov/codecov-action@v5
43+
run: >
44+
cargo llvm-cov report --doctests
45+
--ignore-filename-regex 'binrw/(tests|src/docs)'
46+
--lcov --output-path lcov.info
47+
if: steps.has_codecov.outputs.result != 0
48+
- name: Upload to codecov.io
49+
uses: codecov/codecov-action@v1
3050
with:
3151
files: lcov.info
32-
token: ${{secrets.CODECOV_TOKEN}}
33-
fail_ci_if_error: false
52+
token: ${{ secrets.CODECOV_TOKEN }}
53+
if: steps.has_codecov.outputs.result != 0

0 commit comments

Comments
 (0)