forked from RedHatQE/sitreps-client
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (73 loc) · 2.08 KB
/
tests.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: sitreps-client tests
on:
push:
branches:
- master
pull_request:
types: ["opened", "synchronize", "reopened"]
create:
jobs:
pre-commit:
name: Pre-Commit Checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.x'
architecture: 'x64'
- name: Pre-Commit Checks
run: |
python -m pip install pip --upgrade
python -m pip install pre-commit
pre-commit run -a
- name: Analysis (git diff)
if: failure()
run: git diff
test:
name: UnitTests-Python-${{ matrix.python-version }}
needs: [ pre-commit ]
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -U pip wheel
pip install .[test]
- name: Test with pytest
run: |
pytest -v -n 5 --no-cov-on-fail --cov=sitreps_client --cov-append
mv .coverage ${{ strategy.job-index }}_coverage
- name: Upload coverage artifact
uses: "actions/upload-artifact@v2"
with:
name: ${{ strategy.job-index }}_coverage
path: ${{ strategy.job-index }}_coverage
submit_coverage:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/setup-python@v3
with:
python-version: "3.8"
- uses: actions/checkout@v3
- name: Install coverage
run: pip install coverage
- name: Download coverage artifacts
uses: actions/download-artifact@v2
with:
path: /tmp/coverage
- name: Combine coverage data files
run: |
coverage combine -a $(find /tmp/coverage -type f)
coverage xml -o /tmp/coverage.xml
- name: Publish coverage
uses: codecov/codecov-action@v1.5.2
with:
files: /tmp/coverage.xml