Skip to content

.github/workflows/cron.yml #812

.github/workflows/cron.yml

.github/workflows/cron.yml #812

Workflow file for this run

name: Cron
on:
schedule:
# should run every 3hrs on weekdays
- cron: "0 */3 * * 1-5"
# for testing purposes (this will run every 5mins everyday)
# - cron: "*/5 * * * *"
jobs:
notify:
# run slack-notifier workflow
uses: ./.github/workflows/call-slack-notifier.yml
with:
message: Starting scheduled Playwright e2e tests run...
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
test:
name: Run tests
uses: ./.github/workflows/call-run-tests.yml
publish_report:
name: Publish HTML Report
# using always() is not ideal here, because it would also run if the workflow was cancelled
if: "success() || needs.test.result == 'failure'"
needs: [test]
runs-on: ubuntu-latest
continue-on-error: true
env:
REPO_URL: internetarchive.github.io/archiveorg-e2e-playwright
# Unique URL path for each workflow run attempt
REPORT_URL_PATH: reports/${{ github.ref_name }}/${{ github.run_id }}/${{ github.run_attempt }}
steps:
- name: Checkout GitHub Pages Branch
uses: actions/checkout@v3
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@v3
with:
name: playwright-report
path: ${{ inputs.reportURL }}
- 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 Worfklow Annotation
run: |
# FULL_HTML_REPORT_URL=https://${{ env.REPO_URL }}/${{ env.REPORT_URL_PATH }}
FULL_HTML_REPORT_URL=https://${{ env.REPO_URL }}
echo "::notice title=📋 Published Playwright Test Report::$FULL_HTML_REPORT_URL"
- name: Publish notifications to slack channel
uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#git-e2e-tests'
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
message: Playwright report page - https://${{ env.REPO_URL }}
if: always()