forked from Deen-Bridge/dnb-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (82 loc) · 2.32 KB
/
Copy pathci.yml
File metadata and controls
96 lines (82 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: CI
on:
pull_request:
branches: [main, dev]
push:
branches: [main, dev]
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:7
ports:
- 27017:27017
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
env:
NODE_ENV: test
PORT: 5000
MONGO_URI: mongodb://localhost:27017/deenbridge_test
JWT_SECRET: test-secret-key-for-ci-minimum-32-chars
STELLAR_NETWORK: testnet
CLOUDINARY_CLOUD_NAME: ci_test_cloud
CLOUDINARY_API_KEY: ci_test_key
CLOUDINARY_API_SECRET: ci_test_secret_that_should_not_leak
build:
name: Syntax and Boot Check
runs-on: ubuntu-latest
services:
mongodb:
image: mongo:7
ports:
- 27017:27017
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Check syntax of all source files
run: |
find . -name "*.js" -not -path "./node_modules/*" -print0 \
| xargs -0 -n1 node --check
- name: Boot server and hit /health
run: |
node server.js &
SERVER_PID=$!
for i in $(seq 1 30); do
if curl -sf http://localhost:5000/health > /dev/null; then
echo "Server is up and healthy"
kill $SERVER_PID
exit 0
fi
sleep 2
done
echo "Server failed to become healthy in time"
kill $SERVER_PID || true
exit 1
env:
NODE_ENV: test
PORT: 5000
MONGO_URI: mongodb://localhost:27017/deenbridge_boot
JWT_SECRET: test-secret-key-for-ci-minimum-32-chars
STELLAR_NETWORK: testnet
CLOUDINARY_CLOUD_NAME: ci_test_cloud
CLOUDINARY_API_KEY: ci_test_key
CLOUDINARY_API_SECRET: ci_test_secret_that_should_not_leak