Code Coverage (llvm-cov) #17
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Coverage (llvm-cov) | |
on: | |
schedule: | |
- cron: "0 1 * * *" # every day at 1am (UTC) | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
# Disable incremental compilation. | |
# | |
# Incremental compilation is useful as part of an edit-build-test-edit cycle, | |
# as it lets the compiler avoid recompiling code that hasn't changed. However, | |
# on CI, we're not making small edits; we're almost always building the entire | |
# project from scratch. Thus, incremental compilation on CI actually | |
# introduces *additional* overhead to support making future builds | |
# faster...but no future builds will ever occur in any given CI environment. | |
# | |
# See https://matklad.github.io/2021/09/04/fast-rust-builds.html#ci-workflow | |
# for details. | |
CARGO_INCREMENTAL: 0 | |
# Allow more retries for network requests in cargo (downloading crates) and | |
# rustup (installing toolchains). This should help to reduce flaky CI failures | |
# from transient network timeouts or other issues. | |
CARGO_NET_RETRY: 10 | |
RUSTUP_MAX_RETRIES: 10 | |
# Don't emit giant backtraces in the CI logs. | |
RUST_BACKTRACE: short | |
# RUSTFLAGS: -D warnings | |
RUSTDOCFLAGS: -D warnings | |
jobs: | |
llvm-cov: | |
name: Generate code coverage | |
runs-on: self-hosted | |
timeout-minutes: 120 | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # pin@v4 | |
- uses: bmwill/rust-cache@fb63fcd7a959767755b88b5af2f5cbf65fb8a127 # pin@v1 | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@125e82eef6e60d2b0c20d4d1f4cf81db37f68bf3 # pin@cargo-llvm-cov | |
- name: Install nextest | |
uses: taiki-e/install-action@7e58f89e24a544d88f7a74c6eed8a3df3fd4c658 # pin@nextest | |
- name: Set Swap Space | |
uses: actionhippie/swap-space@v1 | |
with: | |
size: 256G | |
- name: Update Rust toolchain | |
run: rustup update stable | |
- name: Generate code coverage | |
run: | | |
cargo llvm-cov clean | |
set +e | |
IOTA_SKIP_SIMTESTS=1 cargo +nightly llvm-cov --ignore-run-fail --branch --html nextest | |
if [ -d "target/llvm-cov/html" ]; then | |
exit 0 | |
else | |
echo "Fatal Error: Failed to create coverage report." | |
exit 1 | |
fi | |
- name: Pack report | |
run: cd target/llvm-cov/html && tar -czvf ../nextest_coverage_report.tgz ./ | |
- name: Upload report | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # pin@v4 | |
with: | |
name: nextest_coverage_report.tgz | |
path: ./target/llvm-cov/nextest_coverage_report.tgz | |
if-no-files-found: error | |
retention-days: 1 | |
- name: Generate code coverage (simtest) | |
run: | | |
git clean -fd | |
cargo llvm-cov clean | |
set +e | |
./scripts/simtest/codecov.sh | |
if [ -d "target/llvm-cov/html" ]; then | |
exit 0 | |
else | |
echo "Fatal Error: Failed to create coverage report." | |
exit 1 | |
fi | |
- name: Pack report (simtest) | |
run: cd target/llvm-cov/html && tar -czvf ../simtest_coverage_report.tgz ./ | |
- name: Upload report (simtest) | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # pin@v4 | |
with: | |
name: simtest_coverage_report.tgz | |
path: ./target/llvm-cov/simtest_coverage_report.tgz | |
if-no-files-found: error | |
retention-days: 1 |