Test #209
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
| # Test workflow — runs the full Playwright suite and deploys reports to GitHub Pages. | |
| # | |
| # IMPORTANT: GitHub Pages deploys the entire site as one atomic artifact. | |
| # There is no way to deploy just a subdirectory. This means both this workflow | |
| # and the Docs workflow must assemble the COMPLETE site (docs + reports) to | |
| # avoid overwriting each other. This workflow builds VitePress docs alongside | |
| # the test reports so the documentation is preserved when reports are deployed. | |
| name: Test | |
| on: | |
| workflow_run: | |
| workflows: [Smoke] | |
| types: [completed] | |
| branches: [main] | |
| schedule: | |
| - cron: "0 5 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| issues: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: test-${{ github.event.workflow_run.head_branch || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| if: >- | |
| github.event_name != 'workflow_run' || | |
| github.event.workflow_run.conclusion == 'success' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: pnpm/action-setup@v6 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm exec playwright install --with-deps chromium firefox webkit | |
| - name: Run tests | |
| run: pnpm test | |
| env: | |
| CI: true | |
| - name: Upload test results | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-results | |
| path: | | |
| test-results/ | |
| playwright-report/ | |
| retention-days: 14 | |
| - name: Upload JUnit report | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: junit-report | |
| path: test-results/junit.xml | |
| retention-days: 14 | |
| - name: Fetch Allure history from GitHub Pages | |
| if: ${{ !cancelled() }} | |
| continue-on-error: true | |
| run: | | |
| curl -fsSL "https://hal.github.io/dave/reports/allure/history.jsonl" -o history.jsonl || true | |
| - name: Generate Allure report | |
| if: ${{ !cancelled() }} | |
| run: npx allure awesome allure-results --output allure-report --history-path history.jsonl | |
| - name: Update Allure history | |
| if: ${{ !cancelled() }} | |
| run: npx allure history allure-results --history-path history.jsonl --history-limit 50 | |
| # Build VitePress docs so they are included in the Pages deployment. | |
| # GitHub Pages is an atomic deployment — we must include everything | |
| # (docs + reports) in every deploy to avoid overwriting the other. | |
| - name: Build docs | |
| if: ${{ !cancelled() }} | |
| run: pnpm docs:build | |
| - name: Assemble GitHub Pages site | |
| if: ${{ !cancelled() }} | |
| run: | | |
| mkdir -p pages-root/reports | |
| # Use VitePress build output as the site root | |
| cp -r docs/.vitepress/dist/* pages-root/ | |
| # Add fresh test reports | |
| cp -r allure-report pages-root/reports/allure | |
| cp -r playwright-report pages-root/reports/playwright | |
| cp -f history.jsonl pages-root/reports/allure/history.jsonl || true | |
| - name: Upload Pages artifact | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: pages-root/ | |
| notify-failure: | |
| if: ${{ !cancelled() && needs.test.result == 'failure' }} | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check for existing issue | |
| id: check | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| existing=$(gh issue list --repo "${{ github.repository }}" \ | |
| --label "test-failure" --state open --limit 1 --json number --jq '.[0].number // empty') | |
| echo "exists=${existing}" >> "$GITHUB_OUTPUT" | |
| - name: Create failure issue | |
| if: steps.check.outputs.exists == '' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh issue create --repo "${{ github.repository }}" \ | |
| --title "Test workflow failure ($(date -u +%Y-%m-%d))" \ | |
| --label "test-failure" \ | |
| --body "$(cat <<'EOF' | |
| The [Test workflow](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) failed. | |
| **Trigger:** ${{ github.event_name }} | |
| **Branch:** ${{ github.ref_name }} | |
| Please investigate the failing tests. | |
| EOF | |
| )" | |
| deploy-report: | |
| if: ${{ !cancelled() && needs.test.result != 'skipped' }} | |
| needs: test | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |