From 11eb4f62d00efd3e9a82d1d3a626649cb26b5a69 Mon Sep 17 00:00:00 2001 From: kieran-mackle Date: Sat, 6 Jul 2024 08:55:50 +1000 Subject: [PATCH 1/2] ci(coverage): generate coverage reports in tests workflow --- .github/workflows/tests.yml | 24 +++++- .gitignore | 144 +++++++++++++++++++++++++++++++++++- 2 files changed, 163 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0293ddc..31a7943 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,10 +19,32 @@ jobs: - name: Install packages run: | + git config --global url."https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github".insteadOf https://github python -m pip install --upgrade pip + pip install coverage-badge pip install pytest + pip install pytest-cov + pip install pytest-html pip install ./ - name: Test with pytest run: | - pytest tests + pytest --cov=hypervehicle --cov-report xml --cov-report html --html=pytest_report.html --self-contained-html tests/ + + - name: Generate coverage badge + run: | + coverage-badge -f -o coverage.svg + + - name: Clean up and organise + run: | + mkdir coverage + mv htmlcov/* coverage/ + mkdir deploy + mv coverage deploy/ + mv coverage.svg deploy/ + mv pytest_report.html deploy/ + + - name: Publish to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: deploy diff --git a/.gitignore b/.gitignore index bafd812..9c0eb7d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,147 @@ -# Pacakging -*egg-info/ +# Configs +*.model + +# IDE files +.idea + +# Byte-compiled / optimized / DLL files __pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +# htmlcov/ +# coverage.svg +# pytest_report.html +.tox/ +.nox/ .coverage -docs/build/ -testing* +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# IDE +.vscode # Miscellaneous +docs/build/ +testing* *.stl *.csv build/ From 8303c9e429003d3bf9dfc4f006ded02ee10e2807 Mon Sep 17 00:00:00 2001 From: kieran-mackle Date: Sat, 6 Jul 2024 09:03:10 +1000 Subject: [PATCH 2/2] docs(badges): added coverage badge with link to report --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8a3bf4b..0921faa 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,12 @@ Code style: black - - Test Status + + Test Status + + + + Test Coverage