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 7f2d0dd
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 11 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/_test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ on:
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 +42,17 @@ 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: playwright-screenshots-${{ matrix.browser }}
path: packages/e2e/playwright-screenshots
name: e2e-blob-report-${{ matrix.browser }}-${{ matrix.shardIndex }}
path: packages/e2e/blob-report
retention-days: 1
5 changes: 4 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
56 changes: 53 additions & 3 deletions .github/workflows/recuring-live-test.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,64 @@
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' }}

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 --branch=test-report | 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 }}

1 comment on commit 7f2d0dd

@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.