Improve testing coverage and perform some routine tasks #32
Workflow file for this run
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: Test & Coverage | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| test: | |
| name: Test | |
| if: ${{ ! startsWith(github.head_ref, 'release-please--branches--') }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: pyproject.toml | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "pyproject.toml" | |
| - name: Install dependencies | |
| run: uv sync --dev | |
| - name: Run pytest with coverage | |
| run: uv run pytest -v --cov=app --cov-report=term-missing --cov-report=xml --cov-report=html --junit-xml=test-results.xml tests/ | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-results | |
| path: test-results.xml | |
| - name: Upload coverage reports | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: | | |
| coverage.xml | |
| htmlcov/ | |
| - name: Surface test results | |
| if: always() | |
| uses: pmeier/pytest-results-action@main | |
| with: | |
| path: test-results.xml | |
| summary: true | |
| display-options: fEX | |
| fail-on-empty: true | |
| - name: Coverage comment | |
| if: github.event_name == 'pull_request' | |
| uses: py-cov-action/python-coverage-comment-action@v3 | |
| with: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| MINIMUM_GREEN: 80 | |
| MINIMUM_ORANGE: 60 | |
| # Summary job | |
| summary: | |
| name: Test Summary | |
| runs-on: ubuntu-latest | |
| needs: [test] | |
| if: ${{ always() && ! startsWith(github.head_ref, 'release-please--branches--') }} | |
| steps: | |
| - name: Summary | |
| run: | | |
| echo "## Test Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "[OK] All tests completed successfully!" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Platform" >> $GITHUB_STEP_SUMMARY | |
| echo "- [OK] Ubuntu" >> $GITHUB_STEP_SUMMARY |