From eec0c109324655b56df0525998141afff62dc7c8 Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Wed, 1 Nov 2023 12:58:44 -0400 Subject: [PATCH] Compute coverage in CI --- .github/workflows/ci.yml | 35 -------------------- .github/workflows/coverage.yml | 58 ++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 35 deletions(-) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 328e05e23..45fc45bbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -182,38 +182,3 @@ jobs: steps: - run: true - - coverage: - # smoelius: Disable coverage until the following issue is resolved: - # https://github.com/taiki-e/cargo-llvm-cov/issues/128 - if: ${{ false }} - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Install dylint-link - run: cargo install --path ./dylint-link - - - name: Install cargo-llvm-cov - run: cargo install cargo-llvm-cov - - - name: Install llvm-tools-preview - run: rustup +nightly component add llvm-tools-preview - - - name: Coverage - run: cargo llvm-cov --failure-mode all --lcov --output-path workspace.lcov - env: - RUSTUP_TOOLCHAIN: nightly - - - name: Install lcov - run: sudo apt install lcov - - - name: Generate html - run: genhtml --output-directory artifacts/html workspace.lcov - - - uses: actions/upload-artifact@v3 - with: - name: Coverage - path: artifacts diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 000000000..6a447a3ee --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,58 @@ +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.PR_SSH_KEY }} + + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + ~/.dylint_drivers/ + ~/.rustup/toolchains/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Install dylint-link + run: cargo install --path ./dylint-link + + - name: Install cargo-llvm-cov + run: cargo install cargo-llvm-cov + + - name: Coverage + run: | + for X in . driver utils/linting; do + pushd "$X" + cargo llvm-cov --failure-mode all --lcov --output-path 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 coverage.lcov + + - name: Push to gh-pages branch + run: | + git commit coverage -m Coverage + git push origin ${{ github.ref }}:gh-pages --force