Skip to content

Commit

Permalink
refactor: Update tests.yml to remove lcov filtering and update covera…
Browse files Browse the repository at this point in the history
…ge 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.
  • Loading branch information
PlugFox committed Jul 19, 2024
1 parent 9e996c5 commit 402052d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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%)"
Expand Down

0 comments on commit 402052d

Please sign in to comment.