Skip to content

Commit c474a53

Browse files
committed
Added action for test coverage
1 parent 12cc491 commit c474a53

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# .github/workflows/test-coverage.yml
2+
name: Test Coverage
3+
4+
on:
5+
push:
6+
branches: [main, master]
7+
pull_request:
8+
branches: [main, master]
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.9'
21+
22+
- name: Set up virtual environment
23+
run: |
24+
python3 -m venv .venv
25+
source .venv/bin/activate
26+
pip install --upgrade pip
27+
pip install -r requirements.txt
28+
pip install pytest pytest-cov
29+
30+
- name: Run tests with coverage
31+
run: |
32+
source .venv/bin/activate
33+
pytest --cov=src --cov-report=xml --cov-fail-under=80
34+
35+
- name: Upload coverage report
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: coverage-report
39+
path: coverage.xml

0 commit comments

Comments
 (0)