Skip to content

Commit

Permalink
Add HTML preview for coverage report
Browse files Browse the repository at this point in the history
Resolves: #59

Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
  • Loading branch information
sarroutbi committed May 28, 2023
1 parent 2c8a7c1 commit 147c16e
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 '<title>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
Expand All @@ -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

0 comments on commit 147c16e

Please sign in to comment.