fix: round coverage before json
This commit is contained in:
13
.github/workflows/ci.yml
vendored
13
.github/workflows/ci.yml
vendored
@@ -86,15 +86,22 @@ jobs:
|
|||||||
- name: Round coverage percentage
|
- name: Round coverage percentage
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
run: |
|
run: |
|
||||||
COVERAGE=$(python -c "import json; print(round(json.load(open('coverage.json'))['totals']['percent_covered']))")
|
python -c "
|
||||||
echo "COVERAGE=$COVERAGE" >> $GITHUB_ENV
|
import json
|
||||||
|
with open('coverage.json') as f:
|
||||||
|
data = json.load(f)
|
||||||
|
data['totals']['percent_covered'] = round(data['totals']['percent_covered'])
|
||||||
|
with open('coverage.json', 'w') as f:
|
||||||
|
json.dump(data, f)
|
||||||
|
"
|
||||||
|
|
||||||
- name: Generate coverage badge
|
- name: Generate coverage badge
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
uses: jaywcjlove/coverage-badges-cli@v2.1.0
|
uses: jaywcjlove/coverage-badges-cli@v2.1.0
|
||||||
with:
|
with:
|
||||||
|
source: coverage.json
|
||||||
output: badge/coverage-badge.svg
|
output: badge/coverage-badge.svg
|
||||||
value: ${{ env.COVERAGE }}%
|
jsonPath: totals.percent_covered
|
||||||
|
|
||||||
- name: Deploy coverage badge
|
- name: Deploy coverage badge
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
|
|||||||
Reference in New Issue
Block a user