-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (54 loc) · 1.72 KB
/
python-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
name: Python Test Coverage
on:
push:
paths:
- python/**/*
env:
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
jobs:
test-coverage:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: '1.8.3'
- name: Install Dependencies
working-directory: ./python
run: poetry install
- name: Run Tests
run: |
poetry run coverage run --source=ouroboros/helpers -m pytest
poetry run coverage report -m
working-directory: ./python
- name: Coverage Badge
uses: tj-actions/coverage-badge-py@v2
with:
working-directory: './python'
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v16
id: verify-changed-files
with:
files: python/coverage.svg
- name: Commit files
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 add python/coverage.svg
git commit -m "Updated coverage.svg"
- name: Push changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}