From 22ca923e56292f3603bb3076e9c56a1d521c2da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Scott=20Carroll=20=F0=9F=90=99?= Date: Wed, 12 Jun 2024 14:30:27 -0400 Subject: [PATCH] Update github actions to produce a coverage report and attach it to the run --- .github/workflows/python-package.yml | 17 ++++++++++++++--- .gitignore | 2 ++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 744e9d54..f94cc558 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -27,11 +27,22 @@ jobs: run: | python -m pip install --upgrade pip python -m pip install flake8 pytest + python -m pip install coverage if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint with flake8 run: | # 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 - run: | - pytest test + - name: Run tests with pytest, calculating coverage + run: coverage run --source=pymdp -m pytest test/ + - name: Generate coverage HTML report + run: coverage html + # expect actions/upload-artifact@v4 to fail when run locally with `act` + - name: Upload coverage HTML report for pymdp as a build artifact + uses: actions/upload-artifact@v4 + with: + name: pymdp-${{ matrix.python-version }}--coverage-report + path: htmlcov/ + retention-days: 30 + - name: Print coverage report to console + run: coverage report \ No newline at end of file diff --git a/.gitignore b/.gitignore index 698fb8ad..61051a2a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ __pycache__ env/ pymdp.egg-info inferactively_pymdp.egg-info +htmlcov +.coverage