diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1cfd5b5d4..046129e52 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -78,11 +78,24 @@ jobs: - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.5 - - name: Install cargo-tarpaulin - run: cargo binstall cargo-tarpaulin + - name: Prepare for coverage + if: matrix.os == 'ubuntu-latest' + run: | + cargo binstall grcov + echo "RUSTFLAGS=-Cinstrument-coverage" >> "$GITHUB_ENV" + echo "LLVM_PROFILE_FILE=$(pwd)/target/chia_rs-%p-%m.profraw" >> "$GITHUB_ENV" + echo "CARGO_TARGET_DIR=$(pwd)/target" >> "$GITHUB_ENV" + + - name: Run tests + run: cargo test --workspace --all-features --release - - name: Tests - run: cargo tarpaulin --workspace --all-features --release --out lcov + - name: Continue with coverage + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get install lcov -y + rustup component add llvm-tools-preview + grcov . --binary-path target -s . --branch --ignore-not-existing --ignore='*/.cargo/*' --ignore='tests/*' --ignore='venv/*' -o rust_cov.info + python -c 'with open("rust_cov.info") as f: lines = [l for l in f if not (l.startswith("DA:") and int(l.split(",")[1].strip()) >= 2**63)]; open("lcov.info", "w").writelines(lines)' - name: Upload to Coveralls uses: coverallsapp/github-action@v2