-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (56 loc) · 1.81 KB
/
coverage-tests.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
name: Coverage
on:
push:
branches: [ "v[0-9]+.[0-9]+.[0-9]+" ]
pull_request:
branches: [ "v[0-9]+.[0-9]+.[0-9]+" ]
permissions:
contents: write
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git checkout $BRANCH_NAME
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest coverage
python -m pip install -e .
- name: Create coverage report
run: |
if [ ! -d coverage ]; then mkdir coverage; fi
coverage run -m pytest tests/
coverage report -m --format=markdown --omit=tests/* > ./coverage/COVERAGE.md
- name: Create coverage badge
uses: tj-actions/coverage-badge-py@v2
- name: Move coverage reports
run: |
mv coverage.svg ./coverage
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v19
id: verify-changed-files
with:
files: ./coverage/coverage.svg
- name: Commit & push coverage badge
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git remote add github https://github.com/thomaseleff/assemblit.git
git add coverage/coverage.svg
git add coverage/COVERAGE.md
git commit -m "Updated coverage"
git push github $BRANCH_NAME