write coverage report (fix CI badge generation) #503
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
branches: [ main ] | |
push: | |
branches: [ main ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
environment: 'Test CI' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.7.1 python3 - | |
- name: Install dependencies | |
run: poetry install --all-extras | |
- name: Run tests and generate coverage report | |
run: | | |
poetry run coverage run -m pytest test --ignore=./volumes | |
poetry run coverage report | |
poetry run coverage xml | |
shell: bash | |
- name: Generate coverage badge | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.event.action == 'closed' && github.base_ref == 'refs/heads/main' && github.event.pull_request.merged == true) | |
run: poetry run coverage-badge -f -o docs/coverage/coverage.svg | |
shell: bash | |
- name: Commit changes | |
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.event.action == 'closed' && github.base_ref == 'refs/heads/main' && github.event.pull_request.merged == true) | |
uses: s0/git-publish-subdir-action@develop | |
env: | |
REPO: self | |
BRANCH: coverage | |
FOLDER: docs/coverage | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |