Skip to content

Commit

Permalink
refactor: Update tests.yml to include threshold as an environment var…
Browse files Browse the repository at this point in the history
…iable

This commit modifies the tests.yml file to include the threshold as an environment variable. It adds a new line to set the threshold value to 50. This change allows for easier customization of the coverage threshold without modifying the workflow file directly.
  • Loading branch information
PlugFox committed Jul 19, 2024
1 parent 624d9af commit d1b3055
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ jobs:
image: dart:stable
env:
pub-cache-name: pub
threshold: 50
timeout-minutes: 15
steps:
- name: 🚂 Get latest code
Expand Down Expand Up @@ -202,10 +203,9 @@ jobs:
mv coverage/lcov.info coverage/lcov.base.info
lcov --remove coverage/lcov.base.info '*/protobuf/client.*.dart' '*/model/*.g.dart' -o coverage/lcov.info
lcov --list coverage/lcov.info
THRESHOLD=50
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%)"
THRESHOLD=${{ env.threshold }}
COVERAGE=$(lcov --summary coverage/lcov.info | grep -i 'lines\|Total:' | tail -n 1 | awk '{print $4}' | sed 's/%//')
echo $COVERAGE | awk '{if ($1 < 50) exit 1}'
- name: 🧹 Cleanup artifacts
id: cleanup-artifacts
Expand Down

0 comments on commit d1b3055

Please sign in to comment.