1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00
Files
quay/.github/workflows/playwright-report-deploy.yaml
jbpratt 1bde727a49 chore(web): playwright ci improvements with caching/reporting (#4731)
* test(ci,web): add Playwright report deployment to Surge.sh

- Switch Playwright workflow to use large self-hosted runner
  (quay-001-large-ubuntu-24-x64) for faster execution
- Add new workflow to deploy HTML reports to Surge.sh
- Post PR comments with test status and link to full report
- Report accessible at quay-playwright-pr-{PR_NUMBER}.surge.sh
- Add cleanup workflow to teardown report on PR close

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore(ci): drop gha caching

it is slow and no tworking

Signed-off-by: Brady Pratt <bpratt@redhat.com>

* test(ci,web): cache Playwright browser binaries

Cache ~/.cache/ms-playwright between CI runs to avoid re-downloading
browsers on every workflow run. Cache key is based on Playwright
version from package-lock.json and auto-invalidates on version bumps.

On cache hit, only OS dependencies are installed (~45s).
On cache miss, full browser + deps install occurs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Brady Pratt <bpratt@redhat.com>

---------

Signed-off-by: Brady Pratt <bpratt@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-12-15 09:59:08 -05:00

105 lines
3.2 KiB
YAML

name: Playwright Report Deploy
on:
workflow_run:
workflows: ["Playwright E2E Tests"]
types:
- completed
jobs:
deploy:
name: Deploy Playwright Report to Surge
runs-on: ubuntu-22.04
# Only run on pull request events
if: github.event.workflow_run.event == 'pull_request'
permissions:
# Required to post comments on PRs
pull-requests: write
# Required for checkout
contents: read
steps:
- name: Download Playwright report artifact
uses: dawidd6/action-download-artifact@v8
with:
name: playwright-report
workflow: web-playwright-ci.yaml
run_id: ${{ github.event.workflow_run.id }}
path: ./playwright-report
- name: Download PR number
uses: dawidd6/action-download-artifact@v8
with:
name: pr-info
workflow: web-playwright-ci.yaml
run_id: ${{ github.event.workflow_run.id }}
path: ./pr-info
- name: Read PR number
id: pr
run: |
PR_NUMBER=$(cat pr-info/pr_number.txt)
echo "number=$PR_NUMBER" >> $GITHUB_OUTPUT
- name: Deploy to Surge
id: deploy
run: |
DEPLOY_DOMAIN="quay-playwright-pr-${{ steps.pr.outputs.number }}.surge.sh"
cd playwright-report
npx surge . $DEPLOY_DOMAIN --token ${{ secrets.SURGE_TOKEN }}
echo "url=https://$DEPLOY_DOMAIN" >> $GITHUB_OUTPUT
env:
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
- name: Comment PR with report URL
uses: actions/github-script@v8
with:
script: |
const reportUrl = '${{ steps.deploy.outputs.url }}';
const prNumber = ${{ steps.pr.outputs.number }};
const conclusion = '${{ github.event.workflow_run.conclusion }}';
const runUrl = '${{ github.event.workflow_run.html_url }}';
// Find existing comment
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
const botComment = comments.find(comment =>
comment.user.type === 'Bot' &&
comment.body.includes('Playwright Test Report')
);
const statusEmoji = conclusion === 'success' ? '✅' : '❌';
const statusText = conclusion === 'success' ? 'passed' : 'failed';
const commentBody = `## Playwright Test Report
${statusEmoji} **Tests ${statusText}**
📊 **[View Full Report](${reportUrl})**
🔗 [View Workflow Run](${runUrl})
_Report from commit ${{ github.event.workflow_run.head_sha }}_`;
if (botComment) {
// Update existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: commentBody
});
} else {
// Create new comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: commentBody
});
}