-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (135 loc) · 4.05 KB
/
validate-prs.yml
File metadata and controls
156 lines (135 loc) · 4.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: validate-prs
on:
pull_request:
permissions:
contents: read
pull-requests: read
concurrency:
group: validate-prs-${{ github.ref }}
cancel-in-progress: true
jobs:
# 1) Lint-only precheck (format + biome + backend lint)
lint:
name: 1) Lint
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- &checkout_pr_branch
name: Checkout PR branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- &setup_pnpm
name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.14.0
- &setup_node
name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Run lint precheck (local/CI parity)
run: node tooling/scripts/pr-check.mjs
env:
PR_PRECHECK_ONLY: '1'
# 2) Unit tests with coverage (after lint)
unit_tests:
name: 2) Unit tests
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [lint]
steps:
- *checkout_pr_branch
- *setup_pnpm
- *setup_node
- name: Run unit tests (with coverage)
run: node tooling/scripts/pr-check.mjs
env:
SKIP_LINT: '1'
SKIP_E2E: '1'
# 3) Backend e2e tests (needs Postgres)
backend_e2e:
name: 3) Backend e2e
runs-on: ubuntu-latest
timeout-minutes: 40
needs: [unit_tests]
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U test -d test"
--health-interval 5s
--health-timeout 5s
--health-retries 20
steps:
- *checkout_pr_branch
- *setup_pnpm
- *setup_node
- name: Run backend e2e (skip frontend e2e)
run: node tooling/scripts/pr-check.mjs
env:
DATABASE_URL: "postgresql://test:test@localhost:5432/test"
TEST_DATABASE_URL: "postgresql://test:test@localhost:5432/test"
BETTER_AUTH_SECRET: "test-secret-for-ci-only"
NEXT_PUBLIC_SITE_URL: "http://localhost:3000"
GITHUB_CLIENT_ID: "test-github-client-id"
GITHUB_CLIENT_SECRET: "test-github-client-secret"
GOOGLE_CLIENT_ID: "test-google-client-id"
GOOGLE_CLIENT_SECRET: "test-google-client-secret"
SKIP_LINT: '1'
SKIP_FRONTEND_E2E: '1'
# 4) Frontend e2e for apps/web
web_e2e:
name: 4) E2E apps/web (frontend)
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [unit_tests]
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U test -d test"
--health-interval 5s
--health-timeout 5s
--health-retries 20
steps:
- *checkout_pr_branch
- *setup_pnpm
- *setup_node
- name: Install Playwright browsers and system deps
run: pnpm dlx playwright@1.56.0 install --with-deps
- name: Run web e2e (skip unit + backend e2e)
run: node tooling/scripts/pr-check.mjs
env:
DATABASE_URL: "postgresql://test:test@localhost:5432/test"
TEST_DATABASE_URL: "postgresql://test:test@localhost:5432/test"
BETTER_AUTH_SECRET: "test-secret-for-ci-only"
NEXT_PUBLIC_SITE_URL: "http://localhost:3000"
GITHUB_CLIENT_ID: "test-github-client-id"
GITHUB_CLIENT_SECRET: "test-github-client-secret"
GOOGLE_CLIENT_ID: "test-google-client-id"
GOOGLE_CLIENT_SECRET: "test-google-client-secret"
SKIP_LINT: '1'
SKIP_COVERAGE: '1'
SKIP_BACKEND_E2E: '1'
- name: Upload Playwright report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: apps/web/playwright-report/
retention-days: 30