Skip to content

Commit 31904ed

Browse files
ci: add GitHub Actions workflow for automated testing and Vercel deployment
1 parent d021eae commit 31904ed

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

.github/workflows/test.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Setup Node.js
2424
uses: actions/setup-node@v4
2525
with:
26-
node-version: 20
26+
node-version: 24
2727
cache: 'npm'
2828

2929
- name: Install Root Dependencies
@@ -33,7 +33,19 @@ jobs:
3333
run: npm ci --prefix server
3434

3535
- name: Install Client Dependencies
36-
run: npm ci --prefix client
36+
run: npm install --prefix client --legacy-peer-deps
37+
38+
- name: Wait for MongoDB
39+
run: |
40+
for i in {1..10}; do
41+
if nc -z localhost 27017; then
42+
echo "MongoDB is up!"
43+
exit 0
44+
fi
45+
echo "Waiting for MongoDB..."
46+
sleep 2
47+
done
48+
exit 1
3749
3850
- name: Run Linting
3951
run: npm run lint --prefix client || echo "Linting failed but continuing..."
@@ -43,9 +55,12 @@ jobs:
4355
env:
4456
MONGO_URI: mongodb://localhost:27017/test
4557
PORT: 5000
58+
JWT_SECRET: test_secret
4659

4760
- name: Run Client Tests
4861
run: npm test --prefix client
62+
env:
63+
NODE_ENV: test
4964

5065
- name: Build Project
5166
run: |
@@ -60,6 +75,11 @@ jobs:
6075
- name: Checkout Repository
6176
uses: actions/checkout@v4
6277

78+
- name: Setup Node.js
79+
uses: actions/setup-node@v4
80+
with:
81+
node-version: 24
82+
6383
- name: Deploy to Vercel
6484
uses: amondnet/vercel-action@v20
6585
with:

0 commit comments

Comments
 (0)