Skip to content

Commit 77ebee1

Browse files
committed
build: use the new --format=total for badge total
1 parent 66657c1 commit 77ebee1

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

.github/workflows/coverage.yml

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ jobs:
9494
name: "Combine coverage data"
9595
needs: coverage
9696
runs-on: ubuntu-latest
97+
outputs:
98+
total: ${{ steps.total.outputs.total }}
99+
env:
100+
COVERAGE_RCFILE: "metacov.ini"
97101

98102
steps:
99103
- name: "Check out the repo"
@@ -102,7 +106,7 @@ jobs:
102106
- name: "Set up Python"
103107
uses: "actions/setup-python@v4"
104108
with:
105-
python-version: "3.8"
109+
python-version: "3.7" # Minimum of PYVERSIONS
106110
cache: pip
107111
cache-dependency-path: 'requirements/*.pip'
108112

@@ -122,24 +126,21 @@ jobs:
122126
- name: "Combine and report"
123127
id: combine
124128
env:
125-
COVERAGE_RCFILE: "metacov.ini"
126129
COVERAGE_CONTEXT: "yes"
127130
run: |
128131
set -xe
129-
python -m igor combine_html
130-
python -m coverage json
132+
python igor.py combine_html
131133
132134
- name: "Upload HTML report"
133135
uses: actions/upload-artifact@v3
134136
with:
135137
name: html_report
136138
path: htmlcov
137139

138-
- name: "Upload JSON report"
139-
uses: actions/upload-artifact@v3
140-
with:
141-
name: json_report
142-
path: coverage.json
140+
- name: "Get total"
141+
id: total
142+
run: |
143+
echo "total=$(python -m coverage report --format=total)" >> $GITHUB_OUTPUT
143144
144145
publish:
145146
name: "Publish coverage report"
@@ -158,21 +159,15 @@ jobs:
158159
git config user.email [email protected]
159160
git checkout main
160161
161-
- name: "Download coverage JSON report"
162-
uses: actions/download-artifact@v3
163-
with:
164-
name: json_report
165-
166162
- name: "Compute info for later steps"
167163
id: info
168164
run: |
169165
set -xe
170-
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
171166
export SHA10=$(echo ${{ github.sha }} | cut -c 1-10)
172167
export SLUG=$(date +'%Y%m%d')_$SHA10
173168
export REPORT_DIR=reports/$SLUG/htmlcov
174169
export REF="${{ github.ref }}"
175-
echo "total=$TOTAL" >> $GITHUB_ENV
170+
echo "total=${{ needs.combine.outputs.total }}" >> $GITHUB_ENV
176171
echo "sha10=$SHA10" >> $GITHUB_ENV
177172
echo "slug=$SLUG" >> $GITHUB_ENV
178173
echo "report_dir=$REPORT_DIR" >> $GITHUB_ENV

0 commit comments

Comments
 (0)