Skip to content

Commit 137eb58

Browse files
authored
Merge pull request #18 from CHISym/sritchie/coverage
Add code coverage step to repo
2 parents fe6ca92 + 488d4d8 commit 137eb58

File tree

5 files changed

+47
-14
lines changed

5 files changed

+47
-14
lines changed

.github/workflows/coverage.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: GPU tests + code coverage
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
11+
jobs:
12+
test_coverage:
13+
runs-on: ParallelHoss
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 1
19+
20+
- uses: actions/setup-python@v4
21+
with:
22+
python-version: 3.11.5
23+
cache: 'pip'
24+
25+
- name: Run Tests
26+
run: |
27+
python -m venv venv
28+
source venv/bin/activate
29+
pip install -e .[test]
30+
coverage run --source=genlm_backend -m pytest --benchmark-disable
31+
coverage json --omit "*/test*"
32+
coverage report --omit "*/test*"
33+
34+
- name: Upload coverage to Codecov
35+
uses: codecov/codecov-action@v5
36+
with:
37+
fail_ci_if_error: false
38+
disable_search: true
39+
token: ${{ secrets.CODECOV_TOKEN }}
40+
files: ./coverage.json

.github/workflows/docs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ jobs:
2020
- name: Set up Python
2121
uses: actions/setup-python@v4
2222
with:
23-
python-version: '3.10'
23+
python-version: '3.11.5'
24+
cache: 'pip'
2425

2526
- name: Install dependencies
2627
run: |

.github/workflows/pytest.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ on:
1111

1212
jobs:
1313
test:
14-
strategy:
15-
matrix:
16-
runner: [ubuntu-22.04, ParallelHoss]
17-
runs-on: ${{ matrix.runner }}
14+
runs-on: ubuntu-22.04
1815

1916
steps:
2017
- uses: actions/checkout@v4
@@ -24,18 +21,11 @@ jobs:
2421
- uses: actions/setup-python@v4
2522
with:
2623
python-version: 3.11.5
27-
28-
- name: Cache pip packages
29-
uses: actions/cache@v3
30-
with:
31-
path: ~/.cache/pip
32-
key: ${{ runner.os }}-${{ matrix.runner }}-pip-${{ hashFiles('**/setup.py', '**/requirements.txt') }}
33-
restore-keys: |
34-
${{ runner.os }}-${{ matrix.runner }}-pip-
24+
cache: 'pip'
3525

3626
- name: Run Tests
3727
run: |
3828
python -m venv venv
3929
source venv/bin/activate
4030
pip install -e .[test]
41-
pytest tests/
31+
pytest tests

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[![Docs](https://github.com/chi-collective/genlm-backend/actions/workflows/docs.yml/badge.svg)](https://probcomp.github.io/genlm-backend/)
22
[![Tests](https://github.com/chi-collective/genlm-backend/actions/workflows/pytest.yml/badge.svg)](https://github.com/probcomp/genlm-backend/actions/workflows/pytest.yml)
3+
[![codecov](https://codecov.io/github/chi-collective/genlm-backend/graph/badge.svg?token=AS70lcuXra)](https://codecov.io/github/chi-collective/genlm-backend)
34

45
# GenLM Backend
56

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies = [
2020

2121
[project.optional-dependencies]
2222
test = [
23+
"coverage",
2324
"pytest",
2425
"pytest-benchmark",
2526
"arsenal @ git+https://github.com/timvieira/arsenal",

0 commit comments

Comments
 (0)