Skip to content

Commit

Permalink
👷
Browse files Browse the repository at this point in the history
  • Loading branch information
Platane committed Mar 16, 2024
1 parent eb4243c commit 41b5244
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 11 deletions.
51 changes: 44 additions & 7 deletions .github/workflows/_test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,25 @@ on:
APP_URL:
type: string
required: true
outputs:
report_url:
description: "Url to the uploaded html report"
value: ${{ jobs.collect-report.outputs.report_url }}
secrets:
CLOUDFLARE_ACCOUNT_ID:
CLOUDFLARE_PUBLISH_TOKEN:

jobs:
e2e:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
shard: ["1/1"]
browser: [chromium]
# browser: [chromium, firefox, webkit]
browser: [chromium]
shardIndex: [1]
env:
shardTotal: 1
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
Expand All @@ -39,15 +48,43 @@ jobs:
- run: |
bunx playwright test \
--project ${{ matrix.browser }} \
--shard ${{ matrix.shard }} \
--reporter github \
--shard ${{ matrix.shardIndex }}/${{ env.shardTotal }} \
--reporter github,blob \
--forbid-only \
--workers 1
working-directory: packages/e2e
env:
APP_URL: ${{ inputs.APP_URL }}
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-blob-report-${{ matrix.browser }}-${{ matrix.shardIndex }}
path: packages/e2e/blob-report
retention-days: 1

collect-report:
runs-on: ubuntu-latest
needs: [e2e]
if: failure()
outputs:
report_url: ${{ steps.report-upload.outputs.url }}
steps:
- uses: actions/download-artifact@v4
with:
name: playwright-screenshots-${{ matrix.browser }}
path: packages/e2e/playwright-screenshots
path: blob-report
pattern: e2e-blob-report-*
merge-multiple: true

- uses: oven-sh/setup-bun@v1

- name: upload html report
id: report-upload
run: |
bunx playwright merge-reports --reporter html blob-report
bunx wrangler pages deploy playwright-report --project-name=timezone-rocks --branch=test-report | tee deploy_log.txt
URL=`cat deploy_log.txt | grep -Eo "https://[^ ]*"`
echo url=$URL >> "$GITHUB_OUTPUT"
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_PUBLISH_TOKEN }}
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: main

on: [push]
on:
push:
paths:
- "**"

jobs:
main:
Expand Down Expand Up @@ -41,3 +44,4 @@ jobs:
uses: ./.github/workflows/_test-e2e.yml
with:
APP_URL: ${{ needs.main.outputs.published_url }}
secrets: inherit
1 change: 1 addition & 0 deletions .github/workflows/publish-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ jobs:
uses: ./.github/workflows/_test-e2e.yml
with:
APP_URL: "https://timezone.rocks"
secrets: inherit
26 changes: 23 additions & 3 deletions .github/workflows/recuring-live-test.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
name: Recuring live test

on:
deployment_status:
schedule:
- cron: "0 12 * * *"
- cron: "0 12 */3 * *"

workflow_dispatch:
inputs:
app_url:
type: string
description: url to test
default: https://timezone.rocks
required: true

jobs:
e2e:
uses: ./.github/workflows/_test-e2e.yml
with:
APP_URL: "https://timezone.rocks"
APP_URL: ${{ inputs.app_url || 'https://timezone.rocks' }}
secrets: inherit

notify:
runs-on: ubuntu-latest
needs: [e2e]
if: failure()
steps:
- name: Leave comment with the report
# if: github.event_name == 'schedule'
run: |
BODY="🚨 e2e test failed [report](${{ needs.e2e.outputs.report_url }}) [run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) [app](${{ inputs.app_url || 'https://timezone.rocks' }})"
gh issue comment 15 --body "$BODY"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}

1 comment on commit 41b5244

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.