Skip to content

Commit

Permalink
refactor: coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
0xClandestine committed Jan 30, 2025
1 parent 4a93831 commit 32f4912
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/foundry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,23 @@ jobs:
echo "Coverage: $COVERAGE_PCT%"
echo "Coverage: $COVERAGE_PCT%" >> $GITHUB_STEP_SUMMARY
if (( $(echo "$COVERAGE_PCT < 90" | bc -l) )); then
echo "❌ Code coverage ($COVERAGE_PCT%) is below minimum threshold of 90%" >> $GITHUB_STEP_SUMMARY
exit 1
else
echo "✅ Code coverage ($COVERAGE_PCT%) meets minimum threshold of 90%" >> $GITHUB_STEP_SUMMARY
fi
# Generate HTML reports from LCOV data.
- name: Generate HTML Report
run: genhtml -o report ./lcov.info
# Generate HTML reports from LCOV data before potential failure
genhtml -o report ./lcov.info
# Upload coverage report as artifact.
# Upload coverage report as artifact before potential failure
- name: Upload Coverage Report
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: report/*
path: report/*

# Check coverage threshold after uploading report
- name: Check Coverage Threshold
run: |
COVERAGE_PCT=$(lcov --summary lcov.info | grep "lines" | cut -d ':' -f 2 | cut -d '%' -f 1 | tr -d '[:space:]')
if (( $(echo "$COVERAGE_PCT < 90" | bc -l) )); then
echo "❌ Code coverage ($COVERAGE_PCT%) is below minimum threshold of 90%" >> $GITHUB_STEP_SUMMARY
exit 1
else
echo "✅ Code coverage ($COVERAGE_PCT%) meets minimum threshold of 90%" >> $GITHUB_STEP_SUMMARY
fi

0 comments on commit 32f4912

Please sign in to comment.