Skip to content

Commit d8a8390

Browse files
committed
Move coverage generation to llvm-cov in the hopes its more stable
1 parent a13dd71 commit d8a8390

File tree

2 files changed

+17
-36
lines changed

2 files changed

+17
-36
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ jobs:
2222
include:
2323
- toolchain: stable
2424
platform: ubuntu-latest
25-
coverage: true
2625
# 1.48.0 is the MSRV for all crates except lightning-transaction-sync and Win/Mac
2726
- toolchain: 1.48.0
2827
platform: ubuntu-latest
@@ -50,46 +49,30 @@ jobs:
5049
run: |
5150
sudo apt-get -y install shellcheck
5251
shellcheck ci/ci-tests.sh
53-
- name: Run CI script with coverage generation
54-
if: matrix.coverage
55-
shell: bash # Default on Winblows is powershell
56-
run: LDK_COVERAGE_BUILD=true ./ci/ci-tests.sh
5752
- name: Run CI script
58-
if: "!matrix.coverage"
5953
shell: bash # Default on Winblows is powershell
6054
run: ./ci/ci-tests.sh
61-
- name: Install deps for kcov
62-
if: matrix.coverage
55+
56+
coverage:
57+
strategy:
58+
fail-fast: false
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Checkout source code
62+
uses: actions/checkout@v3
63+
- name: Install Rust stable toolchain
6364
run: |
64-
sudo apt-get update
65-
sudo apt-get -y install binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev
66-
- name: Install kcov
67-
if: matrix.coverage
68-
run: |
69-
wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz
70-
tar xzf master.tar.gz
71-
cd kcov-master && mkdir build && cd build
72-
cmake ..
73-
make
74-
make install DESTDIR=../../kcov-build
75-
cd ../.. && rm -rf kcov-master master.tar.gz
76-
- name: Generate coverage report
77-
if: matrix.coverage
78-
run: |
79-
for file in target/debug/deps/lightning*; do
80-
[ -x "${file}" ] || continue;
81-
mkdir -p "target/cov/$(basename $file)";
82-
./kcov-build/usr/local/bin/kcov --exclude-pattern=/.cargo,/usr/lib --verify "target/cov/$(basename $file)" "$file";
83-
done
84-
- name: Upload coverage
85-
if: matrix.coverage
86-
uses: codecov/codecov-action@v3
87-
with:
65+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal
66+
- name: Run tests with coverage generation
67+
run: |
68+
cargo install cargo-llvm-cov
69+
export RUSTFLAGS="-Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests"
70+
export RUSTC_BOOTSTRAP=1
71+
cargo llvm-cov --features rest-client,rpc-client,tokio,futures,serde --codecov --hide-instantiations --output-path=target/codecov.json
8872
# Could you use this to fake the coverage report for your PR? Sure.
8973
# Will anyone be impressed by your amazing coverage? No
9074
# Maybe if codecov wasn't broken we wouldn't need to do this...
91-
token: f421b687-4dc2-4387-ac3d-dc3b2528af57
92-
fail_ci_if_error: true
75+
bash <(curl -s https://codecov.io/bash) -f target/codecov.json -t "f421b687-4dc2-4387-ac3d-dc3b2528af57"
9376
9477
benchmark:
9578
runs-on: ubuntu-latest

ci/ci-tests.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ fi
4141
# The memchr crate switched to an MSRV of 1.60 starting with v2.6.0
4242
[ "$RUSTC_MINOR_VERSION" -lt 60 ] && cargo update -p memchr --precise "2.5.0" --verbose
4343

44-
[ "$LDK_COVERAGE_BUILD" != "" ] && export RUSTFLAGS="-C link-dead-code"
45-
4644
export RUST_BACKTRACE=1
4745

4846
echo -e "\n\nBuilding and testing all workspace crates..."

0 commit comments

Comments
 (0)