Skip to content

Commit cf76f90

Browse files
committed
Add GitHub Workflow: pytest.
1 parent 17e567c commit cf76f90

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

.github/workflows/pytest.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Run Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
test:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, macos-latest]
17+
python-version: ['3.9', '3.10', '3.11', '3.12']
18+
fail-fast: false
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Python ${{ matrix.python-version }}
25+
uses: actions/setup-python@v5
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
cache: 'pip'
29+
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install pytest
34+
35+
- name: Run tests
36+
run: |
37+
pytest tests/ -v
38+
39+
- name: Run tests with coverage
40+
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
41+
run: |
42+
pip install pytest-cov
43+
pytest tests/ --cov=. --cov-report=xml --cov-report=term
44+
45+
- name: Upload coverage reports
46+
if: success() && matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
47+
uses: codecov/codecov-action@v4
48+
with:
49+
file: ./coverage.xml
50+
fail_ci_if_error: false
51+
continue-on-error: true

0 commit comments

Comments
 (0)