diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 00000000..4ac79bc4 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,23 @@ +name: Codecov Action + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + name: Test python API + steps: + - uses: actions/checkout@v1 + - name: Install requirements + run: | + pip install -r requirements-tests.txt + pip install -r requirements-dev.txt + - name: Run tests and collect coverage + run: make coverage-tests + - name: Upload coverage reports to Codecov + run: | + # Replace `linux` below with the appropriate OS + # Options are `alpine`, `linux`, `macos`, `windows` + curl -Os https://uploader.codecov.io/latest/linux/codecov + chmod +x codecov + ./codecov -t ${CODECOV_TOKEN} diff --git a/Makefile b/Makefile index ff1bdda5..73001e3c 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,11 @@ tests: PYTHONPATH=$(CWD)/src:$(CWD)/tests/plugins1:$(CWD)/tests/plugins2:${PYTHONPATH} \ ${PYTHON} -m pytest -v $(TESTARGS) +.PHONY: coverage-tests +coverage-tests: + PYTHONPATH=$(CWD)/src:$(CWD)/tests/plugins1:$(CWD)/tests/plugins2:${PYTHONPATH} \ + ${PYTHON} -m pytest -v --cov $(TESTARGS) + .PHONY: verbose-tests verbose-tests: PYTHONPATH=$(CWD)/src:$(CWD)/tests/plugins1:$(CWD)/tests/plugins2:${PYTHONPATH} \ diff --git a/requirements-tests.txt b/requirements-tests.txt index f7d5316f..06b481f3 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -5,3 +5,4 @@ pytest >= 6.2.0 requests >= 2.25.1 +pytest-cov \ No newline at end of file