From 3f290c9cdf8d26c98d1e0ac4a08c0f30f18b0e9d Mon Sep 17 00:00:00 2001 From: muraca Date: Thu, 5 Oct 2023 17:44:34 +0200 Subject: [PATCH] updates to test action - print lines coverage to actions cli output - comment PR with report when allowed Signed-off-by: muraca --- .github/workflows/ci.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a6047b69..4354d5fc9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,11 +51,18 @@ jobs: uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - - name: Run tests - run: cargo llvm-cov nextest --lcov + - name: Run tests and print coverage data + run: cargo llvm-cov nextest --json --output-path lcov.json + --ignore-filename-regex "node/" --summary-only && + echo "Lines coverage " && jq ".data[0].totals.lines.percent" lcov.json + # if the PR is on the same repo, the coverage data can be reported as a comment + - if: github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name == github.repository + name: Generate lcov report + run: cargo llvm-cov report --lcov --output-path lcov.info --ignore-filename-regex "node/" - --output-path lcov.info - - if: github.event_name == 'pull_request' + - if: github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name == github.repository name: Report code coverage uses: Nef10/lcov-reporter-action@v0.4.0 with: