-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
208 lines (169 loc) Β· 5.74 KB
/
Copy pathCI.yml
File metadata and controls
208 lines (169 loc) Β· 5.74 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
strategy:
matrix:
node-version: [22.x, 24.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
name: Build with ${{ matrix.node-version }}
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Set up Node.js environment
uses: ./.github/actions/setup-project
with:
node-version: ${{ matrix.node-version }}
- name: Restore or cache Next.js build
uses: actions/cache@v5
with:
path: |
.next/cache
# Generate a new cache whenever packages or source files change.
key: nextjs-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('src/**') }}
- name: Build Next.js
run: npm run build-local
env:
NEXT_PUBLIC_SENTRY_DISABLED: 'true' # Only upload Sentry source maps in deployment
NEXT_PUBLIC_APP_URL: http://localhost:3008
- if: matrix.node-version == '24.x' && success()
name: Cache Next.js build output
uses: actions/cache/save@v5
with:
path: |
.next
next-env.d.ts
key: nextjs-build-${{ matrix.node-version }}-${{ github.sha }}
static:
strategy:
matrix:
node-version: [24.x]
name: Run static checks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Retrieve Git history, needed to verify commits
- name: Set up Node.js environment
uses: ./.github/actions/setup-project
with:
node-version: ${{ matrix.node-version }}
- if: github.event_name == 'pull_request'
name: Validate all commits from PR
run: npx commitlint --from $BASE_SHA --to $HEAD_SHA --verbose
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
- name: Linter
run: npx next typegen && npm run lint
- name: Check dependencies
run: npm run check:deps
- name: I18n check
run: npm run check:i18n
unit:
strategy:
matrix:
node-version: [24.x]
name: Run unit tests
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Set up Node.js environment
uses: ./.github/actions/setup-project
with:
node-version: ${{ matrix.node-version }}
- name: Run unit tests
uses: docker://mcr.microsoft.com/playwright:v1.59.1
with:
args: npm run test -- --coverage
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v6
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
storybook:
strategy:
matrix:
node-version: [24.x]
name: Run Storybook
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Set up Node.js environment
uses: ./.github/actions/setup-project
with:
node-version: ${{ matrix.node-version }}
- name: Run storybook tests
uses: docker://mcr.microsoft.com/playwright:v1.59.1
with:
args: npm run storybook:test
e2e:
strategy:
matrix:
node-version: [24.x]
name: Run E2E tests
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [build]
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # For chromatic
- name: Set up Node.js environment
uses: ./.github/actions/setup-project
with:
node-version: ${{ matrix.node-version }}
restore-nextjs-cache: true
- name: Run E2E tests
uses: docker://mcr.microsoft.com/playwright:v1.59.1
with:
args: sh -c "HOME=/root npm run test:e2e" # Set HOME to /root to avoid Playwright error with Firebox
env:
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
- name: Fix test results permission # Give permissions to test results needed by Chromatic
run: |
sudo chmod -R 777 test-results
- name: Run visual regression tests
uses: chromaui/action@v16
with:
playwright: true
exitOnceUploaded: true # Speed up by skipping the build results
outputDir: storybook-static
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
- name: Upload test results
uses: actions/upload-artifact@v7
if: always()
with:
name: test-results
path: test-results/
retention-days: 7
synchronize-with-crowdin:
name: GitHub PR synchronize with Crowdin
runs-on: ubuntu-latest
timeout-minutes: 10
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }} # Crowdin Actions needs to push commits to the PR branch, checkout HEAD commit instead of merge commit
fetch-depth: 0
- name: Crowdin action
uses: crowdin/github-action@v2
with:
upload_sources: true
upload_translations: true
download_translations: true
create_pull_request: false
localization_branch_name: ${{ github.head_ref || github.ref_name }} # explanation here: https://stackoverflow.com/a/71158878
commit_message: 'chore: new Crowdin translations by GitHub Action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}