-
-
Notifications
You must be signed in to change notification settings - Fork 141
64 lines (53 loc) · 1.58 KB
/
tests-push.yml
File metadata and controls
64 lines (53 loc) · 1.58 KB
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
name: Tests (pytest + coverage)
on:
push:
branches: [ main ]
permissions:
contents: read
jobs:
test:
name: Test (pytest + coverage) — ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Show Python info
run: |
python --version
which python
python -m pip --version
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml', '**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install package & test deps
run: |
python -m pip install --upgrade pip
pip install .
pip install pytest pytest-cov
- name: Show installed packages
run: pip freeze | sed -n '1,200p'
- name: Run pytest with coverage
run: |
mkdir -p test-output
pytest -vv --maxfail=1 --disable-warnings \
--junitxml=test-output/report.xml \
--cov=user_scanner \
--cov-report=xml:test-output/coverage.xml \
--cov-report=term
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: test-reports-${{ matrix.python-version }}
path: test-output