Skip to content

Commit 7af66a0

Browse files
committed
ci(action): add pytest job
1 parent 35450c1 commit 7af66a0

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

.github/workflows/pipeline.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,46 @@ jobs:
4444
folder: badges/
4545
clean: false
4646

47+
pytest:
48+
name: Pytest Tests
49+
runs-on: ubuntu-latest
50+
strategy:
51+
matrix:
52+
python-version: [ "3.11", "3.12", "3.13" ]
53+
fail-fast: false
54+
steps:
55+
- name: Check out repository
56+
uses: actions/checkout@v4
57+
- name: Install UV
58+
uses: astral-sh/setup-uv@v4
59+
with:
60+
python-version: ${{ matrix.python-version }}
61+
- name: Set up Python
62+
run: uv python install
63+
- name: Install the project
64+
run: uv sync --dev
65+
- name: Run Pytest
66+
id: pytest
67+
run: |
68+
uv run coverage run -m pytest tests/
69+
- name: Generate Badges
70+
if: success() || failure()
71+
run: |
72+
uv run coverage report
73+
mkdir -p badges/
74+
uv run anybadge --overwrite --value="${{ steps.pytest.outcome }}" --label=pytest --file=badges/pytest.svg success=green failure=red
75+
uv run anybadge --overwrite --value="$(uv run coverage report --format=total)" --file=badges/coverage.svg coverage
76+
- name: Publish badges to GitHub Pages
77+
if: (success() || failure()) && (github.ref_name == github.event.repository.default_branch)
78+
uses: JamesIves/github-pages-deploy-action@v4
79+
with:
80+
folder: badges/
81+
clean: false
82+
4783
pypi-publish:
4884
name: Upload release to PyPI
4985
runs-on: ubuntu-latest
50-
needs: [ ruff ]
86+
needs: [ ruff, pytest ]
5187
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
5288
environment:
5389
name: pypi

0 commit comments

Comments
 (0)