Recuring live test #43
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
name: Recuring live test | |
on: | |
schedule: | |
- cron: "0 12 */3 * *" | |
workflow_dispatch: | |
inputs: | |
app_url: | |
type: string | |
default: https://timezone.rocks | |
required: true | |
jobs: | |
e2e: | |
uses: ./.github/workflows/_test-e2e.yml | |
with: | |
APP_URL: ${{ inputs.app_url || 'https://timezone.rocks' }} | |
report: | |
runs-on: ubuntu-latest | |
needs: [e2e] | |
if: always() | |
steps: | |
- run: echo ${{ github.event_name}} | |
- uses: actions/download-artifact@v4 | |
with: | |
path: blob-report | |
pattern: e2e-blob-report-* | |
merge-multiple: true | |
- uses: oven-sh/setup-bun@v1 | |
- run: bunx playwright merge-reports --reporter line blob-report | tee report.txt | |
- run: echo failed=`cat report.txt | grep failed` >> "$GITHUB_OUTPUT" | |
id: status | |
- name: upload html report | |
id: report-upload | |
if: steps.status.outputs.failed | |
run: | | |
bunx playwright merge-reports --reporter html blob-report | |
bunx wrangler pages deploy playwright-report --project-name=timezone-rocks | tee deploy_out.txt | |
URL=`cat deploy_out.txt | grep -Eo "https://[^ ]*"` | |
echo url=$URL >> "$GITHUB_OUTPUT" | |
env: | |
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_PUBLISH_TOKEN }} | |
- name: Leave comment with the report | |
if: steps.status.outputs.failed && github.event_name == 'schedule' | |
run: | | |
echo "🚨 e2e test failed [report](${{ steps.report-upload.outputs.url }}) [run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) [app](${{ inputs.app_url || 'https://timezone.rocks' }})" >> body.txt | |
echo "\`\`\`" >> body.txt | |
cat report.txt | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" >> body.txt # remove colors | |
echo "\`\`\`" >> body.txt | |
gh issue comment 15 --body-file body.txt | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} |