diff --git a/.github/workflows/scheduled-playwright.yml b/.github/workflows/scheduled-playwright.yml new file mode 100644 index 0000000000000..3142327888e1c --- /dev/null +++ b/.github/workflows/scheduled-playwright.yml @@ -0,0 +1,121 @@ +name: 'Scheduled Playwright Tests' + +on: + schedule: + # Run daily at 06:00 UTC + - cron: '0 6 * * *' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: scheduled-playwright + cancel-in-progress: false + +jobs: + playwright: + name: 'Playwright (${{ matrix.shard }}/8)' + runs-on: ubuntu-latest-8-cores + timeout-minutes: 60 + strategy: + fail-fast: false + max-parallel: 4 + matrix: + shard: [1, 2, 3, 4, 5, 6, 7, 8] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Node.js 22.x + uses: actions/setup-node@v4 + with: + node-version: 22.x + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn cache dir)" >> "$GITHUB_OUTPUT" + shell: bash + + - name: Restore yarn cache + uses: actions/cache@v4 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Set Yarn version + run: yarn policies set-version v1.22.22 + + - name: Yarn install + uses: nick-fields/retry@v3 + env: + CUBESTORE_SKIP_POST_INSTALL: true + with: + max_attempts: 3 + retry_on: error + retry_wait_seconds: 15 + timeout_minutes: 20 + command: yarn install --frozen-lockfile + + - name: Install Playwright browsers + run: npx playwright install --with-deps + + - name: Build + run: | + yarn build + yarn tsc + + - name: Run Playwright tests (shard ${{ matrix.shard }}/8) + run: npx playwright test --shard=${{ matrix.shard }}/8 --reporter=blob + + - name: Upload blob report + if: always() + uses: actions/upload-artifact@v4 + with: + name: blob-report-${{ matrix.shard }} + path: blob-report/ + retention-days: 1 + + merge-reports: + name: 'Merge Playwright Reports' + if: always() + needs: [playwright] + runs-on: ubuntu-24.04 + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Node.js 22.x + uses: actions/setup-node@v4 + with: + node-version: 22.x + + - name: Download blob reports + uses: actions/download-artifact@v4 + with: + pattern: blob-report-* + path: all-blob-reports + merge-multiple: true + + - name: Merge reports + run: npx playwright merge-reports --reporter html ./all-blob-reports + + - name: Upload merged HTML report + uses: actions/upload-artifact@v4 + with: + name: playwright-report + path: playwright-report/ + retention-days: 14 + + - name: Slack Failure + if: ${{ always() && needs.playwright.result == 'failure' }} + uses: voxmedia/github-action-slack-notify-build@v1 + with: + channel: oss-ci + status: FAILED + color: danger + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}