generated from chiffre-io/template-library
-
-
Notifications
You must be signed in to change notification settings - Fork 119
262 lines (253 loc) · 9.68 KB
/
ci-cd.yml
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
name: CI/CD
on:
push:
branches:
- master
- beta
- next
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:
env:
FORCE_COLOR: 3 # Diplay chalk colors
jobs:
lint:
name: Linting
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version-file: .node-version
cache: pnpm
- name: Install dependencies
run: pnpm install --ignore-scripts --frozen-lockfile --workspace-root
- name: Check monorepo with Sherif
run: pnpm run lint:sherif
- name: Check source code formatting
run: |
set +e # Allow Prettier to fail, but capture the error code
output=$(./node_modules/.bin/prettier --list-different ./packages/nuqs 2>&1)
exit_code=$?
set -e
if [ $exit_code -ne 0 ]; then
echo "$output" | while IFS= read -r file; do
echo "::warning file=$file::Prettier detected formatting issues in $file"
done
exit $exit_code
else
echo "No formatting issues found"
fi
ci-core:
name: CI (core)
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version-file: .node-version
cache: pnpm
- name: Install dependencies
run: pnpm install --ignore-scripts --frozen-lockfile --filter nuqs...
- name: Run tests
run: pnpm run test ${{ github.event_name == 'workflow_dispatch' && '--force' || '' }} --filter nuqs
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
E2E_NO_CACHE_ON_RERUN: ${{ github.run_attempt }}
e2e-next:
# Watch out! When changing the job name,
# update the required checks in GitHub
# branch protection settings for `next`.
name: E2E (next@${{ matrix.next-version }}${{ matrix.base-path && ' basePath' || ''}})
runs-on: ubuntu-24.04
needs: [ci-core]
strategy:
fail-fast: false
matrix:
# Watch out! When changing the compat grid,
# update the required checks in GitHub
# branch protection settings for `next`.
base-path: [false, '/base']
next-version:
# Only keep versions where there were relevant changes in the app router core,
# and the previous one to use as a baseline.
- '14.2.0'
- '14.2.3' # before vercel/next.js#66755
- '14.2.4' # after vercel/next.js#66755
- '14.2.7' # before vercel/next.js#69509
- '14.2.8' # after vercel/next.js#69509
- '15.0.0'
- latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version-file: .node-version
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Install Next.js version ${{ matrix.next-version }}
if: ${{ matrix.next-version != 'local' }}
run: pnpm add --filter e2e-next --filter nuqs next@${{ matrix.next-version }}
- name: Run integration tests
run: pnpm run test ${{ github.event_name == 'workflow_dispatch' && '--force' || '' }} --filter e2e-next
env:
BASE_PATH: ${{ matrix.base-path && matrix.base-path || '/' }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
E2E_NO_CACHE_ON_RERUN: ${{ github.run_attempt }}
- name: Save Cypress artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
if: failure()
with:
path: packages/e2e/next/cypress/screenshots
name: ci-${{ matrix.next-version }}${{ matrix.base-path && '-basePath' || ''}}
- uses: 47ng/actions-slack-notify@main
name: Notify on Slack
if: always()
with:
status: ${{ job.status }}
jobName: next@${{ matrix.next-version }}${{ matrix.base-path && ' basePath' || ''}}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
e2e-react:
name: E2E (react)
runs-on: ubuntu-24.04
needs: [ci-core]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version-file: .node-version
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Run tests
run: pnpm run test ${{ github.event_name == 'workflow_dispatch' && '--force' || '' }} --filter e2e-react
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
E2E_NO_CACHE_ON_RERUN: ${{ github.run_attempt }}
- name: Save Cypress artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
if: failure()
with:
path: packages/e2e/react/cypress/screenshots
name: ci-react
- uses: 47ng/actions-slack-notify@main
name: Notify on Slack
if: always()
with:
status: ${{ job.status }}
jobName: react
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
e2e-react-router:
name: E2E (react-router ${{ matrix.react-router-version }})
runs-on: ubuntu-24.04
needs: [ci-core]
strategy:
fail-fast: false
matrix:
react-router-version:
- 'v6'
- 'v7'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version-file: .node-version
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Run tests
run: pnpm run test ${{ github.event_name == 'workflow_dispatch' && '--force' || '' }} --filter e2e-react-router-${{ matrix.react-router-version }}
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
E2E_NO_CACHE_ON_RERUN: ${{ github.run_attempt }}
- name: Save Cypress artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
if: failure()
with:
path: packages/e2e/react-router/${{ matrix.react-router-version }}/cypress/screenshots
name: ci-react-router-${{ matrix.react-router-version }}
- uses: 47ng/actions-slack-notify@main
name: Notify on Slack
if: always()
with:
status: ${{ job.status }}
jobName: react-router-${{ matrix.react-router-version }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
e2e-remix:
name: E2E (remix)
runs-on: ubuntu-24.04
needs: [ci-core]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version-file: .node-version
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Run tests
run: pnpm run test ${{ github.event_name == 'workflow_dispatch' && '--force' || '' }} --filter e2e-remix
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
E2E_NO_CACHE_ON_RERUN: ${{ github.run_attempt }}
- name: Save Cypress artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
if: failure()
with:
path: packages/e2e/remix/cypress/screenshots
name: ci-remix
- uses: 47ng/actions-slack-notify@main
name: Notify on Slack
if: always()
with:
status: ${{ job.status }}
jobName: remix
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
cd:
name: Deployment
runs-on: ubuntu-24.04
needs:
- lint
- ci-core
- e2e-next
- e2e-react
- e2e-react-router
- e2e-remix
if: ${{ github.ref_name == 'master' || github.ref_name == 'beta' }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version-file: .node-version
cache: pnpm
# Note: we do not use an external Turbo cache for publishing
# to prevent against possible cache collision attacks.
- name: Install dependencies
run: pnpm install --ignore-scripts --frozen-lockfile --filter nuqs...
- name: Build package
run: pnpm build --filter nuqs
- name: Semantic Release
run: ../../node_modules/.bin/semantic-release
working-directory: packages/nuqs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Invalidate ISR cache for NPM in the docs
run: curl -s "https://nuqs.47ng.com/api/isr?tag=npm&token=${{ secrets.ISR_TOKEN }}"