-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (73 loc) · 2.24 KB
/
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
name: Generate Coverage Badges
on:
workflow_dispatch:
push:
paths:
- .github/workflows/coverage.yml
- cat_win/**
# only trigger on development branch
branches:
- 'dev'
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Set Windows Line Ending
run: |
git config --global core.autocrlf true
- name: Git Checkout
uses: actions/checkout@v4
with:
ref: 'dev'
- name: Install Python 3.10
id: python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Update PIP
run: |
python -m pip install --upgrade pip
- name: Setup Dependencies
run: |
python -m pip install --upgrade -r ./workflowHelper/requirements-dev.txt
- name: Generate Reports
run: |
python -m coverage run -m pytest ./cat_win/tests/ --junitxml=./reports/pytest.xml
python -m coverage xml -o ./reports/coverage.xml
- name: Show Missing Coverage
run: |
python -m coverage report --show-missing
- name: Generate Badges
run: |
python -m genbadge.main tests -i ./reports/pytest.xml -o ./temp/badge-tests.svg
python -m genbadge.main coverage -i ./reports/coverage.xml -o ./temp/badge-coverage.svg
- name: Show Changes
run: |
git status
- name: Stash Changes
run: |
git config --local user.name 'github-actions[bot]'
git config --local user.email 'github-actions[bot]@users.noreply.github.com'
git add ./temp/*
git stash -- temp
git clean -df
git restore .
- name: Fetch Badges Branch
run: |
git fetch origin badges
git checkout badges
git stash pop
- name: Copy To Badges
run: |
python -c "import sys; import shutil; shutil.copytree('./temp', './badges', dirs_exist_ok=True)"
- name: Commit & Push
run: |
git add ./badges/*
git reset ./temp/*
git status
git commit -m "🤖Generated Coverage Badges."
git push origin HEAD:badges
continue-on-error: true