Skip to content

Commit 29321c2

Browse files
authored
Add embedded-postgres for Docker-free integration and E2E tests (#44)
1 parent ffcb015 commit 29321c2

7 files changed

Lines changed: 369 additions & 44 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
- uses: actions/setup-node@v6
2828
with:
29-
node-version: "20"
29+
node-version: "24"
3030
cache: "pnpm"
3131

3232
- name: Install dependencies
@@ -47,7 +47,7 @@ jobs:
4747

4848
- uses: actions/setup-node@v6
4949
with:
50-
node-version: "20"
50+
node-version: "24"
5151
cache: "pnpm"
5252

5353
- name: Install dependencies
@@ -68,7 +68,7 @@ jobs:
6868

6969
- uses: actions/setup-node@v6
7070
with:
71-
node-version: "20"
71+
node-version: "24"
7272
cache: "pnpm"
7373

7474
- name: Install dependencies
@@ -80,22 +80,7 @@ jobs:
8080
test-integration:
8181
name: Integration Tests
8282
runs-on: ubuntu-latest
83-
services:
84-
postgres:
85-
image: postgres:16
86-
env:
87-
POSTGRES_USER: postgres
88-
POSTGRES_PASSWORD: postgres
89-
POSTGRES_DB: clabot_test
90-
ports:
91-
- 5432:5432
92-
options: >-
93-
--health-cmd pg_isready
94-
--health-interval 10s
95-
--health-timeout 5s
96-
--health-retries 5
9783
env:
98-
DATABASE_URL: postgres://postgres:postgres@localhost:5432/clabot_test
9984
SESSION_SECRET: ci-integration-test-secret
10085
steps:
10186
- uses: actions/checkout@v6
@@ -106,37 +91,19 @@ jobs:
10691

10792
- uses: actions/setup-node@v6
10893
with:
109-
node-version: "20"
94+
node-version: "24"
11095
cache: "pnpm"
11196

11297
- name: Install dependencies
11398
run: pnpm install --frozen-lockfile
11499

115-
- name: Apply database migrations
116-
run: pnpm db:migrate
117-
118100
- name: Run integration tests
119101
run: pnpm test:integration
120102

121103
test-e2e:
122104
name: E2E Tests
123105
runs-on: ubuntu-latest
124-
services:
125-
postgres:
126-
image: postgres:16
127-
env:
128-
POSTGRES_USER: postgres
129-
POSTGRES_PASSWORD: postgres
130-
POSTGRES_DB: clabot_test
131-
ports:
132-
- 5432:5432
133-
options: >-
134-
--health-cmd pg_isready
135-
--health-interval 10s
136-
--health-timeout 5s
137-
--health-retries 5
138106
env:
139-
DATABASE_URL: postgres://postgres:postgres@localhost:5432/clabot_test
140107
SESSION_SECRET: ci-e2e-test-secret
141108
steps:
142109
- uses: actions/checkout@v6
@@ -147,7 +114,7 @@ jobs:
147114

148115
- uses: actions/setup-node@v6
149116
with:
150-
node-version: "20"
117+
node-version: "24"
151118
cache: "pnpm"
152119

153120
- name: Install dependencies
@@ -156,8 +123,5 @@ jobs:
156123
- name: Install Playwright browsers
157124
run: pnpm exec playwright install chromium --with-deps
158125

159-
- name: Apply database migrations
160-
run: pnpm db:migrate
161-
162126
- name: Run e2e tests
163127
run: pnpm test:e2e

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ node_modules/
1313

1414
test-results
1515
coverage/
16+
tmp/

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "my-project",
33
"version": "0.1.0",
44
"private": true,
5+
"engines": {
6+
"node": ">=24"
7+
},
58
"scripts": {
69
"dev": "next dev",
710
"build": "next build",
@@ -13,7 +16,7 @@
1316
"test:unit:coverage": "vitest run --coverage",
1417
"test:unit:watch": "vitest",
1518
"test:integration": "vitest run --config vitest.integration.config.ts",
16-
"test:e2e": "playwright test tests/e2e/pages-reference.spec.ts",
19+
"test:e2e": "pnpm exec jiti tests/setup/with-embedded-pg.ts pnpm exec playwright test tests/e2e/pages-reference.spec.ts",
1720
"db:generate": "drizzle-kit generate",
1821
"db:migrate": "drizzle-kit migrate",
1922
"db:studio": "drizzle-kit studio",
@@ -40,6 +43,11 @@
4043
"workflow": "4.1.0-beta.60",
4144
"zod": "^3.24.1"
4245
},
46+
"pnpm": {
47+
"onlyBuiltDependencies": [
48+
"@embedded-postgres/linux-x64"
49+
]
50+
},
4351
"devDependencies": {
4452
"@biomejs/biome": "2.4.4",
4553
"@playwright/test": "^1.58.2",
@@ -49,6 +57,8 @@
4957
"@types/react-dom": "^19",
5058
"@vitest/coverage-v8": "^4.0.18",
5159
"drizzle-kit": "^0.31.9",
60+
"embedded-postgres": "18.3.0-beta.16",
61+
"jiti": "^2.6.1",
5262
"knip": "^5.85.0",
5363
"postcss": "^8.5",
5464
"tailwindcss": "^4.2.1",

0 commit comments

Comments
 (0)