Skip to content

Commit 6e73533

Browse files
committed
chore(ci): integrate Verdaccio for integration tests
1 parent 11b1989 commit 6e73533

File tree

5 files changed

+90
-50
lines changed

5 files changed

+90
-50
lines changed

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

Lines changed: 86 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,8 @@ env:
2020

2121
jobs:
2222
build-package:
23-
name: Build supabase-js package
23+
name: Build and publish to Verdaccio
2424
runs-on: ubuntu-latest
25-
outputs:
26-
tgz-name: ${{ steps.pack.outputs.filename }}
2725
steps:
2826
- name: Checkout code
2927
uses: actions/checkout@v4
@@ -41,22 +39,26 @@ jobs:
4139

4240
- uses: nrwl/nx-set-shas@v4
4341

44-
- name: Build
45-
run: npx nx build supabase-js
42+
- name: Build all packages
43+
run: npx nx run-many --target=build --all
4644

47-
- name: Pack npm module
48-
id: pack
45+
- name: Start Verdaccio
4946
run: |
50-
cd packages/core/supabase-js
51-
PKG=$(npm pack)
52-
echo "filename=$PKG" >> "$GITHUB_OUTPUT"
53-
cd ../../..
47+
npx verdaccio --config .verdaccio/config.yml &
48+
sleep 5
49+
echo "Verdaccio started on http://localhost:4873"
5450
55-
- name: Upload .tgz package
56-
uses: actions/upload-artifact@v4
57-
with:
58-
name: supabase-tgz
59-
path: packages/core/supabase-js/${{ steps.pack.outputs.filename }}
51+
- name: Configure npm to use Verdaccio
52+
run: npm set registry http://localhost:4873/
53+
54+
- name: Publish packages to Verdaccio
55+
run: |
56+
for pkg in auth-js functions-js postgrest-js realtime-js storage-js supabase-js; do
57+
echo "Publishing @supabase/$pkg to Verdaccio..."
58+
cd packages/core/$pkg
59+
npm publish --registry http://localhost:4873 || echo "Failed to publish $pkg"
60+
cd ../../..
61+
done
6062
6163
- name: Upload UMD build
6264
uses: actions/upload-artifact@v4
@@ -147,11 +149,6 @@ jobs:
147149
with:
148150
node-version: ${{ env.NODE_VERSION }}
149151
cache: 'npm'
150-
- name: Download artifact
151-
uses: actions/download-artifact@v4
152-
with:
153-
name: supabase-tgz
154-
path: ./packages/core/supabase-js/supabase-pkg
155152

156153
- name: Start Supabase and apply migrations
157154
run: |
@@ -174,23 +171,32 @@ jobs:
174171
npm ci --legacy-peer-deps
175172
npx nx build supabase-js
176173
174+
- name: Start Verdaccio and publish packages
175+
run: |
176+
npx verdaccio --config .verdaccio/config.yml &
177+
sleep 5
178+
npm set registry http://localhost:4873/
179+
for pkg in auth-js functions-js postgrest-js realtime-js storage-js supabase-js; do
180+
cd packages/core/$pkg
181+
npm publish --registry http://localhost:4873 || echo "Failed to publish $pkg"
182+
cd ../../..
183+
done
184+
177185
- name: Run Deno Tests
178186
if: ${{ matrix.deno == '1.x' }}
179187
env:
180188
STORAGE_JS_ENTRY: main
181189
run: |
182190
cd packages/core/supabase-js/test/deno
183-
cp ../../supabase-pkg/supabase-supabase-js-0.0.0-automated.tgz .
184-
npm install
191+
npm install --registry http://localhost:4873
185192
npm test || npm test
186193
cd ../../..
187194
188195
- name: Run Deno Tests
189196
if: ${{ matrix.deno == '2.x' }}
190197
run: |
191198
cd packages/core/supabase-js/test/deno
192-
cp ../../supabase-pkg/supabase-supabase-js-0.0.0-automated.tgz .
193-
npm install
199+
npm install --registry http://localhost:4873
194200
npm test || npm test
195201
cd ../../..
196202
@@ -286,17 +292,27 @@ jobs:
286292
node-version: ${{ env.NODE_VERSION }}
287293
cache: 'npm'
288294

289-
- name: Download artifact
290-
uses: actions/download-artifact@v4
291-
with:
292-
name: supabase-tgz
293-
path: ./packages/core/supabase-js/supabase-pkg
294-
295295
- name: Setup Supabase CLI
296296
uses: supabase/setup-cli@v1
297297
with:
298298
version: latest
299299

300+
- name: Install dependencies and build
301+
run: |
302+
npm ci --legacy-peer-deps
303+
npx nx build supabase-js
304+
305+
- name: Start Verdaccio and publish packages
306+
run: |
307+
npx verdaccio --config .verdaccio/config.yml &
308+
sleep 5
309+
npm set registry http://localhost:4873/
310+
for pkg in auth-js functions-js postgrest-js realtime-js storage-js supabase-js; do
311+
cd packages/core/$pkg
312+
npm publish --registry http://localhost:4873 || echo "Failed to publish $pkg"
313+
cd ../../..
314+
done
315+
300316
- name: Start Supabase and apply migrations
301317
run: |
302318
cd packages/core/supabase-js
@@ -319,8 +335,7 @@ jobs:
319335
- name: Run integration tests
320336
run: |
321337
cd packages/core/supabase-js/test/integration/next
322-
cp ../../../supabase-pkg/supabase-supabase-js-0.0.0-automated.tgz .
323-
npm install --legacy-peer-deps
338+
npm install --registry http://localhost:4873 --legacy-peer-deps
324339
npx playwright install
325340
npm run test
326341
@@ -352,11 +367,21 @@ jobs:
352367
with:
353368
version: latest
354369

355-
- name: Download artifact
356-
uses: actions/download-artifact@v4
357-
with:
358-
name: supabase-tgz
359-
path: ./packages/core/supabase-js/supabase-pkg
370+
- name: Install dependencies and build
371+
run: |
372+
npm ci --legacy-peer-deps
373+
npx nx build supabase-js
374+
375+
- name: Start Verdaccio and publish packages
376+
run: |
377+
npx verdaccio --config .verdaccio/config.yml &
378+
sleep 5
379+
npm set registry http://localhost:4873/
380+
for pkg in auth-js functions-js postgrest-js realtime-js storage-js supabase-js; do
381+
cd packages/core/$pkg
382+
npm publish --registry http://localhost:4873 || echo "Failed to publish $pkg"
383+
cd ../../..
384+
done
360385
361386
- name: Start Supabase and apply migrations
362387
run: |
@@ -377,8 +402,7 @@ jobs:
377402
- name: Install dependencies and run tests
378403
run: |
379404
cd packages/core/supabase-js/test/integration/expo
380-
cp ../../../supabase-pkg/supabase-supabase-js-0.0.0-automated.tgz .
381-
npm install
405+
npm install --registry http://localhost:4873
382406
npm test || npm test
383407
384408
- name: Stop Supabase
@@ -403,16 +427,32 @@ jobs:
403427
with:
404428
bun-version: latest
405429

430+
- name: Setup Node.js
431+
uses: actions/setup-node@v4
432+
with:
433+
node-version: ${{ env.NODE_VERSION }}
434+
cache: 'npm'
435+
406436
- name: Setup Supabase CLI
407437
uses: supabase/setup-cli@v1
408438
with:
409439
version: latest
410440

411-
- name: Download artifact
412-
uses: actions/download-artifact@v4
413-
with:
414-
name: supabase-tgz
415-
path: ./packages/core/supabase-js/supabase-pkg
441+
- name: Install dependencies and build
442+
run: |
443+
npm ci --legacy-peer-deps
444+
npx nx build supabase-js
445+
446+
- name: Start Verdaccio and publish packages
447+
run: |
448+
npx verdaccio --config .verdaccio/config.yml &
449+
sleep 5
450+
npm set registry http://localhost:4873/
451+
for pkg in auth-js functions-js postgrest-js realtime-js storage-js supabase-js; do
452+
cd packages/core/$pkg
453+
npm publish --registry http://localhost:4873 || echo "Failed to publish $pkg"
454+
cd ../../..
455+
done
416456
417457
- name: Start Supabase and apply migrations
418458
run: |
@@ -433,7 +473,7 @@ jobs:
433473
- name: Install dependencies and run tests
434474
run: |
435475
cd packages/core/supabase-js/test/integration/bun
436-
cp ../../../supabase-pkg/supabase-supabase-js-0.0.0-automated.tgz .
476+
npm set registry http://localhost:4873/
437477
bun install
438478
bun test
439479

packages/core/supabase-js/test/deno/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
"setup-deps": "node setup-deps.js"
88
},
99
"dependencies": {
10-
"@supabase/supabase-js": "file:supabase-supabase-js-0.0.0-automated.tgz"
10+
"@supabase/supabase-js": "*"
1111
}
1212
}

packages/core/supabase-js/test/integration/bun/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"test:watch": "bun test --watch integration.test.ts"
77
},
88
"dependencies": {
9-
"@supabase/supabase-js": "file:supabase-supabase-js-0.0.0-automated.tgz"
9+
"@supabase/supabase-js": "*"
1010
},
1111
"devDependencies": {
1212
"bun-types": "latest"

packages/core/supabase-js/test/integration/expo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@react-navigation/bottom-tabs": "^7.3.10",
1717
"@react-navigation/elements": "^2.3.8",
1818
"@react-navigation/native": "^7.1.6",
19-
"@supabase/supabase-js": "file:supabase-supabase-js-0.0.0-automated.tgz",
19+
"@supabase/supabase-js": "*",
2020
"expo": "~53.0.9",
2121
"expo-blur": "~14.1.4",
2222
"expo-constants": "~17.1.6",

packages/core/supabase-js/test/integration/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@radix-ui/react-label": "^2.1.6",
1818
"@radix-ui/react-slot": "^1.2.2",
1919
"@supabase/ssr": "latest",
20-
"@supabase/supabase-js": "file:supabase-supabase-js-0.0.0-automated.tgz",
20+
"@supabase/supabase-js": "*",
2121
"class-variance-authority": "^0.7.1",
2222
"clsx": "^2.1.1",
2323
"lucide-react": "^0.511.0",

0 commit comments

Comments
 (0)