-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: e2e reports in gh-pages (#16179)
- Loading branch information
Showing
9 changed files
with
220 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Delete | ||
|
||
on: | ||
delete: | ||
branches-ignore: [main, gh-pages] | ||
|
||
# ensures that currently running Playwright workflow of deleted branch gets cancelled | ||
concurrency: | ||
group: ${{ github.event.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
delete_reports: | ||
name: Delete Reports | ||
runs-on: ubuntu-latest | ||
env: | ||
# Contains all reports for deleted branch | ||
BRANCH_REPORTS_DIR: reports/${{ github.event.ref }} | ||
steps: | ||
- name: Checkout GitHub Pages Branch | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: gh-pages | ||
- name: Set Git User | ||
# see: https://github.com/actions/checkout/issues/13#issuecomment-724415212 | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
- name: Check for workflow reports | ||
run: | | ||
if [ -z "$(ls -A $BRANCH_REPORTS_DIR)" ]; then | ||
echo "BRANCH_REPORTS_EXIST="false"" >> $GITHUB_ENV | ||
else | ||
echo "BRANCH_REPORTS_EXIST="true"" >> $GITHUB_ENV | ||
fi | ||
- name: Delete reports from repo for branch | ||
if: ${{ env.BRANCH_REPORTS_EXIST == 'true' }} | ||
timeout-minutes: 3 | ||
run: | | ||
cd $BRANCH_REPORTS_DIR/.. | ||
rm -rf ${{ github.event.ref }} | ||
git add . | ||
git commit -m "workflow: remove all reports for branch ${{ github.event.ref }}" | ||
while true; do | ||
git pull --rebase | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to rebase. Please review manually." | ||
exit 1 | ||
fi | ||
git push | ||
if [ $? -eq 0 ]; then | ||
echo "Successfully pushed HTML reports to repo." | ||
exit 0 | ||
fi | ||
done |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# https://playwright.dev/docs/test-sharding#merging-reports-from-multiple-shards | ||
on: | ||
workflow_call: | ||
jobs: | ||
merge-reports: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/dangerous-git-checkout | ||
- uses: ./.github/actions/yarn-install | ||
- uses: ./.github/actions/yarn-playwright-install | ||
- name: Download blob reports from GitHub Actions Artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: all-blob-reports | ||
pattern: blob-report-* | ||
merge-multiple: true | ||
- name: Merge into HTML Report | ||
run: yarn playwright merge-reports --reporter html ./all-blob-reports | ||
- name: Upload HTML report | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: html-report--attempt-${{ github.run_number }}-${{ github.run_attempt }} | ||
path: playwright-report | ||
retention-days: 14 |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
on: | ||
workflow_call: | ||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
jobs: | ||
publish-report: | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
env: | ||
# Unique URL path for each workflow run attempt | ||
HTML_REPORT_URL_PATH: reports/${{ github.ref_name }}/${{ github.run_id }}/${{ github.run_attempt }} | ||
steps: | ||
- name: Checkout GitHub Pages Branch | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: gh-pages | ||
- name: Set Git User | ||
# see: https://github.com/actions/checkout/issues/13#issuecomment-724415212 | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
- name: Download zipped HTML report | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: html-report--attempt-${{ github.run_number }}-${{ github.run_attempt }} | ||
path: ${{ env.HTML_REPORT_URL_PATH }} | ||
- name: Push HTML Report | ||
timeout-minutes: 3 | ||
# commit report, then try push-rebase-loop until it's able to merge the HTML report to the gh-pages branch | ||
# this is necessary when this job running at least twice at the same time (e.g. through two pushes at the same time) | ||
run: | | ||
git add . | ||
git commit -m "workflow: add HTML report for run-id ${{ github.run_id }} (attempt: ${{ github.run_attempt }})" | ||
while true; do | ||
git pull --rebase | ||
if [ $? -ne 0 ]; then | ||
echo "Failed to rebase. Please review manually." | ||
exit 1 | ||
fi | ||
git push | ||
if [ $? -eq 0 ]; then | ||
echo "Successfully pushed HTML report to repo." | ||
exit 0 | ||
fi | ||
done | ||
- name: Output Report URL as Workflow Annotation | ||
id: url | ||
run: | | ||
FULL_HTML_REPORT_URL=https://calcom.github.io/cal.com/$HTML_REPORT_URL_PATH | ||
echo "::notice title=📋 Published Playwright Test Report::$FULL_HTML_REPORT_URL" | ||
echo "link=$FULL_HTML_REPORT_URL" >> $GITHUB_OUTPUT | ||
- name: Find Comment | ||
uses: peter-evans/find-comment@v2 | ||
id: fc | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: "github-actions[bot]" | ||
body-includes: <!-- GENERATED-E2E-RESULTS --> | ||
- name: Create comment | ||
if: steps.fc.outputs.comment-id == '' | ||
uses: peter-evans/create-or-update-comment@v3 | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
<!-- GENERATED-E2E-RESULTS --> | ||
## E2E results are ready! | ||
- [Attempt #${{ github.run_number }}.${{ github.run_attempt }} results](${{ steps.url.outputs.link }}) | ||
- name: Update comment | ||
if: steps.fc.outputs.comment-id != '' | ||
uses: peter-evans/create-or-update-comment@v3 | ||
with: | ||
comment-id: ${{ steps.fc.outputs.comment-id }} | ||
body: | | ||
- [Attempt #${{ github.run_number }}.${{ github.run_attempt }} results](${{ steps.url.outputs.link }}) |
This file contains 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
This file contains 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