-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
169 lines (155 loc) · 4.63 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#image: node:12-alpine
image: ubuntu:latest
stages:
- test-server
- build-server-client
- deploy-heroku-staging-server
- code_quality
- deploy-heroku-staging-client
# test stage will compile the code and run all the unit tests present in the
# test folder.
test:
stage: test-server
image: maven:latest
tags:
- dalfcs_docker_autoscale
script:
- cd plantOne
- mvn clean verify
# build stage will just build the codebase without running
# any tests or creating any jar file.
build dev:
stage: build-server-client
image: maven:latest
tags:
- dalfcs_docker_autoscale
script:
- cd plantOne
- mvn clean install -DskipTests=true
artifacts:
paths:
- plantOne/target/*.jar
except:
- main
- tags
build test:
stage: build-server-client
image: maven:latest
tags:
- dalfcs_docker_autoscale
script:
- cd plantOne
- mvn clean install -DskipTests=true -Ptest
artifacts:
paths:
- plantOne/target/*.jar
only:
- main
build prod:
stage: build-server-client
image: maven:latest
tags:
- dalfcs_docker_autoscale
script:
- cd plantOne
- mvn clean install -DskipTests=true -Pprod
artifacts:
paths:
- plantOne/target/*.jar
only:
- tags
#Configuration to QServer as a code quality measure
code_quality:
stage: code_quality
variables:
UPLOAD_QUALITY_REPORT: 'curl -X PUT -H "Authorization: Token $QSCORED_API_KEY" -H "repository-link: $CI_PROJECT_URL" + -H "username: sr215260@dal.ca" -H "Content-Type: mulitpart/form-data" --url "https://qscored.com/api/upload/file.xml?is_open_access=false&version=$CI_PIPELINE_IID&project_name=group12" -F "file=@Designite_output/DesigniteAnalysis.xml"'
before_script:
- apt-get update
- ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone
- apt-get --yes --force-yes install wget curl maven git
script:
- wget -O DesigniteJava.jar https://www.dropbox.com/s/mwizkj8uhplz4x3/DesigniteJava.jar?dl=1
- java -jar DesigniteJava.jar -ci -repo "csci-5308/group12" -pat $PAT -host "git.cs.dal.ca/courses/2022-winter/"
- 'eval "$UPLOAD_QUALITY_REPORT"'
only:
refs:
- main
Build Client:
stage: build-server-client
image: node:16
tags:
- dalfcs_docker_autoscale
script:
- cd plant-one-ui
- npm install
- npm run build:testing
## deploy stage will create package the jar and keep it in the target folder.
## The success of deploy stage will mark the pipeline as passed.
deploy testing server:
stage: deploy-heroku-staging-server
image: ruby:latest
tags:
- dalfcs_docker_autoscale
before_script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
script:
- >
curl --request PATCH "https://api.heroku.com/apps/$HEROKU_APP_NAME_FOR_TEST/config-vars"
--data "{\"SPRING_PROFILES_ACTIVE\": \"test\"}"
--header "Content-Type: application/json"
--header "Accept: application/vnd.heroku+json; version=3"
--header "Authorization: Bearer $HEROKU_API_KEY"
- cd plantOne
- dpl --provider=heroku --app=$HEROKU_APP_NAME_FOR_TEST --api-key=$HEROKU_API_KEY --cleanup
only:
- main
deploy testing client:
stage: deploy-heroku-staging-client
image: ruby:latest
tags:
- dalfcs_docker_autoscale
before_script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
script:
- cd plant-one-ui
- dpl --provider=heroku --app=$HEROKU_APP_UI_FOR_TEST --api-key=$HEROKU_API_KEY --cleanup
only:
- main
deploy production server:
stage: deploy-heroku-staging-server
image: ruby:latest
tags:
- dalfcs_docker_autoscale
before_script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
script:
- >
curl --request PATCH "https://api.heroku.com/apps/$HEROKU_APP_NAME_FOR_PRODUCTION/config-vars"
--data "{\"SPRING_PROFILES_ACTIVE\": \"prod\"}"
--header "Content-Type: application/json"
--header "Accept: application/vnd.heroku+json; version=3"
--header "Authorization: Bearer $HEROKU_API_KEY"
- cd plantOne
- dpl --provider=heroku --app=$HEROKU_APP_NAME_FOR_PRODUCTION --api-key=$HEROKU_API_KEY --cleanup
only:
- tags
deploy production client:
stage: deploy-heroku-staging-client
image: ruby:latest
tags:
- dalfcs_docker_autoscale
before_script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
script:
- cd plant-one-ui
- dpl --provider=heroku --app=$HEROKU_APP_UI_FOR_PRODUCTION --api-key=$HEROKU_API_KEY --cleanup
only:
- tags