Skip to content

Commit d630a5c

Browse files
committed
code coverage
1 parent f1e64f0 commit d630a5c

1 file changed

Lines changed: 27 additions & 8 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,31 @@ jobs:
3030
python -m pip install flake8 pytest
3131
pip install -e .
3232
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
33-
# - name: Lint with flake8
34-
# run: |
35-
# # stop the build if there are Python syntax errors or undefined names
36-
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
37-
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
38-
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
39-
- name: Test with pytest
33+
- name: Lint with flake8
4034
run: |
41-
pytest
35+
# stop the build if there are Python syntax errors or undefined names
36+
#flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
37+
#exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
38+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
39+
- name: Test with pytest and coverage
40+
run: |
41+
coverage run -m pytest
42+
coverage report -m
43+
coverage report -m --fail-under=50 --skip-covered
44+
COVERAGE_PERCENT=$(coverage report -m --skip-covered | awk '/TOTAL/ { print $4 }' | sed 's/%$//' | awk '{ printf "%d\n", $1 }')
45+
echo "COVERAGE_PERCENT=${COVERAGE_PERCENT}" >> $GITHUB_ENV
46+
47+
- name: Save coverage report as an artifact
48+
uses: actions/upload-artifact@v2
49+
with:
50+
name: coverage-report
51+
path: coverage.xml
52+
53+
- name: Upload coverage reports to Codecov
54+
uses: codecov/codecov-action@v4.0.1
55+
with:
56+
token: ${{ secrets.CODECOV_TOKEN }}
57+
slug: Nance-Lab/diff_classifier
58+
59+
60+

0 commit comments

Comments
 (0)