Skip to content

Commit 03beadd

Browse files
committed
chore(ci): more configurations to populate verdaccio once
1 parent 2d07052 commit 03beadd

File tree

3 files changed

+189
-109
lines changed

3 files changed

+189
-109
lines changed

.github/workflows/ci-supabase-js.yml

Lines changed: 65 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ env:
2020

2121
jobs:
2222
build-package:
23-
name: Build and publish to Verdaccio
23+
name: Build all packages
2424
runs-on: ubuntu-latest
2525
steps:
2626
- name: Checkout code
@@ -42,31 +42,17 @@ jobs:
4242
- name: Build all packages
4343
run: npx nx run-many --target=build --all
4444

45-
- name: Start Verdaccio
46-
run: |
47-
npx verdaccio --config .verdaccio/config.yml &
48-
VERDACCIO_PID=$!
49-
echo "Verdaccio started with PID: $VERDACCIO_PID"
50-
51-
- name: Wait for Verdaccio to be ready
52-
run: |
53-
echo "Waiting for Verdaccio to be ready..."
54-
timeout 30 bash -c 'until curl -f http://localhost:4873 > /dev/null 2>&1; do sleep 1; done'
55-
echo "✓ Verdaccio is ready!"
56-
57-
- name: Configure npm to use Verdaccio
58-
run: npm set registry http://localhost:4873/
59-
60-
- name: Publish packages to Verdaccio
61-
run: |
62-
set -e
63-
for pkg in auth-js functions-js postgrest-js realtime-js storage-js supabase-js; do
64-
echo "Publishing @supabase/$pkg to Verdaccio..."
65-
cd packages/core/$pkg
66-
npm publish --registry http://localhost:4873
67-
echo "✓ Published @supabase/$pkg"
68-
cd ../../..
69-
done
45+
- name: Upload built packages
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: packages-dist
49+
path: |
50+
packages/core/auth-js/dist
51+
packages/core/functions-js/dist
52+
packages/core/postgrest-js/dist
53+
packages/core/realtime-js/dist
54+
packages/core/storage-js/dist
55+
packages/core/supabase-js/dist
7056
7157
- name: Upload UMD build
7258
uses: actions/upload-artifact@v4
@@ -131,6 +117,8 @@ jobs:
131117
name: Deno Tests / ${{ matrix.deno }}
132118
runs-on: ubuntu-latest
133119
needs: build-package
120+
env:
121+
npm_config_registry: http://localhost:4873
134122
strategy:
135123
matrix:
136124
deno: ['1.x', '2.x']
@@ -158,6 +146,18 @@ jobs:
158146
node-version: ${{ env.NODE_VERSION }}
159147
cache: 'npm'
160148

149+
- name: Download built packages
150+
uses: actions/download-artifact@v4
151+
with:
152+
name: packages-dist
153+
path: packages/core
154+
155+
- name: Install dependencies
156+
run: npm ci --legacy-peer-deps
157+
158+
- name: Start Verdaccio and publish packages
159+
run: npx nx populate-local-registry
160+
161161
- name: Start Supabase and apply migrations
162162
run: |
163163
cd packages/core/supabase-js
@@ -174,42 +174,21 @@ jobs:
174174
echo "Verifying storage bucket exists"
175175
supabase db query "select id, name from storage.buckets where id = 'test-bucket';"
176176
177-
- name: Install dependencies and build
178-
run: |
179-
npm ci --legacy-peer-deps
180-
npx nx build supabase-js
181-
182-
- name: Start Verdaccio and publish packages
183-
run: |
184-
set -e
185-
npx verdaccio --config .verdaccio/config.yml &
186-
echo "Waiting for Verdaccio to be ready..."
187-
timeout 30 bash -c 'until curl -f http://localhost:4873 > /dev/null 2>&1; do sleep 1; done'
188-
echo "✓ Verdaccio is ready!"
189-
npm set registry http://localhost:4873/
190-
for pkg in auth-js functions-js postgrest-js realtime-js storage-js supabase-js; do
191-
echo "Publishing @supabase/$pkg..."
192-
cd packages/core/$pkg
193-
npm publish --registry http://localhost:4873
194-
echo "✓ Published @supabase/$pkg"
195-
cd ../../..
196-
done
197-
198177
- name: Run Deno Tests
199178
if: ${{ matrix.deno == '1.x' }}
200179
env:
201180
STORAGE_JS_ENTRY: main
202181
run: |
203182
cd packages/core/supabase-js/test/deno
204-
npm install --registry http://localhost:4873
183+
npm install
205184
npm test || npm test
206185
cd ../../..
207186
208187
- name: Run Deno Tests
209188
if: ${{ matrix.deno == '2.x' }}
210189
run: |
211190
cd packages/core/supabase-js/test/deno
212-
npm install --registry http://localhost:4873
191+
npm install
213192
npm test || npm test
214193
cd ../../..
215194
@@ -292,6 +271,8 @@ jobs:
292271
name: Next.js Integration
293272
runs-on: ubuntu-latest
294273
needs: build-package
274+
env:
275+
npm_config_registry: http://localhost:4873
295276
steps:
296277
- name: Checkout code
297278
uses: actions/checkout@v4
@@ -310,26 +291,17 @@ jobs:
310291
with:
311292
version: latest
312293

313-
- name: Install dependencies and build
314-
run: |
315-
npm ci --legacy-peer-deps
316-
npx nx build supabase-js
294+
- name: Download built packages
295+
uses: actions/download-artifact@v4
296+
with:
297+
name: packages-dist
298+
path: packages/core
299+
300+
- name: Install dependencies
301+
run: npm ci --legacy-peer-deps
317302

318303
- name: Start Verdaccio and publish packages
319-
run: |
320-
set -e
321-
npx verdaccio --config .verdaccio/config.yml &
322-
echo "Waiting for Verdaccio to be ready..."
323-
timeout 30 bash -c 'until curl -f http://localhost:4873 > /dev/null 2>&1; do sleep 1; done'
324-
echo "✓ Verdaccio is ready!"
325-
npm set registry http://localhost:4873/
326-
for pkg in auth-js functions-js postgrest-js realtime-js storage-js supabase-js; do
327-
echo "Publishing @supabase/$pkg..."
328-
cd packages/core/$pkg
329-
npm publish --registry http://localhost:4873
330-
echo "✓ Published @supabase/$pkg"
331-
cd ../../..
332-
done
304+
run: npx nx populate-local-registry
333305

334306
- name: Start Supabase and apply migrations
335307
run: |
@@ -353,7 +325,7 @@ jobs:
353325
- name: Run integration tests
354326
run: |
355327
cd packages/core/supabase-js/test/integration/next
356-
npm install --registry http://localhost:4873 --legacy-peer-deps
328+
npm install --legacy-peer-deps
357329
npx playwright install
358330
npm run test
359331
@@ -367,6 +339,8 @@ jobs:
367339
name: Expo Tests
368340
runs-on: ubuntu-latest
369341
needs: build-package
342+
env:
343+
npm_config_registry: http://localhost:4873
370344
steps:
371345
- name: Checkout code
372346
uses: actions/checkout@v4
@@ -385,26 +359,17 @@ jobs:
385359
with:
386360
version: latest
387361

388-
- name: Install dependencies and build
389-
run: |
390-
npm ci --legacy-peer-deps
391-
npx nx build supabase-js
362+
- name: Download built packages
363+
uses: actions/download-artifact@v4
364+
with:
365+
name: packages-dist
366+
path: packages/core
367+
368+
- name: Install dependencies
369+
run: npm ci --legacy-peer-deps
392370

393371
- name: Start Verdaccio and publish packages
394-
run: |
395-
set -e
396-
npx verdaccio --config .verdaccio/config.yml &
397-
echo "Waiting for Verdaccio to be ready..."
398-
timeout 30 bash -c 'until curl -f http://localhost:4873 > /dev/null 2>&1; do sleep 1; done'
399-
echo "✓ Verdaccio is ready!"
400-
npm set registry http://localhost:4873/
401-
for pkg in auth-js functions-js postgrest-js realtime-js storage-js supabase-js; do
402-
echo "Publishing @supabase/$pkg..."
403-
cd packages/core/$pkg
404-
npm publish --registry http://localhost:4873
405-
echo "✓ Published @supabase/$pkg"
406-
cd ../../..
407-
done
372+
run: npx nx populate-local-registry
408373

409374
- name: Start Supabase and apply migrations
410375
run: |
@@ -422,11 +387,11 @@ jobs:
422387
echo "Verifying storage bucket exists"
423388
supabase db query "select id, name from storage.buckets where id = 'test-bucket';"
424389
425-
- name: Install dependencies and run tests
390+
- name: Install test dependencies and run tests
426391
run: |
427392
cd packages/core/supabase-js/test/integration/expo
428-
npm install --registry http://localhost:4873
429-
npm test || npm test
393+
npm install
394+
npm test
430395
431396
- name: Stop Supabase
432397
if: always()
@@ -438,6 +403,8 @@ jobs:
438403
name: Bun Integration
439404
runs-on: ubuntu-latest
440405
needs: build-package
406+
env:
407+
npm_config_registry: http://localhost:4873
441408
steps:
442409
- name: Checkout code
443410
uses: actions/checkout@v4
@@ -461,26 +428,17 @@ jobs:
461428
with:
462429
version: latest
463430

464-
- name: Install dependencies and build
465-
run: |
466-
npm ci --legacy-peer-deps
467-
npx nx build supabase-js
431+
- name: Download built packages
432+
uses: actions/download-artifact@v4
433+
with:
434+
name: packages-dist
435+
path: packages/core
436+
437+
- name: Install dependencies
438+
run: npm ci --legacy-peer-deps
468439

469440
- name: Start Verdaccio and publish packages
470-
run: |
471-
set -e
472-
npx verdaccio --config .verdaccio/config.yml &
473-
echo "Waiting for Verdaccio to be ready..."
474-
timeout 30 bash -c 'until curl -f http://localhost:4873 > /dev/null 2>&1; do sleep 1; done'
475-
echo "✓ Verdaccio is ready!"
476-
npm set registry http://localhost:4873/
477-
for pkg in auth-js functions-js postgrest-js realtime-js storage-js supabase-js; do
478-
echo "Publishing @supabase/$pkg..."
479-
cd packages/core/$pkg
480-
npm publish --registry http://localhost:4873
481-
echo "✓ Published @supabase/$pkg"
482-
cd ../../..
483-
done
441+
run: npx nx populate-local-registry
484442

485443
- name: Start Supabase and apply migrations
486444
run: |
@@ -501,7 +459,6 @@ jobs:
501459
- name: Install dependencies and run tests
502460
run: |
503461
cd packages/core/supabase-js/test/integration/bun
504-
npm set registry http://localhost:4873/
505462
bun install
506463
bun test
507464

project.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@
99
"port": 4873,
1010
"config": ".verdaccio/config.yml",
1111
"storage": "tmp/local-registry/storage",
12-
"clear": true
12+
"clear": false
1313
}
14+
},
15+
"populate-local-registry": {
16+
"executor": "nx:run-commands",
17+
"options": {
18+
"command": "node scripts/populate-verdaccio.mjs"
19+
},
20+
"dependsOn": ["local-registry"]
1421
}
1522
}
1623
}

0 commit comments

Comments
 (0)