generated from astariul/pytere
-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (32 loc) · 1.26 KB
/
pytest.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
name: tests
on: pull_request
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: # Use deploy key to ensure pushed change trigger checks as well : https://github.com/peter-evans/create-pull-request/blob/master/docs/concepts-guidelines.md#workarounds-to-trigger-further-workflow-runs
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[test]
env:
GH_PAT: ${{ secrets.AUTH_TOKEN }}
- name: Test with pytest
timeout-minutes: 5
run: python -m pytest
- name: Check coverage updated
run: |
prev_cov=$(grep -Po '\d+%' .github/badges/coverage.svg | tail -1 | sed 's/.$//')
coverage-badge -o .github/badges/coverage.svg -f
curr_cov=$(grep -Po '\d+%' .github/badges/coverage.svg | tail -1 | sed 's/.$//')
if [[ "$prev_cov" != "$curr_cov" ]]
then
echo "Coverage badge is not up-to-date ! Please run the tests ('python -m pytest') and then re-create the badge with 'coverage-badge -o .github/badges/coverage.svg -f'"
exit 1
fi