-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (43 loc) · 1.39 KB
/
badge.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
name: Study lyte Coverage Badge
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
workflow_dispatch:
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Checkout code
uses: actions/checkout@v2
- name: Checkout wiki
uses: actions/checkout@v2
with:
repository: ${{github.repository}}.wiki
path: ./.github/wiki/
- name: Install dependencies
run: |
sudo apt-get update
python -m pip install --upgrade pip
python -m pip install pytest coverage genbadge[coverage]
python setup.py install
- name: Create Badges
shell: bash
run: |
coverage run --source study_lyte -m pytest
coverage xml
genbadge coverage -i coverage.xml -o .github/wiki/coverage.svg
- name: Push to wiki
shell: bash
run: |
cd ./.github/wiki/
git add --all
git diff-index --quiet HEAD && exit
git config --local user.name "GitHub Action"
git config --local user.email "[email protected]"
git commit --amend --no-edit && git push --force-with-lease || \
git commit -m"Update coverage" && git push