From 402052d0feb5b7b3b1bb59724f2292cf10fe9d51 Mon Sep 17 00:00:00 2001 From: Plague Fox Date: Fri, 19 Jul 2024 14:26:02 +0400 Subject: [PATCH] refactor: Update tests.yml to remove lcov filtering and update coverage check This commit modifies the tests.yml file to remove the lcov filtering step and update the coverage check. It replaces the previous lcov command with a new one that includes all files in the coverage report. Additionally, it updates the coverage check step to calculate the coverage percentage based on the lcov.info file. This change simplifies the workflow and ensures accurate code coverage measurement. --- .github/workflows/tests.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a7ae8e5..e176327 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -200,11 +200,10 @@ jobs: timeout-minutes: 2 run: | mv coverage/lcov.info coverage/lcov.base.info - lcov -r coverage/lcov.base.info -o coverage/lcov.base.info "lib/src/protobuf/client.*.dart" "lib/**/*.g.dart" - mv coverage/lcov.base.info coverage/lcov.info + lcov --remove coverage/lcov.base.info 'lib/src/protobuf/client.pb.dart' 'lib/src/model/pubspec.yaml.g.dart' -o coverage/lcov.info lcov --list coverage/lcov.info THRESHOLD=50 - COVERAGE=$(lcov --summary coverage.info | grep lines | tail -1 | awk '{print $4}' | sed 's/%//') + COVERAGE=$(lcov --summary coverage/lcov.info | grep lines | tail -1 | awk '{print $4}' | sed 's/%//') echo "Coverage is $COVERAGE%" echo $COVERAGE'<'$THRESHOLD | bc | grep -q 1 && echo "Coverage ($COVERAGE%) is below the threshold ($THRESHOLD%)" && exit 1 || echo "Coverage ($COVERAGE%) is above the threshold ($THRESHOLD%)"