Skip to content

Commit c131801

Browse files
authored
ci: improve workflow performance and reliability (#1469)
* ci: improve workflow performance and reliability - Add fail-fast: false to matrix strategies for better error visibility - Replace npm clean-install with npm ci for faster, more reliable builds - Add npm caching to all Node.js setup steps - Add if: always() to cleanup steps to ensure Supabase stops on failure - Add NODE_VERSION environment variable for consistency - Add descriptive step names for better debugging - Expand test matrix to include Node 22, 24 and multiple OS platforms - Update Coveralls action to v2 and add conditional execution - Add workflow_call trigger for reusable workflows * ci: improve expo test organization - Split expo test steps for better clarity and debugging - Separate dependency installation and build from test execution - Use npm install instead of npm ci for expo test dependencies * chore: add .cursor/ to gitignore - Ignore Cursor IDE configuration files and workspace data * chore(deps): update expo test dependencies - Update React to 19.1.0 - Update @supabase/realtime-js to 2.11.15 - Add @types/ws and ws dependencies for WebSocket support * chore(ci): optimize workflow performance and reduce matrix testing - Reduce Node.js matrix from [20, 22, 24] to [20] for faster CI runs - Remove conditional coverage upload to simplify workflow - Remove security audit job to reduce CI complexity and runtime - Maintains all essential testing while improving CI efficiency
1 parent 13239a4 commit c131801

File tree

5 files changed

+118
-47
lines changed

5 files changed

+118
-47
lines changed

.github/workflows/ci.yml

Lines changed: 84 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,32 @@ on:
1717
- '**/*.md'
1818
- '.prettierrc'
1919
- '**/*ignore'
20+
workflow_call:
21+
22+
env:
23+
NODE_VERSION: '20'
2024

2125
jobs:
2226
test:
23-
name: Unit + Type Check / Node.js ${{ matrix.node }}
24-
runs-on: ubuntu-latest
27+
name: Unit + Type Check / Node.js ${{ matrix.node }} / OS ${{ matrix.os }}
28+
runs-on: ${{ matrix.os }}
2529
strategy:
2630
matrix:
2731
node: [20]
32+
os: [ubuntu-latest, macos-latest, windows-latest]
33+
fail-fast: false
2834
steps:
29-
- uses: actions/checkout@v4
30-
- uses: actions/setup-node@v4
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
38+
- name: Setup Node.js
39+
uses: actions/setup-node@v4
3140
with:
3241
node-version: ${{ matrix.node }}
42+
cache: 'npm'
3343

34-
- run: npm clean-install
44+
- name: Install dependencies
45+
run: npm ci
3546

3647
- name: Type Check
3748
run: npm run test:types
@@ -40,7 +51,7 @@ jobs:
4051
run: npm run test:coverage
4152

4253
- name: Upload coverage results to Coveralls
43-
uses: coverallsapp/github-action@master
54+
uses: coverallsapp/github-action@v2
4455
with:
4556
github-token: ${{ secrets.GITHUB_TOKEN }}
4657
path-to-lcov: ./test/coverage/lcov.info
@@ -51,24 +62,39 @@ jobs:
5162
strategy:
5263
matrix:
5364
deno: ['1.x', '2.x']
65+
fail-fast: false
5466
steps:
55-
- uses: actions/checkout@v4
56-
- uses: denoland/setup-deno@v2
67+
- name: Checkout code
68+
uses: actions/checkout@v4
69+
70+
- name: Setup Deno
71+
uses: denoland/setup-deno@v2
5772
with:
5873
deno-version: ${{ matrix.deno }}
59-
- uses: supabase/setup-cli@v1
74+
75+
- name: Setup Supabase CLI
76+
uses: supabase/setup-cli@v1
6077
with:
6178
version: latest
6279

80+
- name: Setup Node.js
81+
uses: actions/setup-node@v4
82+
with:
83+
node-version: ${{ env.NODE_VERSION }}
84+
cache: 'npm'
85+
6386
- name: Start Supabase
6487
run: supabase start
6588

66-
- name: Run Deno Tests
89+
- name: Install dependencies and build
6790
run: |
68-
npm clean-install
91+
npm ci
6992
npm run build
93+
94+
- name: Run Deno Tests
95+
run: |
7096
cd test/deno
71-
npm install
97+
npm ci
7298
npm test || npm test
7399
74100
# - name: Run integration and browser tests on Deno 2.x only
@@ -77,41 +103,57 @@ jobs:
77103
# npm run test:integration:browser
78104

79105
- name: Stop Supabase
106+
if: always()
80107
run: supabase stop
81108

82109
node-integration:
83110
name: Node Integration
84111
runs-on: ubuntu-latest
85112
steps:
86-
- uses: actions/checkout@v4
87-
- uses: actions/setup-node@v4
113+
- name: Checkout code
114+
uses: actions/checkout@v4
115+
116+
- name: Setup Node.js
117+
uses: actions/setup-node@v4
88118
with:
89-
node-version: 20
90-
- uses: supabase/setup-cli@v1
119+
node-version: ${{ env.NODE_VERSION }}
120+
cache: 'npm'
121+
122+
- name: Setup Supabase CLI
123+
uses: supabase/setup-cli@v1
91124
with:
92125
version: latest
93126

94127
- name: Start Supabase
95128
run: supabase start
96129

97-
- name: Run integration tests
130+
- name: Install dependencies and build
98131
run: |
99-
npm clean-install
132+
npm ci
100133
npm run build
101-
npm run test:integration || npm run test:integration
134+
135+
- name: Run integration tests
136+
run: npm run test:integration || npm run test:integration
102137

103138
- name: Stop Supabase
139+
if: always()
104140
run: supabase stop
105141

106142
next-integration:
107143
name: Next.js Integration
108144
runs-on: ubuntu-latest
109145
steps:
110-
- uses: actions/checkout@v4
111-
- uses: actions/setup-node@v4
146+
- name: Checkout code
147+
uses: actions/checkout@v4
148+
149+
- name: Setup Node.js
150+
uses: actions/setup-node@v4
112151
with:
113-
node-version: 20
114-
- uses: supabase/setup-cli@v1
152+
node-version: ${{ env.NODE_VERSION }}
153+
cache: 'npm'
154+
155+
- name: Setup Supabase CLI
156+
uses: supabase/setup-cli@v1
115157
with:
116158
version: latest
117159

@@ -124,39 +166,49 @@ jobs:
124166
- name: Run integration tests
125167
run: |
126168
cd test/integration/next
127-
npm install
169+
npm ci
128170
npx playwright install
129171
npm run test
130172
131173
- name: Stop Supabase
174+
if: always()
132175
run: supabase stop
133176

134177
expo-tests:
135178
name: Expo Tests
136179
runs-on: ubuntu-latest
137180
steps:
138-
- uses: actions/checkout@v4
139-
- uses: actions/setup-node@v4
181+
- name: Checkout code
182+
uses: actions/checkout@v4
183+
184+
- name: Setup Node.js
185+
uses: actions/setup-node@v4
140186
with:
141-
node-version: 20
142-
- uses: supabase/setup-cli@v1
187+
node-version: ${{ env.NODE_VERSION }}
188+
cache: 'npm'
189+
190+
- name: Setup Supabase CLI
191+
uses: supabase/setup-cli@v1
143192
with:
144193
version: latest
145194

146195
- name: Start Supabase
196+
run: supabase start
197+
198+
- name: Install dependencies and build
147199
run: |
148-
supabase start
200+
npm ci
201+
npm run build
149202
150203
- name: Build and test expo
151204
run: |
152-
npm clean-install
153-
npm run build
154205
PKG=$(npm pack)
155206
echo "Packed: $PKG"
156207
cd test/integration/expo
157-
npm install "../../../$PKG"
158208
npm install
209+
npm install "../../../$PKG"
159210
npm test || npm test
160211
161212
- name: Stop Supabase
213+
if: always()
162214
run: supabase stop

.github/workflows/release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ on:
99
workflow_dispatch:
1010

1111
jobs:
12+
test:
13+
uses: ./.github/workflows/ci.yml
14+
1215
release:
1316
name: Release / Node ${{ matrix.node }}
17+
needs: test
1418
strategy:
1519
matrix:
1620
node: ['20']

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,5 @@ dist
105105
.tern-port
106106

107107
docs/v2
108+
109+
.cursor/

package-lock.json

Lines changed: 8 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/integration/expo/package-lock.json

Lines changed: 20 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)