From 147c16eea3a001c5cc58003097262d13ed49a8e2 Mon Sep 17 00:00:00 2001 From: Sergio Arroutbi Date: Sun, 28 May 2023 13:06:28 +0200 Subject: [PATCH] Add HTML preview for coverage report Resolves: #59 Signed-off-by: Sergio Arroutbi --- .github/workflows/rust.yml | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 433b241..7acc7d5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -23,33 +23,33 @@ jobs: stable: [true] steps: - uses: actions/checkout@v3 - - name: Build (release) + - name: "Build (release)" run: cargo build --release --verbose - - name: Run tests (release) + - name: "Run tests (release)" run: cargo test --release --verbose - - name: Build + - name: "Build" run: cargo build --verbose - - name: Run tests + - name: "Run tests" run: cargo test --verbose - - name: Run tests (memory safety) + - name: "Run tests (memory safety)" run: | type dnf 2>/dev/null 1>/dev/null && sudo dnf install -y valgrind || : type apt 2>/dev/null 1>/dev/null && sudo apt install -y valgrind || : cargo install cargo-valgrind cargo valgrind test --verbose - - name: Clippy + - name: "Clippy" run: cargo clippy --verbose -- --deny "warnings" - - name: Clean (coverage) + - name: "Clean (coverage)" run: cargo clean --verbose - - name: Setup toolchain (coverage) + - name: "Setup toolchain (coverage)" uses: actions-rs/toolchain@v1 with: toolchain: nightly override: true profile: minimal - - name: Install grcov (coverage) + - name: "Install grcov (coverage)" run: cargo install grcov --verbose - - name: Run tests (coverage) + - name: "Run tests (coverage)" uses: actions-rs/cargo@v1 with: command: test @@ -58,16 +58,16 @@ jobs: CARGO_INCREMENTAL: '0' RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests -Cinstrument-coverage' RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests -Cinstrument-coverage' - - name: Gather data (coverage) + - name: "Gather data (coverage)" id: coverage uses: actions-rs/grcov@v0.1 - - name: Output show (coverage) + - name: "Output show (coverage)" run: | set -eu echo "COVERAGE:$(cat ${COV_REPORT_DIR}/badges/flat.svg | egrep 'coverage: ' | egrep -o "[0-9]{1,2}%" | sed 's/ //g')" env: COV_REPORT_DIR: ${{ steps.coverage.outputs.report }} - - name: Report in PR status for the current commit (coverage) + - name: "Report in PR status for the current commit (coverage)" if: github.ref_name != 'main' run: | set -eu @@ -81,3 +81,11 @@ jobs: RUN_ID: ${{ github.run_id }} PULL_NUMBER: ${{ github.event.pull_request.number }} COV_REPORT_DIR: ${{ steps.coverage.outputs.report }} + + - name: "HTML search files" + run: | + tree + find . -iname *.html -print + - name: "HTML view (coverage)" + run: + cat coverage/html/index.html >> $GITHUB_STEP_SUMMARY