.gitlab-ci.yml 5.3 KB
Newer Older
J
James Lopez 已提交
1
image: "ruby:2.1"
2 3 4 5 6 7

services:
  - mysql:latest
  - postgres:latest
  - redis:latest

8
cache:
9
  key: "ruby21"
10 11 12
  paths:
  - vendor

13 14 15
variables:
  MYSQL_ALLOW_EMPTY_PASSWORD: "1"

D
Dmitriy Zaporozhets 已提交
16
before_script:
K
Kamil Trzcinski 已提交
17
  - source ./scripts/prepare_build.sh
V
Valery Sizov 已提交
18 19
  - ruby -v
  - which ruby
20
  - gem install bundler --no-ri --no-rdoc
V
Valery Sizov 已提交
21 22 23
  - cp config/gitlab.yml.example config/gitlab.yml
  - touch log/application.log
  - touch log/test.log
24
  - bundle install --without postgres production --jobs $(nproc)  "${FLAGS[@]}"
25
  - RAILS_ENV=test bundle exec rake db:drop db:create db:schema:load db:migrate
26

27 28 29 30
stages:
- test
- notifications

31
spec:feature:
32
  stage: test
33
  script:
34
    - RAILS_ENV=test bundle exec rake assets:precompile 2>/dev/null
35 36 37 38 39 40
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:feature
  tags:
    - ruby
    - mysql

spec:api:
41
  stage: test
42 43 44 45 46 47
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:api
  tags:
    - ruby
    - mysql

D
Douwe Maan 已提交
48
spec:models:
49
  stage: test
D
Douwe Maan 已提交
50 51 52 53 54 55
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:models
  tags:
    - ruby
    - mysql

D
Douwe Maan 已提交
56
spec:lib:
57
  stage: test
D
Douwe Maan 已提交
58 59 60 61 62 63 64
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:lib
  tags:
    - ruby
    - mysql

spec:services:
65
  stage: test
D
Douwe Maan 已提交
66 67 68 69 70 71
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:services
  tags:
    - ruby
    - mysql

72
spec:benchmark:
73
  stage: test
74 75 76 77 78
  script:
    - RAILS_ENV=test bundle exec rake spec:benchmark
  tags:
    - ruby
    - mysql
79
  allow_failure: true
80

81
spec:other:
82
  stage: test
83 84 85 86 87 88
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:other
  tags:
    - ruby
    - mysql

D
Douwe Maan 已提交
89
spinach:project:half:
90
  stage: test
V
Valery Sizov 已提交
91
  script:
D
Douwe Maan 已提交
92 93 94 95 96 97
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project:half
  tags:
    - ruby
    - mysql

spinach:project:rest:
98
  stage: test
V
Valery Sizov 已提交
99
  script:
D
Douwe Maan 已提交
100
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project:rest
V
Valery Sizov 已提交
101 102 103 104
  tags:
    - ruby
    - mysql

105
spinach:other:
106
  stage: test
V
Valery Sizov 已提交
107
  script:
108
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:other
V
Valery Sizov 已提交
109 110 111 112
  tags:
    - ruby
    - mysql

113
teaspoon:
114
  stage: test
V
Valery Sizov 已提交
115
  script:
116
    - RAILS_ENV=test bundle exec teaspoon
V
Valery Sizov 已提交
117 118 119 120
  tags:
    - ruby
    - mysql

121
rubocop:
122
  stage: test
V
Valery Sizov 已提交
123 124 125 126 127 128
  script:
    - bundle exec rubocop
  tags:
    - ruby
    - mysql

129
brakeman:
130
  stage: test
V
Valery Sizov 已提交
131 132 133 134
  script:
    - bundle exec rake brakeman
  tags:
    - ruby
135
    - mysql
136 137

flog:
138
  stage: test
139 140 141 142 143
  script:
    - bundle exec rake flog
  tags:
    - ruby
    - mysql
144 145

flay:
146
  stage: test
147 148 149 150 151
  script:
    - bundle exec rake flay
  tags:
    - ruby
    - mysql
D
Dmitriy Zaporozhets 已提交
152

D
Dmitriy Zaporozhets 已提交
153
bundler:audit:
154
  stage: test
155
  script:
D
Dmitriy Zaporozhets 已提交
156 157
    - "bundle exec bundle-audit update"
    - "bundle exec bundle-audit check"
D
Dmitriy Zaporozhets 已提交
158 159 160
  tags:
    - ruby
    - mysql
161
  allow_failure: true
162

J
James Lopez 已提交
163
# Ruby 2.2 jobs
164

165
spec:feature:ruby22:
166
  stage: test
167
  image: ruby:2.2
168 169
  only:
  - master
170 171
  script:
    - RAILS_ENV=test bundle exec rake assets:precompile 2>/dev/null
172
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:feature
173
  cache:
174
    key: "ruby22"
175 176
    paths:
    - vendor
177 178 179
  tags:
    - ruby
    - mysql
180

181
spec:api:ruby22:
J
James Lopez 已提交
182
  stage: test
183
  image: ruby:2.2
184 185
  only:
  - master
186 187
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:api
188
  cache:
189
    key: "ruby22"
190 191
    paths:
    - vendor
192 193 194
  tags:
    - ruby
    - mysql
195

196
spec:models:ruby22:
197
  stage: test
198
  image: ruby:2.2
199 200
  only:
  - master
201
  script:
202
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:models
203
  cache:
204
    key: "ruby22"
205 206
    paths:
    - vendor
207 208 209
  tags:
    - ruby
    - mysql
210

211
spec:lib:ruby22:
J
James Lopez 已提交
212
  stage: test
213
  image: ruby:2.2
214 215
  only:
  - master
216 217
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:lib
218
  cache:
219
    key: "ruby22"
220 221
    paths:
    - vendor
222 223 224
  tags:
    - ruby
    - mysql
225

226
spec:services:ruby22:
J
James Lopez 已提交
227
  stage: test
228
  image: ruby:2.2
229 230
  only:
  - master
231
  script:
232
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:services
233
  cache:
234
    key: "ruby22"
235 236
    paths:
    - vendor
237 238 239
  tags:
    - ruby
    - mysql
240

241
spec:benchmark:ruby22:
J
James Lopez 已提交
242 243
  stage: test
  image: ruby:2.2
244 245
  only:
  - master
246 247
  script:
    - RAILS_ENV=test bundle exec rake spec:benchmark
248
  cache:
249
    key: "ruby22"
250 251
    paths:
    - vendor
252 253 254 255 256
  tags:
    - ruby
    - mysql
  allow_failure: true

257
spec:other:ruby22:
J
James Lopez 已提交
258
  stage: test
259
  image: ruby:2.2
260 261 262 263
  only:
  - master
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:other
264
  cache:
265
    key: "ruby22"
266 267
    paths:
    - vendor
268 269 270 271
  tags:
    - ruby
    - mysql

272
spinach:project:half:ruby22:
J
James Lopez 已提交
273
  stage: test
274
  image: ruby:2.2
275 276 277 278
  only:
  - master
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project:half
279
  cache:
280
    key: "ruby22"
281 282
    paths:
    - vendor
283 284 285 286
  tags:
    - ruby
    - mysql

287
spinach:project:rest:ruby22:
J
James Lopez 已提交
288
  stage: test
289
  image: ruby:2.2
290 291 292 293
  only:
  - master
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project:rest
294
  cache:
295
    key: "ruby22"
296 297
    paths:
    - vendor
298 299 300 301
  tags:
    - ruby
    - mysql

302
spinach:other:ruby22:
J
James Lopez 已提交
303
  stage: test
304
  image: ruby:2.2
305 306 307 308
  only:
  - master
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:other
309
  cache:
310
    key: "ruby22"
311 312
    paths:
    - vendor
313 314 315
  tags:
    - ruby
    - mysql
316

317 318 319 320

notify:slack:
  stage: notifications
  script:
321
    - ./scripts/notify_slack.sh "#builds" "Build failed for master/tags!"
322
  when: on_failure
323 324 325 326 327
  only:
    - master@gitlab-org/gitlab-ce
    - tags@gitlab-org/gitlab-ce
    - master@gitlab-org/gitlab-ee
    - tags@gitlab-org/gitlab-ee