You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/ci.yml
+16-4Lines changed: 16 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -19,18 +19,28 @@ jobs:
19
19
run: uv run pytest --ignore=test/availability
20
20
21
21
- name: Generate badges
22
+
if: always()
22
23
run: |
23
-
uv run genbadge tests -i junit.xml -o pytest.svg
24
-
uv run genbadge coverage -i coverage.xml -o coverage.svg
24
+
PASSED=$(python -c "import xml.etree.ElementTree as ET; r=ET.parse('junit.xml').getroot(); ts=r.findall('testsuite'); print(sum(int(t.get('tests',0))-int(t.get('failures',0))-int(t.get('errors',0)) for t in ts))")
25
+
FAILED=$(python -c "import xml.etree.ElementTree as ET; r=ET.parse('junit.xml').getroot(); ts=r.findall('testsuite'); print(sum(int(t.get('failures',0))+int(t.get('errors',0)) for t in ts))")
26
+
if [ "$FAILED" -eq 0 ]; then
27
+
uv run anybadge --label=pytest --value="${PASSED} passed" --color=green --file=pytest.svg
28
+
else
29
+
uv run anybadge --label=pytest --value="${PASSED} passed, ${FAILED} failed" --color=red --file=pytest.svg
30
+
fi
31
+
COVERAGE=$(python -c "import xml.etree.ElementTree as ET; t=ET.parse('coverage.xml').getroot(); print(round(float(t.get('line-rate',0))*100))")
32
+
uv run anybadge --value=$COVERAGE --file=coverage.svg coverage
25
33
26
34
- name: Upload pytest badge
35
+
if: always()
27
36
uses: actions/upload-artifact@v4
28
37
with:
29
38
name: pytest
30
39
path: pytest.svg
31
40
overwrite: true
32
41
33
42
- name: Upload coverage badge
43
+
if: always()
34
44
uses: actions/upload-artifact@v4
35
45
with:
36
46
name: coverage
@@ -71,9 +81,10 @@ jobs:
71
81
run: uv sync --dev --frozen
72
82
73
83
- name: Lint with ruff
74
-
run: uv run ruff check --exit-zero --output-format=concise > ruff.txt
84
+
run: uv run ruff check --output-format=concise > ruff.txt
0 commit comments