forked from jonathanhogg/flitter
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (74 loc) · 2.17 KB
/
ci-coverage.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: CI coverage
on:
push:
branches: ["main"]
paths:
- ".github/workflows/ci-coverage.yml"
- "scripts/coverage_badge.py"
- "pyproject.toml"
- "setup.py"
- "src/**/*"
- "tests/**/*"
- "docs/**/*.fl"
- "examples/**/*"
pull_request:
branches: ["main"]
jobs:
build-and-run-test-coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | sudo debconf-set-selections
sudo apt-get install -y mesa-utils xvfb libfontconfig1 ttf-mscorefonts-installer
python -m pip install --upgrade pip setuptools
python -m pip install cython coverage pytest
- name: Build in place with coverage analysis enabled
run: |
pip3 install --editable .
env:
FLITTER_BUILD_COVERAGE: 1
- name: Run tests with coverage
run: |
xvfb-run coverage run --source=src -m pytest tests --durations=5
- name: Generate coverage reports
id: report
run: |
coverage report --sort=-miss
coverage json
python scripts/coverage_badge.py >> "${GITHUB_OUTPUT}"
coverage html
- name: Upload report
uses: actions/upload-artifact@v4
with:
name: htmlcov
path: htmlcov/
- name: Generate coverage percent badge
uses: emibcn/badge-action@v2.0.3
with:
label: 'CI coverage'
label-color: '333'
status: ${{ steps.report.outputs.status }}
color: ${{ steps.report.outputs.color }}
path: badge.svg
- name: Generate coverage failing badge
if: failure()
uses: emibcn/badge-action@v2.0.3
with:
label: 'CI coverage'
label-color: '333'
status: 'failing'
color: 'red'
path: badge.svg
- name: Update badge gist
if: always()
uses: stellarhub/push-gist-action@v1
with:
token: ${{ secrets.GIST }}
gist_id: b7237d8b4e7ff50c3f284cb939e949d0
file_path: badge.svg