-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
182 lines (168 loc) · 4.18 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
170
171
172
173
174
175
176
177
178
179
180
181
182
include:
- project: "utl-its/gitlab-ci-templates"
file: "/templates/brickyard-upload.gitlab-ci.yml"
- project: "utl-its/gitlab-ci-templates"
file: "/templates/deploy-via-chef.gitlab-ci.yml"
stages:
- build
- test
- publish
- deploy
.build-app:
before_script:
- cd viscoll-app
- npm i
- npm run build
- cd -
- mkdir -p REACT
- cp viscoll-app/build/* ./REACT/ -f -r
build-app-dev:
stage: build
image: node:10.19.0
artifacts:
paths:
- REACT/utlviscoll-app.tar.gz
extends: .build-app
script:
- cd REACT
- tar zcf utlviscoll-app.tar.gz * --transform "s,^,utlviscoll-app/,S"
only:
- usability
build-app-prod:
stage: build
image: node:10.19.0
artifacts:
paths:
- REACT/viscoll-app.tar.gz
extends: .build-app
script:
- cd REACT
- tar zcf viscoll-app.tar.gz * --transform "s,^,viscoll-app/,S"
only:
- master
.build-api:
before_script:
- mkdir -p RAILS RAILS_TEST
- cp viscoll-api/* ./RAILS/ -f -r
- cp viscoll-api/* ./RAILS_TEST/ -f -r
- cd RAILS_TEST
- mongo_URI="mongodb://mongo/viscoll_test"
- sed -i "151 s#mongodb://localhost:27017/viscoll_test#${mongo_URI}#" config/mongoid.yml
- cd ..
build-api-dev:
stage: build
image: ruby:2.6
services:
- mongo:4
artifacts:
paths:
- RAILS_TEST
- RAILS/utlviscoll-api.tar.gz
extends: .build-api
script:
- cd RAILS
- sed -i "21 s/dummy/utlviscoll/" config/initializers/rails_jwt_auth.rb
- sed -i "24 s/dummy/utlviscoll/" config/initializers/rails_jwt_auth.rb
- sed -i "30 s/dummy/utlviscoll/" config/initializers/rails_jwt_auth.rb
- sed -i "18 s/dummy/utlviscoll/" app/mailers/mailer.rb
- sed -i "4 s/dummy/utlviscoll/" app/controllers/application_controller.rb
- tar zcf utlviscoll-api.tar.gz * --transform "s,^,utlviscoll-api/,S"
only:
- usability
build-api-prod:
stage: build
image: ruby:2.6
services:
- mongo:4
artifacts:
paths:
- RAILS_TEST
- RAILS/viscoll-api.tar.gz
extends: .build-api
script:
- cd RAILS
- sed -i "21 s/dummy/viscodex/" config/initializers/rails_jwt_auth.rb
- sed -i "24 s/dummy/viscodex/" config/initializers/rails_jwt_auth.rb
- sed -i "30 s/dummy/viscodex/" config/initializers/rails_jwt_auth.rb
- sed -i "18 s/[email protected]/[email protected]/" app/mailers/mailer.rb
- sed -i "4 s/dummy/viscodex/" app/controllers/application_controller.rb
- tar zcf viscoll-api.tar.gz * --transform "s,^,viscoll-api/,S"
only:
- master
test-api:
image: ruby:2.6
stage: test
services:
- mongo:4
dependencies:
- build-api-dev
- build-api-prod
script:
- cd RAILS_TEST
- gem install bundler
- gem install tzinfo-data
- bundle install
- bundle exec rspec
only:
- usability
- master
publish-api-dev:
extends: .brickyard-upload
stage: publish
dependencies:
- build-api-dev
variables:
BRICKYARD_GROUP_ID: "ca.utoronto.library"
BRICKYARD_ARTIFACT_ID: "utlviscoll-api"
BRICKYARD_FILE: "RAILS/utlviscoll-api.tar.gz"
only:
- usability
publish-api-prod:
extends: .brickyard-upload
stage: publish
dependencies:
- build-api-prod
variables:
BRICKYARD_GROUP_ID: "ca.utoronto.library"
BRICKYARD_ARTIFACT_ID: "viscoll-api"
BRICKYARD_FILE: "RAILS/viscoll-api.tar.gz"
only:
- master
publish-app-dev:
extends: .brickyard-upload
stage: publish
dependencies:
- build-app-dev
variables:
BRICKYARD_GROUP_ID: "ca.utoronto.library"
BRICKYARD_ARTIFACT_ID: "utlviscoll-app"
BRICKYARD_FILE: "REACT/utlviscoll-app.tar.gz"
only:
- usability
publish-app-prod:
extends: .brickyard-upload
stage: publish
dependencies:
- build-app-prod
variables:
BRICKYARD_GROUP_ID: "ca.utoronto.library"
BRICKYARD_ARTIFACT_ID: "viscoll-app"
BRICKYARD_FILE: "REACT/viscoll-app.tar.gz"
only:
- master
deploy-app:
extends: .deploy-via-chef
stage: deploy
variables:
DEPLOY_VIA_CHEF_SEARCH: "recipe:app-viscoll"
only:
- usability
- master
deploy-api:
extends: .deploy-via-chef
stage: deploy
variables:
DEPLOY_VIA_CHEF_SEARCH: "recipe:app-viscoll-api"
only:
- usability
- master