Skip to content

Commit 6df022c

Browse files
committed
Add code coverage workflow
1 parent 12730ca commit 6df022c

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: "Code Coverage"
2+
on:
3+
pull_request:
4+
branches: [ "main", "master" ]
5+
6+
jobs:
7+
coverage:
8+
name: Overall Coverage Check
9+
runs-on: ubuntu-latest
10+
timeout-minutes: 15
11+
permissions:
12+
contents: read
13+
pull-requests: write
14+
15+
strategy:
16+
matrix:
17+
python-version: ["3.11"]
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Install Dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
# Install project dependencies first
32+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
33+
if [ -f setup.py ]; then pip install -e .; fi
34+
# Install testing tools
35+
pip install pytest pytest-cov
36+
37+
- name: Run Unit Tests with Coverage
38+
run: |
39+
pytest test/unit_tests/ --cov=src/ --cov-report=term-missing --cov-report=xml --cov-fail-under=70
40+
41+
- name: Upload Coverage Report
42+
uses: actions/upload-artifact@v3
43+
if: always()
44+
with:
45+
name: coverage-report
46+
path: coverage.xml

0 commit comments

Comments
 (0)