Repository navigation
59 lines (50 loc) · 1.54 KB
/
Copy pathpython-test.yml
File metadata and controls
59 lines (50 loc) · 1.54 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
name: Python test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.11", "3.12", "3.13", "3.14"]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv, set the python version, and enable cache
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
uv pip install coverage==7.6.4
uv pip install pytest pytest-cov coverage-badge .
- name: Test with pytest and coverage badge
run: |
python --version
pytest --cov=paint
coverage report -m --format markdown > cov_report.txt
coverage xml
- name: Save PR number
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
run: echo ${{ github.event.number }} > pr_number.txt
- name: Save coverage report and PR number
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: |
cov_report.txt
pr_number.txt
retention-days: 1
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}