-
Notifications
You must be signed in to change notification settings - Fork 204
feat: enhance GHA to publish reports to GH pages #2552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
55dc5b2
3899c43
fc73120
759a0be
eda2c12
9fb630d
83035db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,6 +6,8 @@ permissions: | |||||||||||||||
| checks: write | ||||||||||||||||
| pull-requests: write | ||||||||||||||||
| contents: write | ||||||||||||||||
| pages: write | ||||||||||||||||
| id-token: write | ||||||||||||||||
| concurrency: | ||||||||||||||||
| group: ${{ github.workflow }}-${{ github.ref }} | ||||||||||||||||
| cancel-in-progress: true | ||||||||||||||||
|
|
@@ -153,8 +155,72 @@ jobs: | |||||||||||||||
| path: playwright-report | ||||||||||||||||
| retention-days: 2 | ||||||||||||||||
|
|
||||||||||||||||
| publish-report: | ||||||||||||||||
| if: ${{ !cancelled() && github.event_name != 'pull_request' }} | ||||||||||||||||
| needs: [merge-reports] | ||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||
| outputs: | ||||||||||||||||
| page_url: ${{ steps.set-url.outputs.page_url }} | ||||||||||||||||
| environment: | ||||||||||||||||
| name: github-pages | ||||||||||||||||
| url: ${{ steps.deployment.outputs.page_url }} | ||||||||||||||||
| steps: | ||||||||||||||||
| - uses: actions/checkout@v4 | ||||||||||||||||
| - name: Download HTML report | ||||||||||||||||
| uses: actions/download-artifact@v4 | ||||||||||||||||
| with: | ||||||||||||||||
| name: html-report--attempt-${{ github.run_attempt }} | ||||||||||||||||
| path: playwright-report | ||||||||||||||||
| - name: Determine report destination | ||||||||||||||||
| id: report-dest | ||||||||||||||||
| run: | | ||||||||||||||||
| if [ "${{ github.event_name }}" = "pull_request" ]; then | ||||||||||||||||
| DEST_DIR="${{ github.event.pull_request.number }}" | ||||||||||||||||
| else | ||||||||||||||||
| DEST_DIR="${{ github.run_id }}" | ||||||||||||||||
| fi | ||||||||||||||||
| echo "destination=$DEST_DIR" >> "$GITHUB_OUTPUT" | ||||||||||||||||
| echo "Report will be published to: $DEST_DIR" | ||||||||||||||||
| - name: Prepare report for Pages | ||||||||||||||||
| run: | | ||||||||||||||||
| mkdir -p pages-artifact/${{ steps.report-dest.outputs.destination }} | ||||||||||||||||
| cp -r playwright-report/* pages-artifact/${{ steps.report-dest.outputs.destination }}/ | ||||||||||||||||
| - name: Setup Pages | ||||||||||||||||
| uses: actions/configure-pages@v5 | ||||||||||||||||
| - name: Upload artifact | ||||||||||||||||
| uses: actions/upload-pages-artifact@v3 | ||||||||||||||||
| with: | ||||||||||||||||
| path: ./pages-artifact | ||||||||||||||||
| - name: Deploy to GitHub Pages | ||||||||||||||||
| id: deployment | ||||||||||||||||
| uses: actions/deploy-pages@v4 | ||||||||||||||||
| - name: Set page URL | ||||||||||||||||
| id: set-url | ||||||||||||||||
| run: | | ||||||||||||||||
| if [ "${{ github.event_name }}" = "pull_request" ]; then | ||||||||||||||||
| REPORT_PATH="${{ github.event.pull_request.number }}" | ||||||||||||||||
| else | ||||||||||||||||
| REPORT_PATH="${{ github.run_id }}" | ||||||||||||||||
| fi | ||||||||||||||||
| PAGE_URL="https://jumperexchange.github.io/jumper-exchange/${REPORT_PATH}/" | ||||||||||||||||
| echo "page_url=$PAGE_URL" >> "$GITHUB_OUTPUT" | ||||||||||||||||
| echo "Report URL: $PAGE_URL" | ||||||||||||||||
| - name: Add report link to summary | ||||||||||||||||
| if: always() | ||||||||||||||||
| run: | | ||||||||||||||||
| if [ "${{ github.event_name }}" = "pull_request" ]; then | ||||||||||||||||
| REPORT_PATH="${{ github.event.pull_request.number }}" | ||||||||||||||||
| else | ||||||||||||||||
| REPORT_PATH="${{ github.run_id }}" | ||||||||||||||||
| fi | ||||||||||||||||
| PAGES_URL="https://jumperexchange.github.io/jumper-exchange/${REPORT_PATH}/" | ||||||||||||||||
| echo "## 📊 Playwright Test Report" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||
| echo "" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||
| echo "🔗 **[View Report](${PAGES_URL})**" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||
| echo "" >> $GITHUB_STEP_SUMMARY | ||||||||||||||||
|
|
||||||||||||||||
| post-comment: | ||||||||||||||||
| needs: [create-qase-run, merge-reports] | ||||||||||||||||
| needs: [create-qase-run, merge-reports, publish-report] | ||||||||||||||||
| if: ${{ !cancelled() && github.event_name == 'pull_request' }} | ||||||||||||||||
|
Comment on lines
222
to
224
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Post-comment will be skipped on PRs due to skipped dependency.
🔧 Suggested fix (remove unnecessary dependency) post-comment:
- needs: [create-qase-run, merge-reports, publish-report]
+ needs: [create-qase-run, merge-reports]
if: ${{ !cancelled() && github.event_name == 'pull_request' }}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||
| steps: | ||||||||||||||||
|
|
@@ -164,3 +230,5 @@ jobs: | |||||||||||||||
| ${{ needs.merge-reports.outputs.summary }} | ||||||||||||||||
|
|
||||||||||||||||
| ${{ needs.create-qase-run.outputs.public_link != '' && needs.create-qase-run.outputs.public_link != null && format('📋 [View Detailed Qase Report]({0})', needs.create-qase-run.outputs.public_link) || '' }} | ||||||||||||||||
|
|
||||||||||||||||
| 📊 [Download HTML Test Report](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) - Available in the workflow artifacts | ||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
always()may add broken links if deployment fails.Using
if: always()means this step runs even whenDeploy to GitHub Pagesfails, potentially adding a broken link to the summary. Consider conditioning on deployment success:🔧 Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents