Read about our upcoming Code of Conduct on this issue

rails.gitlab-ci.yml 9.71 KB
Newer Older
1
.rails:needs:setup-and-assets:
2
  needs: ["setup-test-env pg11", "compile-assets pull-cache"]
3
4

.rails-job-base:
Philippe Lafoucrière's avatar
Philippe Lafoucrière committed
5
  extends:
Stan Hu's avatar
Stan Hu committed
6
7
8
    - .default-retry
    - .default-cache
    - .default-before_script
9

10
####################
11
12
# EE and FOSS jobs #
.base-setup-test-env:
13
  extends:
14
    - .rails-job-base
15
16
17
18
19
20
21
22
23
24
25
26
27
  stage: prepare
  script:
    - bundle exec ruby -Ispec -e 'require "spec_helper" ; TestEnv.init'
    - scripts/gitaly-test-build  # Do not use 'bundle exec' here
  artifacts:
    expire_in: 7d
    paths:
      - tmp/tests
      - config/secrets.yml
      - vendor/gitaly-ruby
  cache:
    policy: pull-push

28
setup-test-env pg11:
29
30
31
  extends:
    - .base-setup-test-env
    - .rails:rules:default-refs-code-backstage-qa
32
    - .use-pg11
33

34
setup-test-env pg10:
35
36
37
  extends:
    - .base-setup-test-env
    - .rails:rules:master-refs-code-backstage
38
    - .use-pg10
39
40
41
42
43
44
45

setup-test-env pg9:
  extends:
    - .base-setup-test-env
    - .rails:rules:nightly-master-refs-code-backstage
    - .use-pg9

46
47
48
49
50
51
52
53
54
55
56
57
static-analysis:
  extends:
    - .rails-job-base
    - .rails:rules:default-refs-code-backstage-qa
    - .rails:needs:setup-and-assets
  stage: test
  variables:
    SETUP_DB: "false"
  parallel: 2
  script:
    - scripts/static-analysis
  cache:
58
    key: "ruby-2.6.5-pg11-rubocop"
59
60
61
62
63
64
65
66
67
    paths:
      - vendor/ruby
      - tmp/rubocop_cache
    policy: pull-push

downtime_check:
  extends:
    - .rails-job-base
    - .rails:needs:setup-and-assets
68
    - .rails:rules:downtime_check
69
70
71
72
73
74
  stage: test
  variables:
    SETUP_DB: "false"
  script:
    - bundle exec rake downtime_check

75
.rspec-base:
76
  extends: .rails-job-base
Kamil Trzciński's avatar
Kamil Trzciński committed
77
  stage: test
78
  needs: ["setup-test-env pg11", "retrieve-tests-metadata", "compile-assets pull-cache"]
Kamil Trzciński's avatar
Kamil Trzciński committed
79
  script:
80
    - source scripts/rspec_helpers.sh
81
    - rspec_paralellized_job "--tag ~quarantine --tag ~geo --tag ~level:migration"
Kamil Trzciński's avatar
Kamil Trzciński committed
82
83
84
85
86
87
88
89
90
  artifacts:
    expire_in: 31d
    when: always
    paths:
      - coverage/
      - knapsack/
      - rspec_flaky/
      - rspec_profiling/
      - tmp/capybara/
91
      - tmp/memory_test/
92
      - junit_rspec.xml
Steve Azzopardi's avatar
Steve Azzopardi committed
93
94
    reports:
      junit: junit_rspec.xml
Kamil Trzciński's avatar
Kamil Trzciński committed
95

96
.rspec-base-pg11:
Stan Hu's avatar
Stan Hu committed
97
98
  extends:
    - .rspec-base
99
    - .rails:rules:ee-and-foss
100
    - .use-pg11
Kamil Trzciński's avatar
Kamil Trzciński committed
101

102
103
104
105
106
.rspec-base-migration:
  script:
    - source scripts/rspec_helpers.sh
    - rspec_paralellized_job "--tag ~quarantine --tag ~geo --tag level:migration"

107
rspec migration pg11:
108
  extends:
109
    - .rspec-base-pg11
110
    - .rspec-base-migration
111
  parallel: 5
112

113
114
rspec unit pg11:
  extends: .rspec-base-pg11
115
  parallel: 20
116

117
118
rspec integration pg11:
  extends: .rspec-base-pg11
119
  parallel: 8
Kamil Trzciński's avatar
Kamil Trzciński committed
120

121
122
rspec system pg11:
  extends: .rspec-base-pg11
123
124
125
  parallel: 24

rspec fast_spec_helper:
126
  extends: .rspec-base-pg11
127
128
129
  script:
    - bin/rspec spec/fast_spec_helper.rb

130
.db-job-base:
Stan Hu's avatar
Stan Hu committed
131
  extends:
132
133
    - .rails-job-base
    - .rails:rules:ee-and-foss
134
    - .use-pg11
135
  stage: test
136
  needs: ["setup-test-env pg11"]
137
138
139

db:migrate:reset:
  extends: .db-job-base
Stan Hu's avatar
Stan Hu committed
140
141
  script:
    - bundle exec rake db:migrate:reset
Kamil Trzciński's avatar
Kamil Trzciński committed
142

Stan Hu's avatar
Stan Hu committed
143
db:check-schema:
144
  extends: .db-job-base
Kamil Trzciński's avatar
Kamil Trzciński committed
145
146
147
  script:
    - source scripts/schema_changed.sh

Stan Hu's avatar
Stan Hu committed
148
db:migrate-from-v11.11.0:
149
  extends: .db-job-base
Stan Hu's avatar
Stan Hu committed
150
151
152
  variables:
    SETUP_DB: "false"
  script:
153
154
155
156
157
    - export PROJECT_TO_CHECKOUT="gitlab-foss"
    - export TAG_TO_CHECKOUT="v11.11.0"
    - '[[ ! -d "ee/" ]] || export PROJECT_TO_CHECKOUT="gitlab"'
    - '[[ ! -d "ee/" ]] || export TAG_TO_CHECKOUT="v11.11.0-ee"'
    - git fetch https://gitlab.com/gitlab-org/$PROJECT_TO_CHECKOUT.git $TAG_TO_CHECKOUT
Stan Hu's avatar
Stan Hu committed
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
    - git checkout -f FETCH_HEAD
    - sed -i "s/gem 'oj', '~> 2.17.4'//" Gemfile
    - sed -i "s/gem 'bootsnap', '~> 1.0.0'/gem 'bootsnap'/" Gemfile
    - bundle update google-protobuf grpc bootsnap
    - bundle install $BUNDLE_INSTALL_FLAGS
    - date
    - cp config/gitlab.yml.example config/gitlab.yml
    - bundle exec rake db:drop db:create db:schema:load db:seed_fu
    - date
    - git checkout -f $CI_COMMIT_SHA
    - bundle install $BUNDLE_INSTALL_FLAGS
    - date
    - . scripts/prepare_build.sh
    - date
    - bundle exec rake db:migrate
Kamil Trzciński's avatar
Kamil Trzciński committed
173

Stan Hu's avatar
Stan Hu committed
174
db:rollback:
175
  extends: .db-job-base
Kamil Trzciński's avatar
Kamil Trzciński committed
176
  script:
177
    - bundle exec rake db:migrate VERSION=20180101160629
178
    - bundle exec rake db:migrate SKIP_SCHEMA_VERSION_CHECK=true
Kamil Trzciński's avatar
Kamil Trzciński committed
179

Stan Hu's avatar
Stan Hu committed
180
gitlab:setup:
181
  extends: .db-job-base
Stan Hu's avatar
Stan Hu committed
182
183
184
185
186
187
188
189
190
191
192
193
194
195
  variables:
    SETUP_DB: "false"
  script:
    # Manually clone gitlab-test and only seed this project in
    # db/fixtures/development/04_project.rb thanks to SIZE=1 below
    - git clone https://gitlab.com/gitlab-org/gitlab-test.git
       /home/git/repositories/gitlab-org/gitlab-test.git
    - scripts/gitaly-test-spawn
    - force=yes SIZE=1 FIXTURE_PATH="db/fixtures/development" bundle exec rake gitlab:setup
  artifacts:
    when: on_failure
    expire_in: 1d
    paths:
      - log/development.log
Kamil Trzciński's avatar
Kamil Trzciński committed
196

197
rspec:coverage:
198
199
  extends:
    - .rails-job-base
200
    - .rails:rules:ee-only
201
  stage: post-test
202
203
204
  # We cannot use needs since it would mean needing 84 jobs (since most are parallelized)
  # so we use `dependencies` here.
  dependencies:
205
206
207
208
209
210
211
212
213
214
215
216
    - setup-test-env pg11
    - rspec migration pg11
    - rspec unit pg11
    - rspec integration pg11
    - rspec system pg11
    - rspec-ee migration pg11
    - rspec-ee unit pg11
    - rspec-ee integration pg11
    - rspec-ee system pg11
    - rspec-ee unit pg11 geo
    - rspec-ee integration pg11 geo
    - rspec-ee system pg11 geo
217
218
    - memory-static
    - memory-on-boot
Kamil Trzciński's avatar
Kamil Trzciński committed
219
220
  variables:
    SETUP_DB: "false"
221
222
  cache:
    policy: pull
Kamil Trzciński's avatar
Kamil Trzciński committed
223
224
  script:
    - bundle exec scripts/merge-simplecov
225
    - bundle exec scripts/gather-test-memory-data
Kamil Trzciński's avatar
Kamil Trzciński committed
226
227
228
229
230
  coverage: '/LOC \((\d+\.\d+%)\) covered.$/'
  artifacts:
    name: coverage
    expire_in: 31d
    paths:
Kamil Trzciński's avatar
Kamil Trzciński committed
231
232
      - coverage/index.html
      - coverage/assets/
233
      - tmp/memory_test/
234
# EE and FOSS jobs #
235
236
237
238
####################

####################
# master-only jobs #
239
.rspec-base-pg10:
240
241
  extends:
    - .rspec-base
242
    - .rails:rules:master-refs-code-backstage
243
244
    - .use-pg10
  needs: ["setup-test-env pg10", "retrieve-tests-metadata", "compile-assets pull-cache"]
245

246
rspec migration pg10:
247
  extends:
248
    - .rspec-base-pg10
249
    - .rspec-base-migration
250
  parallel: 5
251

252
253
rspec unit pg10:
  extends: .rspec-base-pg10
254
255
  parallel: 20

256
257
rspec integration pg10:
  extends: .rspec-base-pg10
258
259
  parallel: 8

260
261
rspec system pg10:
  extends: .rspec-base-pg10
262
263
264
265
  parallel: 24
# master-only jobs #
####################

266
267
268
######################
# nightly-only jobs #
.rspec-base-pg9:
269
270
271
  extends:
    - .rspec-base
    - .rails:rules:nightly-master-refs-code-backstage
272
273
    - .use-pg9
  needs: ["setup-test-env pg9", "retrieve-tests-metadata", "compile-assets pull-cache"]
274

275
rspec migration pg9:
276
  extends:
277
    - .rspec-base-pg9
278
    - .rspec-base-migration
279
  parallel: 5
280

281
282
rspec unit pg9:
  extends: .rspec-base-pg9
283
284
  parallel: 20

285
286
rspec integration pg9:
  extends: .rspec-base-pg9
287
288
  parallel: 8

289
290
rspec system pg9:
  extends: .rspec-base-pg9
291
  parallel: 24
292
293
# nightly-only jobs #
#####################
294

295
296
#######################
# EE master-only jobs #
297
.rspec-ee-base-pg10:
298
  extends:
299
    - .rspec-base-ee
300
301
    - .use-pg10-ee
  needs: ["setup-test-env pg10", "retrieve-tests-metadata", "compile-assets pull-cache"]
302

303
rspec-ee migration pg10:
304
  extends:
305
    - .rspec-ee-base-pg10
306
    - .rspec-base-migration
307
    - .rails:rules:master-refs-code-backstage
308
309
  parallel: 2

310
rspec-ee unit pg10:
311
  extends:
312
    - .rspec-ee-base-pg10
313
    - .rails:rules:master-refs-code-backstage
314
315
  parallel: 10

316
rspec-ee integration pg10:
317
  extends:
318
    - .rspec-ee-base-pg10
319
    - .rails:rules:master-refs-code-backstage
320
  parallel: 4
321

322
rspec-ee system pg10:
323
  extends:
324
    - .rspec-ee-base-pg10
325
    - .rails:rules:master-refs-code-backstage
326
  parallel: 6
327
328
# EE master-only jobs #
#######################
329

330
331
################
# EE-only jobs #
332
333
334
335
336
.rspec-base-ee:
  extends:
    - .rspec-base
    - .rails:rules:ee-only

337
.rspec-base-pg11-as-if-foss:
338
339
340
  extends:
    - .rspec-base-ee
    - .as-if-foss
341
342
    - .use-pg11
  needs: ["setup-test-env pg11", "retrieve-tests-metadata", "compile-assets pull-cache as-if-foss"]
343

344
.rspec-ee-base-pg11:
345
346
  extends:
    - .rspec-base-ee
347
    - .use-pg11-ee
348

349
rspec migration pg11-as-if-foss:
350
  extends:
351
    - .rspec-base-pg11-as-if-foss
352
353
354
    - .rspec-base-migration
  parallel: 5

355
356
rspec unit pg11-as-if-foss:
  extends: .rspec-base-pg11-as-if-foss
357
358
  parallel: 20

359
360
rspec integration pg11-as-if-foss:
  extends: .rspec-base-pg11-as-if-foss
361
362
  parallel: 8

363
364
rspec system pg11-as-if-foss:
  extends: .rspec-base-pg11-as-if-foss
365
366
  parallel: 24

367
rspec-ee migration pg11:
368
  extends:
369
    - .rspec-ee-base-pg11
370
371
372
    - .rspec-base-migration
  parallel: 2

373
374
rspec-ee unit pg11:
  extends: .rspec-ee-base-pg11
375
376
  parallel: 10

377
378
rspec-ee integration pg11:
  extends: .rspec-ee-base-pg11
379
380
  parallel: 4

381
382
rspec-ee system pg11:
  extends: .rspec-ee-base-pg11
383
384
385
386
387
388
389
390
391
  parallel: 6

.rspec-ee-base-geo:
  extends: .rspec-base-ee
  script:
    - source scripts/rspec_helpers.sh
    - scripts/prepare_postgres_fdw.sh
    - rspec_paralellized_job "--tag ~quarantine --tag geo"

392
.rspec-ee-base-geo-pg11:
393
394
  extends:
    - .rspec-ee-base-geo
395
    - .use-pg11-ee
396

397
398
rspec-ee unit pg11 geo:
  extends: .rspec-ee-base-geo-pg11
399
400
  parallel: 2

401
402
rspec-ee integration pg11 geo:
  extends: .rspec-ee-base-geo-pg11
403

404
405
rspec-ee system pg11 geo:
  extends: .rspec-ee-base-geo-pg11
406
407
408
409

db:rollback geo:
  extends:
    - db:rollback
410
    - .rails:rules:ee-only
411
412
413
  script:
    - bundle exec rake geo:db:migrate VERSION=20170627195211
    - bundle exec rake geo:db:migrate
414
# EE-only jobs #
415
################
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436

########################
# EE nightly-only jobs #
.rspec-ee-base-geo-pg9:
  extends:
    - .rspec-ee-base-geo
    - .use-pg9-ee
    - .rails:rules:nightly-master-refs-code-backstage-ee-only
  needs: ["setup-test-env pg9", "retrieve-tests-metadata", "compile-assets pull-cache"]

rspec-ee unit pg9 geo:
  extends: .rspec-ee-base-geo-pg9
  parallel: 2

rspec-ee integration pg9 geo:
  extends: .rspec-ee-base-geo-pg9

rspec-ee system pg9 geo:
  extends: .rspec-ee-base-geo-pg9
# EE nightly-only jobs #
########################