diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 8370c38..8350705 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -27,9 +27,21 @@ jobs: run: | sudo apt-get update python -m pip install --upgrade pip - python -m pip install pytest + python -m pip install pytest coverage python setup.py install - name: Test with pytest run: | pytest -s ./tests/ + + - name: Run coverage + run: | + coverage run --source study_lyte -m pytest + coverage json + + # Add this + - name: Update Coverage Badge + # GitHub actions: default branch variable + # https://stackoverflow.com/questions/64781462/github-actions-default-branch-variable + if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) + uses: we-cli/coverage-badge-action@main \ No newline at end of file diff --git a/README.rst b/README.rst index dbb665b..ed9798d 100644 --- a/README.rst +++ b/README.rst @@ -13,6 +13,8 @@ Study Lyte .. image:: https://github.com/AdventureData/study_lyte/actions/workflows/build.yml/badge.svg :target: https://github.com/AdventureData/study_lyte/actions/workflows/build.yml +.. image:: https://github.com/AdventureData/study_lyte/badges/coverage.svg + :target: https://github.com/AdventureData/study_lyte/actions/workflows/testing.yml Welcome to Adventure Data's python package for doing analysis with data from the Lyte Probe. The Lyte probe is a smart ski pole designed to measure snow. It measures NIR and Force simulataneously along with diff --git a/requirements_dev.txt b/requirements_dev.txt index 9e60be0..077554a 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -11,4 +11,4 @@ jupyterlab==3.6.1 pytest==6.2.4 matplotlib nbconvert - +coverage