This repository was archived by the owner on Feb 16, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (103 loc) · 3.75 KB
/
Copy pathci-dev.yml
File metadata and controls
125 lines (103 loc) · 3.75 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: CI - Dev Branch
on:
push:
branches:
- dev
pull_request:
branches:
- main
jobs:
lint-and-test:
name: Lint & Test All Services
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install all dependencies
run: |
cd backend/api-gateway && npm ci
cd ../auth-service && npm ci
cd ../quiz-service && npm ci
cd ../result-service && npm ci
cd ../../archive/frontendOld && npm ci
- name: Run linting
run: |
cd backend/api-gateway && npm run lint || echo "No lint"
cd ../auth-service && npm run lint || echo "No lint"
cd ../quiz-service && npm run lint || echo "No lint"
cd ../result-service && npm run lint || echo "No lint"
cd ../../archive/frontendOld && npm run lint
integration-test:
name: Integration Test
runs-on: ubuntu-latest
needs: lint-and-test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create .env files
run: |
cp container/env/gateway.env.example backend/api-gateway/.env
cp container/env/auth.env.example backend/auth-service/.env
cp container/env/quiz.env.example backend/quiz-service/.env
cp container/env/result.env.example backend/result-service/.env
cp archive/frontendOld/.env.example archive/frontendOld/.env
- name: Start services
run: docker compose -f container/compose/docker-compose.dev.yml up -d
- name: Wait for services
run: sleep 30
- name: Check services health
run: |
check() {
for i in {1..30}; do
echo "Checking $1 ... attempt $i"
curl -sf "$1" && return 0
sleep 2
done
return 1
}
check http://localhost:8000 || exit 1
check http://localhost:8000/api/auth/health || exit 1
check http://localhost:8000/api/quiz/health || exit 1
check http://localhost:8000/api/result/health || exit 1
- name: Show logs on failure
if: failure()
run: docker compose -f container/compose/docker-compose.dev.yml logs
- name: Cleanup
if: always()
run: docker compose -f container/compose/docker-compose.dev.yml down -v
docker-push:
name: Build & Push Docker Images
runs-on: ubuntu-latest
needs: integration-test
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & Push API Gateway
run: |
docker build -f container/dockerfiles/dev/gateway.dev.Dockerfile \
-t minhtri269/qms-gateway:dev backend/api-gateway
docker push minhtri269/qms-gateway:dev
- name: Build & Push Auth Service
run: |
docker build -f container/dockerfiles/dev/auth.dev.Dockerfile \
-t minhtri269/qms-auth:dev backend/auth-service
docker push minhtri269/qms-auth:dev
- name: Build & Push Quiz Service
run: |
docker build -f container/dockerfiles/dev/quiz.dev.Dockerfile \
-t minhtri269/qms-quiz:dev backend/quiz-service
docker push minhtri269/qms-quiz:dev
- name: Build & Push Result Service
run: |
docker build -f container/dockerfiles/dev/result.dev.Dockerfile \
-t minhtri269/qms-result:dev backend/result-service
docker push minhtri269/qms-result:dev