-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (36 loc) · 1.18 KB
/
pytest.yml
File metadata and controls
44 lines (36 loc) · 1.18 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
name: Run Pytest and Codecov with Hatch
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest pytest-cov coverage[toml]>=6.2
- name: Run pytest and generate coverage report
run: |
pytest --cov=src --cov-report=xml:coverage.xml
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-xml
path: ${{ github.workspace }}/coverage.xml
- name: Upload coverage report to Codecov
if: ${{ secrets.CODECOV_TOKEN != '' }}
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ${{ github.workspace }}/coverage.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Skip Codecov upload (no token)
if: ${{ secrets.CODECOV_TOKEN == '' }}
run: echo "Skipping Codecov — CODECOV_TOKEN not set."