Skip to content

Commit fe41515

Browse files
committed
Optimize the CI build, and show the webserver's startup output.
1 parent 44effa5 commit fe41515

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

.github/workflows/playwright.yml

+4
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,12 @@ jobs:
3535
compose-file: 'webserver/docker-compose.yml'
3636
- name: Initialize Prisma and DB
3737
run: pnpm dotenv -e .env.test -- pnpm prisma db push --force-reset
38+
- name: Build
39+
run: pnpm run build
3840
- name: Run Playwright tests
3941
run: pnpm dotenv -e .env.test -- pnpm exec playwright test
42+
env:
43+
DEBUG: "pw:webserver"
4044
- uses: actions/upload-artifact@v3
4145
if: failure()
4246
with:

webserver/e2e/global-setup.ts

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import { promisify } from 'node:util';
55
const execFileP = promisify(execFile);
66

77
async function globalSetup(config: FullConfig) {
8+
if (process.env.CI) {
9+
// The CI has already reset the database by the time we get here.
10+
return;
11+
}
812
// Reset the database so that tests work even if we're re-using a webserver instance.
913
const { stdout, stderr } = await execFileP('pnpm',
1014
['prisma', 'db', 'push', '--skip-generate', '--force-reset']);

webserver/playwright.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const config: PlaywrightTestConfig = {
5252

5353
/* Run your local dev server before starting the tests */
5454
webServer: {
55-
command: 'pnpm build && PORT=3000 pnpm start',
55+
command: (process.env.CI ? '' : 'pnpm build && ') + 'PORT=3000 pnpm start',
5656
url: "http://localhost:3000/",
5757
reuseExistingServer: !process.env.CI
5858
},

0 commit comments

Comments
 (0)