diff --git a/.github/workflows/libraries_compile-examples.yml b/.github/workflows/libraries_compile-examples.yml index fd71037..fcdaae5 100644 --- a/.github/workflows/libraries_compile-examples.yml +++ b/.github/workflows/libraries_compile-examples.yml @@ -35,7 +35,14 @@ jobs: pip install --quiet pep8-naming flake8 --config "$GITHUB_WORKSPACE/libraries/compile-examples/compilesketches/.flake8" --show-source "$GITHUB_WORKSPACE/libraries/compile-examples/compilesketches" - - name: Run Python unit tests + - name: Run Python unit tests and report code coverage run: | export PYTHONPATH="$GITHUB_WORKSPACE/libraries/compile-examples/compilesketches" - pytest "$GITHUB_WORKSPACE/libraries/compile-examples/compilesketches/tests" + coverage run --source="$GITHUB_WORKSPACE/libraries/compile-examples/compilesketches" --module pytest "$GITHUB_WORKSPACE/libraries/compile-examples/compilesketches/tests" + # Display code coverage report in workflow run log + coverage report + + - name: Upload coverage report to Codecov + uses: codecov/codecov-action@v1 + with: + fail_ci_if_error: true diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..59057f5 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,6 @@ +coverage: + range: "100...100" + status: + project: + default: + threshold: 0% diff --git a/compilesketches/tests/requirements.txt b/compilesketches/tests/requirements.txt index b5e143e..958c80f 100644 --- a/compilesketches/tests/requirements.txt +++ b/compilesketches/tests/requirements.txt @@ -1,3 +1,4 @@ --requirement ../requirements.txt +coverage==5.2.1 pytest==5.4.2 pytest-mock==3.1.0