From 210b570cb282dcaead7e75946b97b83a87b711a2 Mon Sep 17 00:00:00 2001 From: kieran-mackle Date: Sat, 6 Jul 2024 09:12:06 +1000 Subject: [PATCH] ci(coverage): add workflow and badges for test and coverage reports --- .github/workflows/tests.yml | 24 +++++++++++++++++++++++- README.md | 8 ++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 953f5e2..86d8740 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=pysagas --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/README.md b/README.md index b22df66..ea84012 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,12 @@ Code style: black - - Test Status + + Test Status + + + + Test Coverage