Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# REVIEWERS, please always double-check security practices before merging a PR that contains Workflow changes!!
# AUTHORS, please only use actions with explicit SHA references, and avoid using `@master` or `@main` references or `@version` tags.

name: Cloudflare OpenNext Build
name: Playwright Tests on Cloudflare Open-Next

on:
push:
Expand All @@ -14,24 +14,17 @@ on:
branches:
- main

defaults:
run:
# This ensures that the working directory is the root of the repository
working-directory: ./
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read
actions: read

env:
# See https://turbo.build/repo/docs/reference/command-line-reference/run#--cache-dir
TURBO_ARGS: --cache-dir=.turbo/cache
# See https://turbo.build/repo/docs/reference/command-line-reference/run#--force
TURBO_FORCE: true

jobs:
build-cloudflare-worker:
name: Build Cloudflare Worker
playwright:
name: Playwright Tests
runs-on: ubuntu-latest

steps:
Expand All @@ -58,5 +51,32 @@ jobs:
- name: Install packages
run: pnpm install --frozen-lockfile

- name: Build Cloudflare Worker
run: pnpm exec turbo run cloudflare:build:worker ${{ env.TURBO_ARGS }}
- name: Get Playwright version
id: playwright-version
working-directory: apps/site
run: echo "version=$(pnpm exec playwright --version | awk '{print $2}')" >> $GITHUB_OUTPUT

- name: Cache Playwright browsers
id: playwright-cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}

- name: Install Playwright Browsers
working-directory: apps/site
run: pnpm exec playwright install --with-deps

- name: Run Playwright tests
working-directory: apps/site
run: pnpm playwright
env:
PLAYWRIGHT_WEB_SERVER_COMMAND: pnpm turbo run cloudflare:preview
PLAYWRIGHT_BASE_URL: http://127.0.0.1:8787

- name: Upload Playwright test results
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: playwright-report
path: apps/site/playwright-report/
2 changes: 1 addition & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
working-directory: apps/site
run: pnpm playwright
env:
VERCEL_PREVIEW_URL: ${{ needs.get-vercel-preview.outputs.url }}
PLAYWRIGHT_BASE_URL: ${{ needs.get-vercel-preview.outputs.url }}

- name: Upload Playwright test results
if: always()
Expand Down
17 changes: 15 additions & 2 deletions apps/site/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,24 @@ export default defineConfig({
retries: isCI ? 2 : 0,
workers: isCI ? 1 : undefined,
reporter: isCI ? [['html'], ['github']] : [['html']],
...(process.env.PLAYWRIGHT_WEB_SERVER_COMMAND
? {
webServer: {
command: process.env.PLAYWRIGHT_WEB_SERVER_COMMAND,
url:
// TODO: remove the VERCEL_PREVIEW_URL option once
// https://github.com/nodejs/nodejs.org/pull/7782 is merged
process.env.VERCEL_PREVIEW_URL ||
process.env.PLAYWRIGHT_BASE_URL ||
'http://127.0.0.1:3000',
timeout: 60_000 * 3,
},
}
: {}),
use: {
baseURL: process.env.VERCEL_PREVIEW_URL || 'http://127.0.0.1:3000',
baseURL: process.env.PLAYWRIGHT_BASE_URL || 'http://127.0.0.1:3000',
trace: 'on-first-retry',
},

projects: [
{
name: 'chromium',
Expand Down
Loading