Repository navigation
91 lines (78 loc) · 2.42 KB
/
Copy pathcode-coverage.yml
File metadata and controls
91 lines (78 loc) · 2.42 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Code Coverage
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
permissions:
contents: read
pull-requests: write
jobs:
coverage:
name: Generate Coverage Report
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "latest"
- name: Install dependencies
run: |
uv pip install --upgrade pip setuptools wheel
uv pip install -e "Libraries/PyKotor[all]"
uv pip install pytest pytest-cov pytest-xdist coverage[toml]
- name: Set up Node.js (TGA↔TPC ndix parity)
uses: actions/setup-node@v6
with:
node-version: "20"
- name: Install ref-tga2tpc npm dependencies
run: npm --prefix vendor/ref-tga2tpc install --ignore-scripts
- name: Run tests with coverage
run: |
pytest tests/ \
Libraries/PyKotor/tests/resource/formats/test_tpc.py \
--import-mode=importlib \
--cov=Libraries/PyKotor/src/pykotor \
--cov-report=xml \
--cov-report=html \
--cov-report=term-missing \
--cov-report=json \
-v
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
with:
files: ./coverage.xml
flags: unittests
name: codecov-py${{ matrix.python-version }}
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage reports
uses: actions/upload-artifact@v7
if: always()
with:
name: coverage-py${{ matrix.python-version }}
path: |
coverage.xml
htmlcov/
coverage.json
retention-days: 30
- name: Coverage comment
uses: py-cov-action/python-coverage-comment-action@v3
if: github.event_name == 'pull_request'
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MINIMUM_GREEN: 60
MINIMUM_ORANGE: 40