Skip to content

Coverage

Coverage #87

Workflow file for this run

name: Coverage
on:
schedule:
- cron: "0 3 * * 2" # 2 = Tuesday
workflow_dispatch:
concurrency:
group: coverage-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.SSH_KEY }}
- name: Rustup
run: rustup update
- name: Install dylint-link
run: cargo install --path ./dylint-link
- name: Install cargo-llvm-cov and rustfilt
run: |
cargo install cargo-llvm-cov
cargo install rustfilt
- name: Free up space on Ubuntu
run: |
# https://github.com/actions/runner-images/issues/2606#issuecomment-772683150
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/share/swift
# du -sh /usr/*/* 2>/dev/null | sort -h || true
- name: Coverage
run: |
for X in . driver utils/linting; do
pushd "$X"
TMP="$(mktemp)"
cargo llvm-cov --coverage-target-only --target x86_64-unknown-linux-gnu --workspace --failure-mode all --lcov --output-path "$TMP"
# smoelius: Collapse crate disambiguators. See:
# - https://github.com/rust-lang/rust/blob/5ad7a646a5df1c7e37fc4529f0f1000091ac902d/compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs#L416-L417
# - https://github.com/rust-lang/rust/blob/5ad7a646a5df1c7e37fc4529f0f1000091ac902d/compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs#L58-L64
# sed -i 's/Cs[^_]*_/Cs_/g' coverage.lcov
rustfilt -i "$TMP" -o coverage.lcov
popd
done
- name: Install lcov
run: sudo apt install lcov
- name: Generate html
run: find . -name coverage.lcov -print0 | xargs -0 genhtml --output-directory coverage
- name: Push to gh-pages branch
run: |
git add coverage
git config --global user.email "coverage@users.noreply.github.com"
git config --global user.name "coverage"
git commit -m Coverage
git push origin ${{ github.ref }}:gh-pages --force