-
Notifications
You must be signed in to change notification settings - Fork 4
52 lines (42 loc) · 1.27 KB
/
ci-cd.yaml
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
name: Tests
on:
pull_request:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python -
poetry --version
poetry config virtualenvs.create false
- name: Install Dependencies
run: poetry install
- name: Run Tests
run: coverage run -m pytest
- name: Generate coverage badge
run: coverage-badge -f -o coverage.svg
- name: Check if there are any changes
id: verify_diff
run: |
git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit changes
if: steps.verify_diff.outputs.changed == 'true'
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add coverage.svg
git commit -m "Update coverage badge"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}