Skip to content

Commit

Permalink
ci: add precision option (default to 2) to coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
percevalw committed May 15, 2024
1 parent 91955b3 commit 67395a2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ on:
coverage-data-pattern:
required: true
type: string
precision:
required: true
type: number
default: 2

jobs:
pull-request-coverage:
Expand Down Expand Up @@ -64,9 +68,9 @@ jobs:
echo '## Coverage Report' > /tmp/report.md
if git show ${{ inputs.coverage-branch }}:${{ inputs.coverage-report }} > /tmp/main-coverage.txt; then
coverage report --skip-covered --skip-empty --show-missing --format=diff --base-coverage-report=/tmp/main-coverage.txt --base-revision=${{ inputs.base-branch }} --fail-under=base >> /tmp/report.md || status=$?
coverage report --skip-covered --skip-empty --show-missing --format=diff --base-coverage-report=/tmp/main-coverage.txt --base-revision=${{ inputs.base-branch }} --precision=${{ inputs.precision }} --fail-under=base >> /tmp/report.md || status=$?
else
coverage report --skip-covered --skip-empty --show-missing --format=diff --base-revision=${{ inputs.base-branch }} >> /tmp/report.md || status=$?
coverage report --skip-covered --skip-empty --show-missing --format=diff --base-revision=${{ inputs.base-branch }} --precision=${{ inputs.precision }} >> /tmp/report.md || status=$?
fi
cat /tmp/report.md >> $GITHUB_STEP_SUMMARY
Expand Down Expand Up @@ -120,7 +124,7 @@ jobs:
run: |
python -Im pip install --upgrade "git+https://github.com/percevalw/coveragepy.git#egg=coverage[toml]"
python -Im coverage combine
coverage report --show-missing > /tmp/main-coverage.txt
coverage report --show-missing --precision=${{ inputs.precision }} > /tmp/main-coverage.txt
# Generate the coverage badge
curl -s -o generate_badge.py https://raw.githubusercontent.com/aphp/foldedtensor/main/.github/workflows/generate_badge.py
Expand Down

0 comments on commit 67395a2

Please sign in to comment.