Skip to content

Commit 5e25106

Browse files
authored
Simplify coverage badge creation.
1 parent 030e866 commit 5e25106

1 file changed

Lines changed: 10 additions & 17 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,44 +8,37 @@ on:
88
jobs:
99
test:
1010
runs-on: ubuntu-latest
11-
12-
# Necessary for the workflow to push changes back to the repo
1311
permissions:
1412
contents: write
1513

1614
steps:
17-
- name: Checkout repository
18-
uses: actions/checkout@v4
15+
- uses: actions/checkout@v4
1916
with:
20-
# Fetches all history so the push doesn't fail on a shallow clone
2117
fetch-depth: 0
2218

23-
- name: Set up Python
24-
uses: actions/setup-python@v5
19+
- uses: actions/setup-python@v5
2520
with:
2621
python-version: "3.11"
2722

28-
- name: Install package
23+
- name: Install dependencies
2924
run: |
30-
python -m pip install --upgrade pip setuptools wheel
25+
python -m pip install --upgrade pip
3126
pip install -e .[dev]
27+
pip install coverage-badge # Simple tool to make the SVG
3228
3329
- name: Run tests with coverage
3430
run: |
35-
pytest --cov=pome \
36-
--cov-report=json:coverage.json
31+
pytest --cov=pome
3732
38-
- name: Generate coverage badge
39-
# Only generate the badge on the default branch
33+
- name: Generate Badge File
4034
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
41-
uses: we-cli/coverage-badge-action@main
35+
run: |
36+
# This creates 'coverage.svg' in your root folder
37+
coverage-badge -o coverage.svg -f
4238
4339
- name: Commit and push coverage badge
44-
# Only push the badge on the default branch
4540
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
4641
uses: stefanzweifel/git-auto-commit-action@v5
4742
with:
4843
commit_message: "chore: update coverage badge [skip ci]"
4944
file_pattern: 'coverage.svg'
50-
# Prevents the action from failing if coverage hasn't changed
51-
skip_dirty_check: false

0 commit comments

Comments
 (0)