|
1 | | -on: [push] |
| 1 | +on: [push, pull_request] |
2 | 2 |
|
3 | 3 | name: Code Coverage |
4 | 4 |
|
5 | 5 | jobs: |
6 | | - |
7 | | - codecov: |
| 6 | + Codecov: |
8 | 7 | name: Code Coverage |
9 | 8 | runs-on: ubuntu-latest |
10 | 9 | env: |
11 | | - CARGO_INCREMENTAL: '0' |
12 | | - RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off' |
13 | | - RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off' |
| 10 | + RUSTFLAGS: "-Cinstrument-coverage" |
| 11 | + RUSTDOCFLAGS: "-Cinstrument-coverage" |
| 12 | + LLVM_PROFILE_FILE: "./target/coverage/%p-%m.profraw" |
14 | 13 |
|
15 | 14 | steps: |
16 | 15 | - name: Checkout |
17 | 16 | uses: actions/checkout@v4 |
18 | | - |
19 | | - - name: Install rustup |
20 | | - run: curl https://sh.rustup.rs -sSf | sh -s -- -y |
21 | | - - name: Set profile |
22 | | - run: rustup set profile minimal |
23 | | - - name: Update toolchain |
24 | | - run: rustup update |
25 | | - - name: Override the default toolchain |
26 | | - run: rustup override set nightly |
27 | | - |
28 | | - |
29 | | - - name: Test Compiler |
30 | | - run: cargo test --features compiler |
31 | | - |
32 | | - - name: Test Electrum |
33 | | - run: cargo test --features electrum |
34 | | - |
35 | | - - name: Test Esplora |
36 | | - run: cargo test --features esplora |
37 | | - |
38 | | - - name: Test Cbf |
39 | | - run: cargo test --features cbf |
40 | | - |
41 | | - - name: Test RPC |
42 | | - run: cargo test --features rpc |
43 | | - |
44 | | - - id: coverage |
45 | | - name: Generate coverage |
46 | | - uses: actions-rs/grcov@v0.1.5 |
47 | | - |
48 | | - - name: Upload coverage to Codecov |
49 | | - uses: codecov/codecov-action@v2 |
50 | 17 | with: |
51 | | - file: ${{ steps.coverage.outputs.report }} |
52 | | - directory: ./coverage/reports/ |
| 18 | + persist-credentials: false |
| 19 | + - name: Install lcov tools |
| 20 | + run: sudo apt-get install lcov -y |
| 21 | + - name: Install Rust toolchain |
| 22 | + uses: actions-rs/toolchain@v1 |
| 23 | + with: |
| 24 | + toolchain: stable |
| 25 | + override: true |
| 26 | + profile: minimal |
| 27 | + components: llvm-tools-preview |
| 28 | + - name: Rust Cache |
| 29 | + uses: Swatinem/rust-cache@v2.7.8 |
| 30 | + - name: Install grcov |
| 31 | + run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi |
| 32 | + - name: Test |
| 33 | + run: cargo test --all-features |
| 34 | + - name: Make coverage directory |
| 35 | + run: mkdir coverage |
| 36 | + - name: Run grcov |
| 37 | + run: grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --keep-only 'src/**' --ignore 'tests/**' -o ./coverage/lcov.info |
| 38 | + - name: Check lcov.info |
| 39 | + run: cat ./coverage/lcov.info |
| 40 | + - name: Coveralls |
| 41 | + uses: coverallsapp/github-action@v2 |
| 42 | + with: |
| 43 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + file: ./coverage/lcov.info |
0 commit comments