From d630a5cad0557ea2ed49b1bd6e2dc23e26fa3571 Mon Sep 17 00:00:00 2001 From: Nels Schimek Date: Thu, 18 Apr 2024 17:33:42 -0700 Subject: [PATCH] code coverage --- .github/workflows/python-package.yml | 35 +++++++++++++++++++++------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 524134c..27295d3 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -30,12 +30,31 @@ jobs: python -m pip install flake8 pytest pip install -e . if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - # - name: Lint with flake8 - # run: | - # # stop the build if there are Python syntax errors or undefined names - # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest + - name: Lint with flake8 run: | - pytest + # stop the build if there are Python syntax errors or undefined names + #flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + #exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest and coverage + run: | + coverage run -m pytest + coverage report -m + coverage report -m --fail-under=50 --skip-covered + COVERAGE_PERCENT=$(coverage report -m --skip-covered | awk '/TOTAL/ { print $4 }' | sed 's/%$//' | awk '{ printf "%d\n", $1 }') + echo "COVERAGE_PERCENT=${COVERAGE_PERCENT}" >> $GITHUB_ENV + + - name: Save coverage report as an artifact + uses: actions/upload-artifact@v2 + with: + name: coverage-report + path: coverage.xml + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: Nance-Lab/diff_classifier + + +