Files
Timmy-time-dashboard/.github/workflows/tests.yml
Claude 7829536952 ci: mobile-friendly test results via GitHub Actions
Workflow upgrades:
- permissions: checks: write + pull-requests: write (required for annotations)
- pytest now outputs --junitxml=reports/junit.xml and --cov-report=xml
- EnricoMi/publish-unit-test-result-action@v2: posts a "pytest results"
  check annotation AND a PR comment showing pass/fail counts with
  per-test breakdown — both visible in the GitHub mobile app
- actions/upload-artifact@v4: uploads coverage.xml (14-day retention)
  browsable from the Actions tab on mobile

README:
- Live test badge at the top (green/red, links to Actions run history)

.gitignore:
- Add reports/ so generated junit.xml + coverage.xml are never committed

https://claude.ai/code/session_01M4L3R98N5fgXFZRvV8X9b6
2026-02-19 19:41:01 +00:00

58 lines
1.5 KiB
YAML

name: Tests
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
jobs:
test:
runs-on: ubuntu-latest
# Required for publish-unit-test-result-action to post check runs and PR comments
permissions:
contents: read
checks: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Run tests
run: |
pytest \
--tb=short \
--cov=src \
--cov-report=term-missing \
--cov-report=xml:reports/coverage.xml \
--junitxml=reports/junit.xml
# Posts a check annotation + PR comment showing pass/fail counts.
# Visible in the GitHub mobile app under Checks and in PR conversations.
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: reports/junit.xml
check_name: "pytest results"
comment_title: "Test Results"
report_individual_runs: true
# Coverage report available as a downloadable artifact in the Actions tab
- name: Upload coverage report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: reports/coverage.xml
retention-days: 14