-
Notifications
You must be signed in to change notification settings - Fork 56
341 lines (286 loc) · 9.33 KB
/
ci.yaml
File metadata and controls
341 lines (286 loc) · 9.33 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
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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
name: "@fireproof/core"
on:
push:
paths-ignore:
- "dashboard/**"
pull_request:
paths-ignore:
- "dashboard/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FP_CI: "fp_ci"
GIT_DISCOVERY_ACROSS_FILESYSTEM: "true"
jobs:
pre-build:
timeout-minutes: 10
name: pre-build
runs-on: blacksmith-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
version: 10
- uses: useblacksmith/setup-node@v5
with:
node-version: 22
cache: pnpm
#- uses: actions/setup-node@v4
# with:
# node-version: 20
# cache: pnpm
# - uses: denoland/setup-deno@v2
# with:
# deno-version: v2.x
# - name: Sticky-disk-node_modules
# uses: useblacksmith/stickydisk@v1
# with:
# key: ${{ github.repository }}-${{ github.ref }}-node_modules
# path: ./node_modules
- name: Sticky-disk-cache
uses: useblacksmith/stickydisk@v1
with:
key: ${{ github.repository }}-cache
path: ~/.cache
# - name: smoke-esm-cache
# id: smoke-esm-cache
# uses: useblacksmith/cache@v5
# with:
# path: ~/.cache
# key: smoke-esm-cache
# - name: start-esm + npm
# run: |
# bash .github/workflows/setup-local-esm-npm.sh
# cp ./dist/npmrc-smoke .npmrc
- name: install
run: pnpm install
- name: format-check
run: pnpm run format --check
- name: lint
run: pnpm run lint
# - name: Upload node_modules
# uses: actions/upload-artifact@v4
# with:
# name: node_modules
# path: node_modules/
build:
name: build
needs: pre-build
runs-on: blacksmith-2vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false
version: 10
- uses: useblacksmith/setup-node@v5
with:
node-version: 22
cache: pnpm
- name: install
run: pnpm install
- name: Sticky-disk-dist
uses: useblacksmith/stickydisk@v1
with:
key: ${{ github.repository }}-${{ github.ref }}-dist
path: ./dist
- name: build
run: pnpm run build
test-node:
timeout-minutes: 3
name: test-node
needs: pre-build
runs-on: blacksmith-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 10
- uses: useblacksmith/setup-node@v5
with:
node-version: 22
cache: pnpm
- name: Sticky-disk-cache
uses: useblacksmith/stickydisk@v1
with:
key: ${{ github.repository }}-cache
path: ~/.cache
- name: install
run: pnpm install
- name: playwright
run: pnpm exec playwright install chromium
- name: test Attempt 1
id: attempt1
continue-on-error: true
run: pnpm run test
- name: test Attempt 2
if: steps.attempt1.outcome == 'failure'
run: pnpm run test
#- uses: denoland/setup-deno@v2
# with:
# deno-version: v2.x
- name: test:deno 1
id: denoattempt1
run: pnpm run test:deno
continue-on-error: true
- name: test:deno 2
id: denoattempt2
if: steps.denoattempt1.outcome == 'failure'
run: pnpm run test:deno
smoke:
timeout-minutes: 4
name: smoke
needs: ["test-node", "build"]
runs-on: blacksmith-4vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 10
- uses: useblacksmith/setup-node@v5
with:
node-version: 22
cache: pnpm
#- uses: denoland/setup-deno@v2
# with:
# deno-version: v2.x
- name: install
run: pnpm install
- name: Sticky-disk-cache
uses: useblacksmith/stickydisk@v1
with:
key: ${{ github.repository }}-cache
path: ~/.cache
- name: Sticky-disk-dist
uses: useblacksmith/stickydisk@v1
with:
key: ${{ github.repository }}-${{ github.ref }}-dist
path: ./dist
- name: playwright
run: pnpm exec playwright install chromium
- name: start-esm + npm
run: |
bash .github/workflows/setup-local-esm-npm.sh
cp ./dist/npmrc-smoke .npmrc
- name: smoke Attempt 1
id: attempt1
continue-on-error: true
run: pnpm run smoke
- name: smoke Attempt 2
if: steps.attempt1.outcome == 'failure'
run: pnpm run smoke-retry
publish:
timeout-minutes: 3
name: publish
needs: ["test-node", "smoke", "build"]
environment: ${{ startsWith(github.ref, 'refs/tags/core@s') && 'staging' || startsWith(github.ref, 'refs/tags/core@p') && 'production' || 'dev' }}
runs-on: blacksmith-2vcpu-ubuntu-2204
if: startsWith(github.ref, 'refs/tags/core@v')
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 10
- uses: useblacksmith/setup-node@v5
with:
node-version: 22
cache: pnpm
- name: install
run: pnpm install
- name: Sticky-disk-dist
uses: useblacksmith/stickydisk@v1
with:
key: ${{ github.repository }}-${{ github.ref }}-dist
path: ./dist
- name: publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
rm -f .npmrc # publish to the world
git fetch --tags --force
# we need to have a safe way to store of allowedSigners
git config --local --add gpg.ssh.allowedSignersFile ./allowed_signers
echo "GITHUB_REF->"$GITHUB_REF
# test tag signature
git tag -v $(git describe --tags --abbrev=0)
# should only run if a tag is set
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
pnpm run fppublish
cf-deploy:
name: cf-deploy
needs: test-node
environment: ${{ startsWith(github.ref, 'refs/tags/core@s') && 'staging' || startsWith(github.ref, 'refs/tags/core@p') && 'production' || 'dev' }}
runs-on: blacksmith-2vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 10
- uses: useblacksmith/setup-node@v5
with:
node-version: 22
cache: pnpm
- name: install
run: pnpm install
- name: Sticky-disk-dist
uses: useblacksmith/stickydisk@v1
with:
key: ${{ github.repository }}-${{ github.ref }}-dist
path: ./dist
- name: deploy cloud/backend/cf-d1 - 1
id: attempt1
continue-on-error: true
env:
CLOUD_SESSION_TOKEN_PUBLIC: ${{ vars.CLOUD_SESSION_TOKEN_PUBLIC }}
CLOUD_SESSION_TOKEN_SECRET: ${{ secrets.CLOUD_SESSION_TOKEN_SECRET }}
CLOUDFLARE_D1_TOKEN: ${{ secrets.CLOUDFLARE_D1_TOKEN }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }}
ACCESS_KEY_ID: ${{ vars.ACCESS_KEY_ID }}
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_DATABASE_ID: ${{ vars.CLOUDFLARE_DATABASE_ID }}
FP_ENDPOINT: ${{ vars.FP_ENDPOINT }}
STORAGE_URL: ${{ vars.STORAGE_URL }}
run: |
pnpm run drizzle:d1-remote
pnpm exec tsx ./cloud/backend/cf-d1/cli-write-env.ts --wranglerToml ./cloud/backend/cf-d1/wrangler.toml --env dev --out /dev/stdout --json | \
pnpm exec wrangler -c cloud/backend/cf-d1/wrangler.toml secret --env dev bulk
pnpm run wrangler:cf-d1
pnpm run test --project cloud:D1 --testTimeout 10000
- name: deploy cloud/backend/cf-d1 - 2
if: steps.attempt1.outcome == 'failure'
env:
CLOUD_SESSION_TOKEN_PUBLIC: ${{ vars.CLOUD_SESSION_TOKEN_PUBLIC }}
CLOUD_SESSION_TOKEN_SECRET: ${{ secrets.CLOUD_SESSION_TOKEN_SECRET }}
CLOUDFLARE_D1_TOKEN: ${{ secrets.CLOUDFLARE_D1_TOKEN }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }}
ACCESS_KEY_ID: ${{ vars.ACCESS_KEY_ID }}
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_DATABASE_ID: ${{ vars.CLOUDFLARE_DATABASE_ID }}
FP_ENDPOINT: ${{ vars.FP_ENDPOINT }}
STORAGE_URL: ${{ vars.STORAGE_URL }}
run: |
pnpm run test --project cloud:D1 --testTimeout 10000
clean-sticky-cache:
name: clean-sticky-cache
runs-on: blacksmith-2vcpu-ubuntu-2204
needs: [build, test-node, smoke, publish, cf-deploy]
if: always()
steps:
- name: Sticky-disk-dist
uses: useblacksmith/stickydisk@v1
with:
key: ${{ github.repository }}-${{ github.ref }}-dist
path: ./dist
- name: wipe-sticky-cache
run: |
(cd dist && rm -rf $(ls -A) || true)