Skip to content

Commit 6904117

Browse files
committed
Change configs for source-base code coverage
Also add cacheing to code coverage workflow
1 parent 7001b14 commit 6904117

File tree

2 files changed

+31
-26
lines changed

2 files changed

+31
-26
lines changed

.github/workflows/code_coverage.yml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,53 @@ on: [push]
33
name: Code Coverage
44

55
jobs:
6-
76
Codecov:
87
name: Code Coverage
98
runs-on: ubuntu-latest
109
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: "report-%p-%m.profraw"
1413

1514
steps:
1615
- name: Checkout
1716
uses: actions/checkout@v2
17+
- name: Install lcov tools
18+
run: sudo apt-get install lcov -y
1819
- name: Install rustup
1920
run: curl https://sh.rustup.rs -sSf | sh -s -- -y
2021
- name: Set default toolchain
2122
run: rustup default nightly
2223
- name: Set profile
2324
run: rustup set profile minimal
25+
- name: Add llvm tools
26+
run: rustup component add llvm-tools-preview
2427
- name: Update toolchain
2528
run: rustup update
29+
- name: Cache cargo
30+
uses: actions/cache@v3
31+
with:
32+
path: |
33+
~/.cargo/bin/
34+
~/.cargo/registry/index/
35+
~/.cargo/registry/cache/
36+
~/.cargo/git/db/
37+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
38+
- name: Install grcov
39+
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi
2640
- name: Test
27-
run: cargo test --features all-keys,compiler,esplora,ureq,compact_filters --no-default-features
28-
29-
- id: coverage
30-
name: Generate coverage
31-
uses: actions-rs/[email protected]
41+
run: cargo test --features default,minimal,all-keys,compact_filters,key-value-db,compiler,sqlite,sqlite-bundled,test-electrum,verify,test-rpc
42+
- name: Run grcov
43+
run: mkdir coverage; grcov . --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore '/*' -o ./coverage/lcov.info
44+
- name: Generate HTML coverage report
45+
run: genhtml -o coverage-report.html ./coverage/lcov.info
3246

33-
- name: Upload coverage to Codecov
34-
uses: codecov/codecov-action@v2
47+
- name: Coveralls upload
48+
uses: coverallsapp/github-action@master
49+
with:
50+
github-token: ${{ secrets.GITHUB_TOKEN }}
51+
- name: Upload artifact
52+
uses: actions/upload-artifact@v2
3553
with:
36-
file: ${{ steps.coverage.outputs.report }}
37-
directory: ./coverage/reports/
54+
name: coverage-report
55+
path: coverage-report.html

codecov.yaml

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

0 commit comments

Comments
 (0)