Bump vitest from 2.1.9 to 4.1.1 in /vitest-example #41
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: pytest Tests | |
| on: | |
| schedule: | |
| - cron: '0 6 * * *' # Run daily at 6:00 AM UTC | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| defaults: | |
| run: | |
| working-directory: pytest-example | |
| jobs: | |
| test: | |
| name: pytest HTML Report | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| cache-dependency-path: pytest-example/requirements.txt | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| - name: Create reports directory | |
| run: mkdir -p reports | |
| - name: Run tests with HTML output and coverage | |
| run: | | |
| pytest \ | |
| --html=reports/pytest-report.html \ | |
| --self-contained-html \ | |
| --cov=src \ | |
| --cov-report=xml:reports/coverage.xml \ | |
| --cov-report=html:reports/htmlcov | |
| continue-on-error: true | |
| # Upload via GitHub Action (recommended) | |
| # Skip on Dependabot PRs (no access to secrets) | |
| - name: Upload pytest HTML to Gaffer | |
| if: always() && github.actor != 'dependabot[bot]' | |
| uses: gaffer-sh/gaffer-uploader@v0.4.0 | |
| with: | |
| gaffer_upload_token: ${{ secrets.GAFFER_UPLOAD_TOKEN }} | |
| report_path: pytest-example/reports/pytest-report.html | |
| commit_sha: ${{ github.event.pull_request.head.sha || github.sha }} | |
| branch: ${{ github.head_ref || github.ref_name }} | |
| test_framework: pytest | |
| test_suite: pytest-html | |
| # Upload Cobertura coverage report | |
| - name: Upload coverage to Gaffer | |
| if: always() && github.actor != 'dependabot[bot]' | |
| uses: gaffer-sh/gaffer-uploader@v0.4.0 | |
| with: | |
| gaffer_upload_token: ${{ secrets.GAFFER_UPLOAD_TOKEN }} | |
| report_path: pytest-example/reports/coverage.xml | |
| commit_sha: ${{ github.event.pull_request.head.sha || github.sha }} | |
| branch: ${{ github.head_ref || github.ref_name }} | |
| test_framework: pytest | |
| test_suite: pytest-coverage | |
| # Alternative: Upload via curl (for documentation/reference) | |
| # - name: Upload via curl (example) | |
| # if: always() && github.actor != 'dependabot[bot]' | |
| # continue-on-error: true | |
| # env: | |
| # GAFFER_UPLOAD_TOKEN: ${{ secrets.GAFFER_UPLOAD_TOKEN }} | |
| # run: | | |
| # curl -X POST https://app.gaffer.sh/api/upload \ | |
| # -H "X-API-Key: $GAFFER_UPLOAD_TOKEN" \ | |
| # -F "files=@reports/pytest-report.html" \ | |
| # -F "commit_sha=${{ github.sha }}" \ | |
| # -F "branch=${{ github.ref_name }}" \ | |
| # -F "test_framework=pytest" \ | |
| # -F "test_suite=curl-example" | |
| # Store artifacts for parser development | |
| - name: Upload test artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pytest-reports-${{ github.sha }} | |
| path: pytest-example/reports/ | |
| retention-days: 7 |