Update coverage badge in README.md #12
This file contains hidden or 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: Tests | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| # Necessary for the workflow to push changes back to the repo | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| # Fetches all history so the push doesn't fail on a shallow clone | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install package | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| pip install -e .[dev] | |
| - name: Run tests with coverage | |
| run: | | |
| pytest --cov=pome \ | |
| --cov-report=json:coverage.json | |
| - name: Generate coverage badge | |
| # Only generate the badge on the default branch | |
| if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
| uses: we-cli/coverage-badge-action@main | |
| - name: Commit and push coverage badge | |
| # Only push the badge on the default branch | |
| if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: "chore: update coverage badge [skip ci]" | |
| file_pattern: 'coverage.svg' | |
| # Prevents the action from failing if coverage hasn't changed | |
| skip_dirty_check: false |