Read about our upcoming Code of Conduct on this issue

rails.gitlab-ci.yml 8.23 KB
Newer Older
1
.only-master:
Kamil Trzciński's avatar
Kamil Trzciński committed
2
  only:
Stan Hu's avatar
Stan Hu committed
3
    refs:
4
      - master
5

Stan Hu's avatar
Stan Hu committed
6
.rake-exec:
Philippe Lafoucrière's avatar
Philippe Lafoucrière committed
7
  extends:
Stan Hu's avatar
Stan Hu committed
8
9
10
    - .default-tags
    - .default-retry
    - .default-cache
11
    - .default-only
Stan Hu's avatar
Stan Hu committed
12
    - .default-before_script
Kamil Trzciński's avatar
Kamil Trzciński committed
13
14
15
16
17
  variables:
    SETUP_DB: "false"
  script:
    - bundle exec rake $CI_JOB_NAME

18
19
20
21
22
23
24
.only-code-rails-job-base:
  extends:
    - .default-tags
    - .default-retry
    - .default-cache
    - .default-only
    - .default-before_script
25
    - .only:changes-code-backstage
26
27

.only-code-qa-rails-job-base:
Philippe Lafoucrière's avatar
Philippe Lafoucrière committed
28
  extends:
Stan Hu's avatar
Stan Hu committed
29
30
31
    - .default-tags
    - .default-retry
    - .default-cache
32
    - .default-only
Stan Hu's avatar
Stan Hu committed
33
    - .default-before_script
34
    - .only:changes-code-backstage-qa
35

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
setup-test-env:
  extends:
    - .only-code-qa-rails-job-base
    - .use-pg9
  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

53
54
.rspec-base:
  extends: .only-code-rails-job-base
Kamil Trzciński's avatar
Kamil Trzciński committed
55
  stage: test
56
57
  needs: ["setup-test-env", "retrieve-tests-metadata", "compile-assets pull-cache"]
  dependencies: ["setup-test-env", "retrieve-tests-metadata", "compile-assets pull-cache"]
Kamil Trzciński's avatar
Kamil Trzciński committed
58
  script:
59
    - source scripts/rspec_helpers.sh
60
    - rspec_paralellized_job "--tag ~quarantine --tag ~geo --tag ~level:migration"
Kamil Trzciński's avatar
Kamil Trzciński committed
61
62
63
64
65
66
67
68
69
  artifacts:
    expire_in: 31d
    when: always
    paths:
      - coverage/
      - knapsack/
      - rspec_flaky/
      - rspec_profiling/
      - tmp/capybara/
70
      - tmp/memory_test/
Steve Azzopardi's avatar
Steve Azzopardi committed
71
72
    reports:
      junit: junit_rspec.xml
Kamil Trzciński's avatar
Kamil Trzciński committed
73

74
75
76
77
78
.rspec-base-foss:
  extends: [".rspec-base", ".only-ee-as-if-foss"]
  needs: ["setup-test-env", "retrieve-tests-metadata", "compile-assets pull-cache foss"]
  dependencies: ["setup-test-env", "retrieve-tests-metadata", "compile-assets pull-cache foss"]

79
.rspec-base-pg9:
Stan Hu's avatar
Stan Hu committed
80
81
  extends:
    - .rspec-base
82
    - .use-pg9
Kamil Trzciński's avatar
Kamil Trzciński committed
83

84
85
.rspec-base-pg9-foss:
  extends:
86
    - .rspec-base-foss
87
88
    - .use-pg9

89
.rspec-base-pg10:
Stan Hu's avatar
Stan Hu committed
90
91
  extends:
    - .rspec-base
92
93
    - .use-pg10
    - .only-master
Kamil Trzciński's avatar
Kamil Trzciński committed
94

95
96
97
98
99
.rspec-base-migration:
  script:
    - source scripts/rspec_helpers.sh
    - rspec_paralellized_job "--tag ~quarantine --tag ~geo --tag level:migration"

100
rspec migration pg9:
101
102
103
  extends:
    - .rspec-base-pg9
    - .rspec-base-migration
104
105
106
  parallel: 4

rspec migration pg9-foss:
107
108
109
  extends:
    - .rspec-base-pg9-foss
    - .rspec-base-migration
110
111
  parallel: 4

112
113
rspec unit pg9:
  extends: .rspec-base-pg9
114
  parallel: 20
115

116
117
rspec unit pg9-foss:
  extends: .rspec-base-pg9-foss
118
  parallel: 20
119

120
121
122
rspec integration pg9:
  extends: .rspec-base-pg9
  parallel: 6
Kamil Trzciński's avatar
Kamil Trzciński committed
123

124
125
126
127
rspec integration pg9-foss:
  extends: .rspec-base-pg9-foss
  parallel: 6

128
129
130
131
rspec system pg9:
  extends: .rspec-base-pg9
  parallel: 24

132
133
134
rspec system pg9-foss:
  extends: .rspec-base-pg9-foss
  parallel: 24
135

136
137
rspec unit pg10:
  extends: .rspec-base-pg10
138
  parallel: 20
Kamil Trzciński's avatar
Kamil Trzciński committed
139

140
141
rspec integration pg10:
  extends: .rspec-base-pg10
142
143
  parallel: 6

144
145
rspec system pg10:
  extends: .rspec-base-pg10
146
147
  parallel: 24

148
149
150
151
152
153
154
155
156
157
158
159
.rspec-ee-base-pg9:
  extends:
    - .rspec-base
    - .only-ee
    - .use-pg9-ee

.rspec-ee-base-pg10:
  extends:
    - .rspec-base
    - .only-ee
    - .use-pg10-ee

160
rspec-ee migration pg9:
161
162
163
  extends:
    - .rspec-ee-base-pg9
    - .rspec-base-migration
164
165
  parallel: 2

166
167
rspec-ee unit pg9:
  extends: .rspec-ee-base-pg9
168
  parallel: 5
169
170
171
172
173
174
175
176
177

rspec-ee integration pg9:
  extends: .rspec-ee-base-pg9
  parallel: 3

rspec-ee system pg9:
  extends: .rspec-ee-base-pg9
  parallel: 5

178
179
180
rspec-ee migration pg10:
  extends:
    - .rspec-ee-base-pg10
181
    - .rspec-base-migration
182
183
184
    - .only-master
  parallel: 2

185
rspec-ee unit pg10:
Stan Hu's avatar
Stan Hu committed
186
  extends:
187
    - .rspec-ee-base-pg10
188
    - .only-master
189
  parallel: 5
190

191
rspec-ee integration pg10:
Stan Hu's avatar
Stan Hu committed
192
  extends:
193
    - .rspec-ee-base-pg10
194
    - .only-master
195
  parallel: 3
196

197
rspec-ee system pg10:
Stan Hu's avatar
Stan Hu committed
198
  extends:
199
    - .rspec-ee-base-pg10
200
    - .only-master
201
  parallel: 5
202

203
204
205
206
.rspec-ee-base-geo:
  extends:
    - .rspec-base
    - .only-ee
Kamil Trzciński's avatar
Kamil Trzciński committed
207
  script:
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
    - source scripts/rspec_helpers.sh
    - scripts/prepare_postgres_fdw.sh
    - rspec_paralellized_job "--tag ~quarantine --tag geo"

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

.rspec-ee-base-geo-pg10:
  extends:
    - .rspec-ee-base-geo
    - .use-pg10-ee

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

rspec-ee integration pg9 geo:
  extends: .rspec-ee-base-geo-pg9
Kamil Trzciński's avatar
Kamil Trzciński committed
228

229
230
231
232
233
234
235
236
237
238
239
240
241
242
rspec-ee system pg9 geo:
  extends: .rspec-ee-base-geo-pg9

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

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

rspec-ee system pg10 geo:
  extends: .rspec-ee-base-geo-pg10

rspec quarantine pg9:
Stan Hu's avatar
Stan Hu committed
243
  extends:
244
    - .rspec-base-pg9
245
    - .only-master
246
247
  variables:
    RSPEC_OPTS: "--tag quarantine -- spec/"
Kamil Trzciński's avatar
Kamil Trzciński committed
248
  script:
249
250
    - source scripts/rspec_helpers.sh
    - rspec_simple_job "${RSPEC_OPTS}"
Kamil Trzciński's avatar
Kamil Trzciński committed
251
252
  allow_failure: true

253
254
255
256
257
258
259
260
261
262
263
264
rspec-ee quarantine pg9:
  extends:
    - rspec quarantine pg9
    - .only-ee
  variables:
    RSPEC_OPTS: "--tag quarantine -- ee/spec/"

rspec fast_spec_helper:
  extends: .rspec-base-pg9
  script:
    - bin/rspec spec/fast_spec_helper.rb

Kamil Trzciński's avatar
Kamil Trzciński committed
265
static-analysis:
266
  extends: .only-code-qa-rails-job-base
267
268
269
  stage: test
  needs: ["setup-test-env", "compile-assets pull-cache"]
  dependencies: ["setup-test-env", "compile-assets pull-cache"]
Stan Hu's avatar
Stan Hu committed
270
271
  variables:
    SETUP_DB: "false"
272
  parallel: 2
Kamil Trzciński's avatar
Kamil Trzciński committed
273
274
275
  script:
    - scripts/static-analysis
  cache:
276
    key: "debian-stretch-ruby-2.6-and-rubocop"
Kamil Trzciński's avatar
Kamil Trzciński committed
277
278
279
280
281
282
    paths:
      - vendor/ruby
      - tmp/rubocop_cache
    policy: pull-push

downtime_check:
283
284
  extends:
    - .rake-exec
285
    - .only:changes-code-backstage
286
    - .except:refs-master-tags-stable-deploy
287
288
  stage: test
  needs: ["setup-test-env"]
289
  dependencies: ["setup-test-env"]
Kamil Trzciński's avatar
Kamil Trzciński committed
290

291
.db-job-base:
Stan Hu's avatar
Stan Hu committed
292
  extends:
293
    - .only-code-rails-job-base
294
    - .use-pg9
295
296
  stage: test
  needs: ["setup-test-env"]
297
  dependencies: ["setup-test-env"]
298
299
300
301

# DB migration, rollback, and seed jobs
db:migrate:reset:
  extends: .db-job-base
Stan Hu's avatar
Stan Hu committed
302
303
  script:
    - bundle exec rake db:migrate:reset
Kamil Trzciński's avatar
Kamil Trzciński committed
304

Stan Hu's avatar
Stan Hu committed
305
db:check-schema:
306
  extends: .db-job-base
Kamil Trzciński's avatar
Kamil Trzciński committed
307
308
309
  script:
    - source scripts/schema_changed.sh

Stan Hu's avatar
Stan Hu committed
310
db:migrate-from-v11.11.0:
311
  extends: .db-job-base
Stan Hu's avatar
Stan Hu committed
312
313
314
  variables:
    SETUP_DB: "false"
  script:
315
316
317
318
319
    - 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
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
    - 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
335

Stan Hu's avatar
Stan Hu committed
336
db:rollback:
337
  extends: .db-job-base
Kamil Trzciński's avatar
Kamil Trzciński committed
338
  script:
339
    - bundle exec rake db:migrate VERSION=20180101160629
340
    - bundle exec rake db:migrate SKIP_SCHEMA_VERSION_CHECK=true
Kamil Trzciński's avatar
Kamil Trzciński committed
341

Stan Hu's avatar
Stan Hu committed
342
gitlab:setup:
343
  extends: .db-job-base
Stan Hu's avatar
Stan Hu committed
344
345
346
347
348
349
350
351
352
353
354
355
356
357
  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
358
359

coverage:
360
  extends: .only-code-rails-job-base
Kamil Trzciński's avatar
Kamil Trzciński committed
361
362
363
364
365
366
367
  cache:
    policy: pull
  variables:
    SETUP_DB: "false"
  stage: post-test
  script:
    - bundle exec scripts/merge-simplecov
368
    - bundle exec scripts/gather-test-memory-data
Kamil Trzciński's avatar
Kamil Trzciński committed
369
370
371
372
373
  coverage: '/LOC \((\d+\.\d+%)\) covered.$/'
  artifacts:
    name: coverage
    expire_in: 31d
    paths:
Kamil Trzciński's avatar
Kamil Trzciński committed
374
375
      - coverage/index.html
      - coverage/assets/
376
      - tmp/memory_test/
377
378
379
380

db:rollback geo:
  extends:
    - db:rollback
381
    - .only-ee
382
383
384
  script:
    - bundle exec rake geo:db:migrate VERSION=20170627195211
    - bundle exec rake geo:db:migrate