fix(ci): correct bun install retry loop, replace Vercel with Cloudflare deploy, fix lint script

Swadhin Biswas committed 5 months ago
9e20b46
1 parent 322dfb0
commit 9e20b46
3 files changed
+56 -22
▼.github/workflows/ci.yml
+24-8
28
28
- name: Install dependencies
29
29
run: |
30
30
for i in 1 2 3; do
31
- bun install --frozen-lockfile && break
31
+ bun install --frozen-lockfile && exit 0
32
32
echo "bun install attempt $i failed, retrying in 10s..."
33
33
sleep 10
34
34
done
35
+ echo "::error::bun install failed after 3 attempts"
36
+ exit 1
35
37
36
38
- name: Run ESLint
37
39
run: bun run lint
53
55
- name: Install dependencies
54
56
run: |
55
57
for i in 1 2 3; do
56
- bun install --frozen-lockfile && break
58
+ bun install --frozen-lockfile && exit 0
57
59
echo "bun install attempt $i failed, retrying in 10s..."
58
60
sleep 10
59
61
done
62
+ echo "::error::bun install failed after 3 attempts"
63
+ exit 1
60
64
61
65
- name: Check docs parity
62
66
run: bun run docs:parity
78
82
- name: Install dependencies
79
83
run: |
80
84
for i in 1 2 3; do
81
- bun install --frozen-lockfile && break
85
+ bun install --frozen-lockfile && exit 0
82
86
echo "bun install attempt $i failed, retrying in 10s..."
83
87
sleep 10
84
88
done
89
+ echo "::error::bun install failed after 3 attempts"
90
+ exit 1
85
91
86
92
- name: Dependency audit (high+)
87
93
run: bun pm audit --level=high || true
119
125
- name: Install dependencies
120
126
run: |
121
127
for i in 1 2 3; do
122
- bun install --frozen-lockfile && break
128
+ bun install --frozen-lockfile && exit 0
123
129
echo "bun install attempt $i failed, retrying in 10s..."
124
130
sleep 10
125
131
done
132
+ echo "::error::bun install failed after 3 attempts"
133
+ exit 1
126
134
127
135
- name: Run tests with coverage
128
136
run: bun run test:coverage
178
186
- name: Install dependencies
179
187
run: |
180
188
for i in 1 2 3; do
181
- bun install --frozen-lockfile && break
189
+ bun install --frozen-lockfile && exit 0
182
190
echo "bun install attempt $i failed, retrying in 10s..."
183
191
sleep 10
184
192
done
193
+ echo "::error::bun install failed after 3 attempts"
194
+ exit 1
185
195
186
196
- name: Install Playwright browsers
187
197
run: bunx playwright install --with-deps chromium
284
294
- name: Install dependencies
285
295
run: |
286
296
for i in 1 2 3; do
287
- bun install --frozen-lockfile && break
297
+ bun install --frozen-lockfile && exit 0
288
298
echo "bun install attempt $i failed, retrying in 10s..."
289
299
sleep 10
290
300
done
301
+ echo "::error::bun install failed after 3 attempts"
302
+ exit 1
291
303
- name: Build application
292
304
run: bun run build
293
305
env:
333
345
- name: Install dependencies
334
346
run: |
335
347
for i in 1 2 3; do
336
- bun install --frozen-lockfile && break
348
+ bun install --frozen-lockfile && exit 0
337
349
echo "bun install attempt $i failed, retrying in 10s..."
338
350
sleep 10
339
351
done
352
+ echo "::error::bun install failed after 3 attempts"
353
+ exit 1
340
354
341
355
- name: Build application
342
356
run: bun run build
414
428
- name: Install dependencies
415
429
run: |
416
430
for i in 1 2 3; do
417
- bun install --frozen-lockfile && break
431
+ bun install --frozen-lockfile && exit 0
418
432
echo "bun install attempt $i failed, retrying in 10s..."
419
433
sleep 10
420
434
done
435
+ echo "::error::bun install failed after 3 attempts"
436
+ exit 1
421
437
working-directory: cli
422
438
423
439
- name: Build CLI
424
440
▼.github/workflows/deploy.yml
+31-13
1
-name: Deploy to Vercel
1
+name: Deploy Docs to Cloudflare Pages
2
2
3
3
on:
4
4
push:
5
5
branches:
6
6
- main
7
-
8
-env:
9
- VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
10
- VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
7
+ paths:
8
+ - "docs-site/**"
9
+ - ".github/workflows/deploy.yml"
10
+ workflow_dispatch:
11
11
12
12
jobs:
13
13
deploy:
14
14
runs-on: ubuntu-latest
15
+ defaults:
16
+ run:
17
+ working-directory: docs-site
15
18
steps:
16
19
- uses: actions/checkout@v4
17
20
18
- - name: Install Vercel CLI
19
- run: npm install --global vercel@latest
21
+ - uses: oven-sh/setup-bun@v2
22
+ with:
23
+ bun-version: latest
20
24
21
- - name: Pull Vercel Environment Information
22
- run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
25
+ - name: Install dependencies
26
+ run: |
27
+ for i in 1 2 3; do
28
+ bun install --frozen-lockfile && exit 0
29
+ echo "bun install attempt $i failed, retrying in 10s..."
30
+ sleep 10
31
+ done
32
+ echo "::error::bun install failed after 3 attempts"
33
+ exit 1
23
34
24
- - name: Build Project Artifacts
25
- run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
35
+ - name: Build docs site
36
+ run: bun run build
37
+ env:
38
+ NODE_ENV: production
26
39
27
- - name: Deploy Project Artifacts to Vercel
28
- run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
40
+ - name: Deploy to Cloudflare Pages
41
+ uses: cloudflare/wrangler-action@v3
42
+ with:
43
+ apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
44
+ accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
45
+ command: pages deploy dist --project-name=opencodehub-docs --branch=main
46
+ workingDirectory: docs-site
29
47
▼package.json
+1-1
28
28
"git:start": "bun scripts/ssh-server.ts",
29
29
"worker:start": "bun scripts/worker.ts",
30
30
"runner:start": "bun src/runner/index.ts",
31
- "lint": "astro check",
31
+ "lint": "bunx astro check",
32
32
"typecheck": "tsc --noEmit",
33
33
"test": "vitest run",
34
34
"test:coverage": "vitest run --coverage",
35
35