Skip to content

Commit 55551ac

Browse files
committed
Fix TypeScript array type annotation in integration test
- Add explicit number[] type to cleanResponses array - Resolves 'Argument of type any is not assignable to parameter of type never' error
1 parent a8db45a commit 55551ac

4 files changed

Lines changed: 194 additions & 150 deletions

File tree

.github/workflows/ci.yml

Lines changed: 61 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -6,121 +6,106 @@ on:
66
pull_request:
77
branches: [main, develop]
88

9+
permissions:
10+
contents: read
11+
912
concurrency:
1013
group: ci-${{ github.ref }}
1114
cancel-in-progress: true
1215

1316
jobs:
1417
test-server:
1518
runs-on: ubuntu-latest
19+
timeout-minutes: 20
20+
env:
21+
CI: true
1622
steps:
1723
- uses: actions/checkout@v4
18-
19-
- name: Setup Node.js (match local 24.3.0)
20-
uses: actions/setup-node@v4
24+
- uses: actions/setup-node@v4
2125
with:
22-
node-version: "24.3.0"
23-
cache: "npm"
26+
node-version: 24.3.0
27+
cache: npm
2428
cache-dependency-path: server/package-lock.json
25-
26-
- name: Use matching npm (11.4.2) + show versions
29+
- name: Match npm version (11.4.2) & verify
2730
run: |
28-
npm i -g npm@11.4.2
31+
npm install -g npm@11.4.2
2932
node -v
3033
npm -v
31-
32-
- name: Install dependencies
33-
working-directory: server
34-
run: npm ci
35-
36-
- name: Run linter
37-
working-directory: server
38-
run: npm run lint
39-
40-
- name: Run tests
34+
- name: Install, lint, test, build
4135
working-directory: server
42-
run: npm test
43-
44-
- name: Build
45-
working-directory: server
46-
run: npm run build
36+
run: |
37+
npm ci
38+
npm run lint
39+
npm test
40+
npm run build
41+
- name: Upload server build
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: server-build
45+
path: server/dist
4746

4847
test-mobile:
4948
runs-on: ubuntu-latest
49+
timeout-minutes: 40
50+
env:
51+
CI: true
5052
steps:
5153
- uses: actions/checkout@v4
52-
53-
# Flutter pinned to your local: 3.35.3 (stable)
54-
- name: Setup Flutter
55-
uses: subosito/flutter-action@v2
54+
- uses: subosito/flutter-action@v2
5655
with:
57-
flutter-version: "3.35.3"
58-
channel: "stable"
56+
flutter-version: 3.35.3
57+
channel: stable
5958
cache: true
60-
61-
- name: Setup Java 17
62-
uses: actions/setup-java@v4
59+
- uses: actions/setup-java@v4
6360
with:
6461
distribution: temurin
65-
java-version: "17"
62+
java-version: 17
6663
cache: gradle
67-
68-
- name: Setup Android SDK
69-
uses: android-actions/setup-android@v3
70-
71-
- name: Show Flutter version (sanity check)
72-
run: flutter --version
73-
74-
- name: Install dependencies
75-
working-directory: mobile
76-
run: flutter pub get
77-
78-
- name: Analyze code
79-
working-directory: mobile
80-
run: flutter analyze
81-
82-
- name: Run tests
83-
working-directory: mobile
84-
run: flutter test
85-
86-
- name: Build APK (release)
87-
working-directory: mobile
88-
run: flutter build apk --release
64+
- uses: android-actions/setup-android@v3
65+
- run: flutter --version
66+
- working-directory: mobile
67+
run: |
68+
flutter pub get
69+
flutter analyze
70+
flutter test
71+
flutter build apk --release
72+
- name: Upload APK
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: app-release-apk
76+
path: mobile/build/app/outputs/flutter-apk/app-release.apk
8977

9078
test-integration:
9179
runs-on: ubuntu-latest
9280
needs: [test-server, test-mobile]
81+
timeout-minutes: 20
82+
env:
83+
CI: true
9384
steps:
9485
- uses: actions/checkout@v4
95-
96-
- name: Setup Node.js (match local 24.3.0)
97-
uses: actions/setup-node@v4
86+
- uses: actions/setup-node@v4
9887
with:
99-
node-version: "24.3.0"
100-
cache: "npm"
88+
node-version: 24.3.0
89+
cache: npm
10190
cache-dependency-path: server/package-lock.json
102-
103-
- name: Use matching npm (11.4.2) + show versions
91+
- name: Match npm version (11.4.2) & verify
10492
run: |
105-
npm i -g npm@11.4.2
93+
npm install -g npm@11.4.2
10694
node -v
10795
npm -v
108-
109-
- name: Install server dependencies
110-
working-directory: server
111-
run: npm ci
112-
113-
- name: Start server
96+
- name: Install & start server
11497
working-directory: server
11598
run: |
99+
npm ci
116100
npm run build
117-
npm start &
118-
# give the server a moment to boot
119-
sleep 10
120-
121-
- name: Test API endpoints
101+
nohup npm start &
102+
sleep 5
103+
- name: Run integration tests (API endpoints) with retry
122104
run: |
123-
curl -fsS http://localhost:3000/health
105+
for i in {1..10}; do
106+
if curl -fsS http://localhost:3000/health; then break; fi
107+
sleep 2
108+
done
124109
curl -fsS -X POST http://localhost:3000/api/clean \
125110
-H "Content-Type: application/json" \
126-
-d '{"url":"https://example.com?utm_source=test"}'
111+
-d '{"url":"https://example.co

.github/workflows/deploy.yml

Lines changed: 63 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,34 @@ on:
66
pull_request:
77
branches: [main]
88

9+
permissions:
10+
contents: read
11+
12+
env:
13+
CI: true
14+
915
jobs:
1016
test:
1117
name: Run Tests
1218
runs-on: ubuntu-latest
19+
timeout-minutes: 40
1320

1421
steps:
1522
- name: Checkout code
1623
uses: actions/checkout@v4
1724

25+
# Node for root + server (cache both lockfiles if they exist)
1826
- name: Setup Node.js
1927
uses: actions/setup-node@v4
2028
with:
21-
node-version: "18"
22-
cache: "npm"
23-
cache-dependency-path: "package-lock.json"
29+
node-version: 18
30+
cache: npm
31+
cache-dependency-path: |
32+
package-lock.json
33+
server/package-lock.json
2434
2535
- name: Install root dependencies
36+
if: hashFiles('package-lock.json') != ''
2637
run: npm ci
2738

2839
- name: Install server dependencies
@@ -40,11 +51,23 @@ jobs:
4051
cd server
4152
npm run lint
4253
54+
# Tooling needed for Android + Web builds
4355
- name: Setup Flutter
4456
uses: subosito/flutter-action@v2
4557
with:
46-
flutter-version: "3.19.5"
47-
channel: "stable"
58+
flutter-version: 3.19.5
59+
channel: stable
60+
cache: true
61+
62+
- name: Setup Java 17
63+
uses: actions/setup-java@v4
64+
with:
65+
distribution: temurin
66+
java-version: 17
67+
cache: gradle
68+
69+
- name: Setup Android SDK
70+
uses: android-actions/setup-android@v3
4871

4972
- name: Install Flutter dependencies
5073
run: |
@@ -61,12 +84,12 @@ jobs:
6184
cd mobile
6285
flutter analyze
6386
64-
- name: Build Flutter app (Android)
87+
- name: Build Flutter app (Android debug)
6588
run: |
6689
cd mobile
6790
flutter build apk --debug
6891
69-
- name: Build Flutter app (Web)
92+
- name: Build Flutter app (Web release)
7093
run: |
7194
cd mobile
7295
flutter build web --release
@@ -75,6 +98,7 @@ jobs:
7598
name: Deploy Server to Vercel
7699
needs: test
77100
runs-on: ubuntu-latest
101+
timeout-minutes: 20
78102
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
79103

80104
steps:
@@ -84,9 +108,9 @@ jobs:
84108
- name: Setup Node.js
85109
uses: actions/setup-node@v4
86110
with:
87-
node-version: "18"
88-
cache: "npm"
89-
cache-dependency-path: "server/package-lock.json"
111+
node-version: 18
112+
cache: npm
113+
cache-dependency-path: server/package-lock.json
90114

91115
- name: Install server dependencies
92116
run: |
@@ -98,19 +122,20 @@ jobs:
98122
cd server
99123
npm run build
100124
101-
- name: Deploy to Vercel
125+
- name: Deploy to Vercel (prod)
102126
uses: amondnet/vercel-action@v25
103127
with:
104128
vercel-token: ${{ secrets.VERCEL_TOKEN }}
105129
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
106130
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
107131
working-directory: ./server
108-
vercel-args: "--prod"
132+
vercel-args: "--prod --confirm"
109133

110134
deploy-mobile:
111135
name: Build Mobile App
112136
needs: test
113137
runs-on: ubuntu-latest
138+
timeout-minutes: 60
114139
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
115140

116141
steps:
@@ -120,25 +145,36 @@ jobs:
120145
- name: Setup Flutter
121146
uses: subosito/flutter-action@v2
122147
with:
123-
flutter-version: "3.19.5"
124-
channel: "stable"
148+
flutter-version: 3.19.5
149+
channel: stable
150+
cache: true
151+
152+
- name: Setup Java 17
153+
uses: actions/setup-java@v4
154+
with:
155+
distribution: temurin
156+
java-version: 17
157+
cache: gradle
158+
159+
- name: Setup Android SDK
160+
uses: android-actions/setup-android@v3
125161

126162
- name: Install Flutter dependencies
127163
run: |
128164
cd mobile
129165
flutter pub get
130166
131-
- name: Build Android APK
167+
- name: Build Android APK (release)
132168
run: |
133169
cd mobile
134170
flutter build apk --release
135171
136-
- name: Build Android App Bundle
172+
- name: Build Android App Bundle (release)
137173
run: |
138174
cd mobile
139175
flutter build appbundle --release
140176
141-
- name: Build Web App
177+
- name: Build Web App (release)
142178
run: |
143179
cd mobile
144180
flutter build web --release
@@ -169,15 +205,20 @@ jobs:
169205

170206
steps:
171207
- name: Notify Success
172-
if: needs.test.result == 'success' && needs.deploy-server.result == 'success'
208+
if: |
209+
needs.test.result == 'success' &&
210+
needs.deploy-server.result == 'success' &&
211+
needs.deploy-mobile.result == 'success'
173212
run: |
174-
echo "✅ All tests passed and deployment successful!"
213+
echo "✅ All tests passed and deployments succeeded!"
175214
echo "🚀 Server deployed to Vercel"
176215
echo "📱 Mobile app built successfully"
177216
178217
- name: Notify Failure
179-
if: needs.test.result == 'failure' || needs.deploy-server.result == 'failure'
218+
if: |
219+
needs.test.result != 'success' ||
220+
needs.deploy-server.result != 'success' ||
221+
needs.deploy-mobile.result != 'success'
180222
run: |
181-
echo "❌ Tests failed or deployment failed!"
182-
echo "Check the logs for details"
223+
echo "❌ Tests or deployments failed. Check job logs for details."
183224
exit 1

0 commit comments

Comments
 (0)