-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.gitlab-ci.yml
126 lines (108 loc) · 3.3 KB
/
.gitlab-ci.yml
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
126
# Git Breakdown CI/CD configuration file.
stages:
- build
- test
- deploy
# Stage I
# Build Phase:
# This is where the main code is built.
build:
image: docker:dind
stage: build
script:
- sudo docker-compose down
- sudo docker-compose build
# Stage II
# Testing Phase:
# This is where the main code is tested.
# Other options like code coverage, etc are also written in this phase
api_gateway:
stage: test
image: node:alpine
before_script:
# install requirement to api_gateway
- echo "exports.token = '$GIT_TOKEN'" >> ./APIs/constants.js
- npm --prefix ./APIs/api_gateway install ./APIs/api_gateway
script:
- sudo docker-compose up -d
- npm test --prefix ./APIs/api_gateway
- sudo docker-compose down
branches_request:
stage: test
image: node:alpine
before_script:
# install requirement to branches_request
- echo "exports.token = '$GIT_TOKEN'" >> ./APIs/constants.js
- npm --prefix ./APIs/branches_request install ./APIs/branches_request
script:
- sudo docker-compose up -d
- npm test --prefix ./APIs/branches_request
- sudo docker-compose down
pullrequests_request:
stage: test
image: node:alpine
before_script:
# install requirement to pullrequests_request
- echo "exports.token = '$GIT_TOKEN'" >> ./APIs/constants.js
- npm --prefix ./APIs/pullrequests_request install ./APIs/pullrequests_request
script:
- sudo docker-compose up -d
- npm test --prefix ./APIs/pullrequests_request
- sudo docker-compose down
issues_request:
stage: test
image: node:alpine
before_script:
# install requirement to issues_request
- echo "exports.token = '$GIT_TOKEN'" >> ./APIs/constants.js
- npm --prefix ./APIs/issues_request install ./APIs/issues_request
script:
- sudo docker-compose up -d
- npm test --prefix ./APIs/issues_request
- sudo docker-compose down
commits_request:
stage: test
image: node:alpine
before_script:
# install requirement to commits_request
- echo "exports.token = '$GIT_TOKEN'" >> ./APIs/constants.js
- npm --prefix ./APIs/commits_request install ./APIs/commits_request
script:
- sudo docker-compose up -d
- npm test --prefix ./APIs/commits_request
- sudo docker-compose down
profile_request:
stage: test
image: node:alpine
before_script:
# install requirement to profile_request
- echo "exports.token = '$GIT_TOKEN'" >> ./APIs/constants.js
- npm --prefix ./APIs/profile_request install ./APIs/profile_request
script:
- sudo docker-compose up -d
- npm test --prefix ./APIs/profile_request
- sudo docker-compose down
ranking_request:
stage: test
image: node:alpine
before_script:
# install requirement to ranking_request
- echo "exports.token = '$GIT_TOKEN'" >> ./APIs/constants.js
- npm --prefix ./APIs/ranking_request install ./APIs/ranking_request
script:
- sudo docker-compose up -d
- npm test --prefix ./APIs/ranking_request
- sudo docker-compose down
# Stage III
# Deploying Phase:
# This is where the main code is deployed to our server at AWS.
deploy:
stage: deploy
image: ubuntu:latest
before_script:
- "which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )"
- chmod a+x ./deploy/disableHostKeyChecking.sh
script:
- bash deploy/deploy.sh
only:
- master