.gitlab-ci.yml 17.2 KB
Newer Older
1
image: "dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.3.3-golang-1.8-git-2.13-phantomjs-2.1-node-7.1-postgresql-9.6"
2

3
.default-cache: &default-cache
4
  key: "ruby-233-with-yarn"
5
  paths:
6 7 8 9 10 11 12 13 14 15 16 17
    - vendor/ruby
    - .yarn-cache/

.push-cache: &push-cache
  cache:
    <<: *default-cache
    policy: push

.pull-cache: &pull-cache
  cache:
    <<: *default-cache
    policy: pull
18

19 20
variables:
  MYSQL_ALLOW_EMPTY_PASSWORD: "1"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
21
  RAILS_ENV: "test"
Mike Greiling's avatar
Mike Greiling committed
22
  NODE_ENV: "test"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
23
  SIMPLECOV: "true"
24
  GIT_DEPTH: "20"
25
  GIT_SUBMODULE_STRATEGY: "none"
26
  PHANTOMJS_VERSION: "2.1.1"
27
  GET_SOURCES_ATTEMPTS: "3"
28 29
  KNAPSACK_RSPEC_SUITE_REPORT_PATH: knapsack/${CI_PROJECT_NAME}/rspec_report-master.json
  KNAPSACK_SPINACH_SUITE_REPORT_PATH: knapsack/${CI_PROJECT_NAME}/spinach_report-master.json
30
  FLAKY_RSPEC_SUITE_REPORT_PATH: rspec_flaky/${CI_PROJECT_NAME}/report-master.json
31

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
32
before_script:
Kamil Trzcinski's avatar
Test  
Kamil Trzcinski committed
33
  - bundle --version
34 35
  - source scripts/utils.sh
  - source scripts/prepare_build.sh
36

Kamil Trzcinski's avatar
Kamil Trzcinski committed
37
stages:
38 39 40 41 42
  - build
  - prepare
  - test
  - post-test
  - pages
43

44 45 46 47 48
# Predefined scopes
.dedicated-runner: &dedicated-runner
  tags:
    - gitlab-org

49
.tests-metadata-state: &tests-metadata-state
50 51 52 53
  services: []
  variables:
    SETUP_DB: "false"
    USE_BUNDLE_INSTALL: "false"
54
    TESTS_METADATA_S3_BUCKET: "gitlab-ce-cache"
55 56 57
  artifacts:
    expire_in: 31d
    paths:
58
      - knapsack/
59
      - rspec_flaky/
60

61 62
.use-pg: &use-pg
  services:
63
    - postgres:9.2
64 65 66
    - redis:alpine

.use-mysql: &use-mysql
67 68 69
  services:
    - mysql:latest
    - redis:alpine
70

71 72 73
# Skip all jobs except the ones that begin with 'docs/'.
# Used for commits including ONLY documentation changes.
# https://docs.gitlab.com/ce/development/writing_documentation.html#testing
74 75
.except-docs: &except-docs
  except:
76
    - /(^docs[\/-].*|.*-docs$)/
77

78
.rspec-metadata: &rspec-metadata
79
  <<: *dedicated-runner
80 81
  <<: *pull-cache
  stage: test
82
  script:
83
    - JOB_NAME=( $CI_JOB_NAME )
84 85
    - export CI_NODE_INDEX=${JOB_NAME[-2]}
    - export CI_NODE_TOTAL=${JOB_NAME[-1]}
86
    - export KNAPSACK_REPORT_PATH=knapsack/${CI_PROJECT_NAME}/${JOB_NAME[0]}_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
87
    - export KNAPSACK_GENERATE_REPORT=true
88 89 90
    - export ALL_FLAKY_RSPEC_REPORT_PATH=rspec_flaky/${CI_PROJECT_NAME}/all_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
    - export NEW_FLAKY_RSPEC_REPORT_PATH=rspec_flaky/${CI_PROJECT_NAME}/new_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
    - export FLAKY_RSPEC_GENERATE_REPORT=true
91
    - export CACHE_CLASSES=true
92
    - cp ${KNAPSACK_RSPEC_SUITE_REPORT_PATH} ${KNAPSACK_REPORT_PATH}
93 94
    - cp ${FLAKY_RSPEC_SUITE_REPORT_PATH} ${ALL_FLAKY_RSPEC_REPORT_PATH}
    - '[[ -f $NEW_FLAKY_RSPEC_REPORT_PATH ]] || echo "{}" > ${NEW_FLAKY_RSPEC_REPORT_PATH}'
Jacob Vosmaer's avatar
Jacob Vosmaer committed
95
    - scripts/gitaly-test-spawn
96 97 98
    - knapsack rspec "--color --format documentation"
  artifacts:
    expire_in: 31d
99
    when: always
100
    paths:
101 102
      - coverage/
      - knapsack/
103
      - rspec_flaky/
104
      - tmp/capybara/
105

106 107
.rspec-metadata-pg: &rspec-metadata-pg
  <<: *rspec-metadata
108
  <<: *use-pg
109
  <<: *except-docs
110

111 112
.rspec-metadata-mysql: &rspec-metadata-mysql
  <<: *rspec-metadata
113
  <<: *use-mysql
114
  <<: *except-docs
115

116
.spinach-metadata: &spinach-metadata
117
  <<: *dedicated-runner
118 119
  <<: *pull-cache
  stage: test
120
  script:
121
    - JOB_NAME=( $CI_JOB_NAME )
122 123
    - export CI_NODE_INDEX=${JOB_NAME[-2]}
    - export CI_NODE_TOTAL=${JOB_NAME[-1]}
124
    - export KNAPSACK_REPORT_PATH=knapsack/${CI_PROJECT_NAME}/${JOB_NAME[0]}_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
125
    - export KNAPSACK_GENERATE_REPORT=true
126
    - export CACHE_CLASSES=true
127
    - cp ${KNAPSACK_SPINACH_SUITE_REPORT_PATH} ${KNAPSACK_REPORT_PATH}
Jacob Vosmaer's avatar
Jacob Vosmaer committed
128
    - scripts/gitaly-test-spawn
129 130 131
    - knapsack spinach "-r rerun" || retry '[[ -e tmp/spinach-rerun.txt ]] && bundle exec spinach -r rerun $(cat tmp/spinach-rerun.txt)'
  artifacts:
    expire_in: 31d
132
    when: always
133
    paths:
134 135 136
      - coverage/
      - knapsack/
      - tmp/capybara/
137

138 139
.spinach-metadata-pg: &spinach-metadata-pg
  <<: *spinach-metadata
140
  <<: *use-pg
141
  <<: *except-docs
142

143 144
.spinach-metadata-mysql: &spinach-metadata-mysql
  <<: *spinach-metadata
145
  <<: *use-mysql
146
  <<: *except-docs
147

148 149 150 151 152 153 154
.only-canonical-masters: &only-canonical-masters
  only:
    - master@gitlab-org/gitlab-ce
    - master@gitlab-org/gitlab-ee
    - master@gitlab/gitlabhq
    - master@gitlab/gitlab-ee

155 156 157
# Trigger a package build on omnibus-gitlab repository

build-package:
158
  image: ruby:2.3-alpine
159
  before_script: []
160 161 162 163 164
  services: []
  variables:
    SETUP_DB: "false"
    USE_BUNDLE_INSTALL: "false"
  stage: build
165
  cache: {}
166 167
  when: manual
  script:
168
    - scripts/trigger-build
169 170 171
  only:
    - //@gitlab-org/gitlab-ce
    - //@gitlab-org/gitlab-ee
172

173 174 175
# Retrieve knapsack and rspec_flaky reports
retrieve-tests-metadata:
  <<: *tests-metadata-state
176
  <<: *dedicated-runner
177
  <<: *except-docs
178
  stage: prepare
179
  cache:
180
    key: tests_metadata
181
    policy: pull
182
  script:
183
    - mkdir -p knapsack/${CI_PROJECT_NAME}/
184 185
    - wget -O $KNAPSACK_RSPEC_SUITE_REPORT_PATH http://${TESTS_METADATA_S3_BUCKET}.s3.amazonaws.com/$KNAPSACK_RSPEC_SUITE_REPORT_PATH || rm $KNAPSACK_RSPEC_SUITE_REPORT_PATH
    - wget -O $KNAPSACK_SPINACH_SUITE_REPORT_PATH http://${TESTS_METADATA_S3_BUCKET}.s3.amazonaws.com/$KNAPSACK_SPINACH_SUITE_REPORT_PATH || rm $KNAPSACK_SPINACH_SUITE_REPORT_PATH
186 187
    - '[[ -f $KNAPSACK_RSPEC_SUITE_REPORT_PATH ]] || echo "{}" > ${KNAPSACK_RSPEC_SUITE_REPORT_PATH}'
    - '[[ -f $KNAPSACK_SPINACH_SUITE_REPORT_PATH ]] || echo "{}" > ${KNAPSACK_SPINACH_SUITE_REPORT_PATH}'
188 189 190
    - mkdir -p rspec_flaky/${CI_PROJECT_NAME}/
    - wget -O $FLAKY_RSPEC_SUITE_REPORT_PATH http://${TESTS_METADATA_S3_BUCKET}.s3.amazonaws.com/$FLAKY_RSPEC_SUITE_REPORT_PATH || rm $FLAKY_RSPEC_SUITE_REPORT_PATH
    - '[[ -f $FLAKY_RSPEC_SUITE_REPORT_PATH ]] || echo "{}" > ${FLAKY_RSPEC_SUITE_REPORT_PATH}'
191

192 193
update-tests-metadata:
  <<: *tests-metadata-state
194
  <<: *dedicated-runner
195
  <<: *only-canonical-masters
196
  stage: post-test
197
  cache:
198
    key: tests_metadata
199 200
    paths:
      - knapsack/
201
      - rspec_flaky/
202
    policy: push
203
  script:
204
    - retry gem install fog-aws mime-types
205 206
    - scripts/merge-reports ${KNAPSACK_RSPEC_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/rspec-pg_node_*.json
    - scripts/merge-reports ${KNAPSACK_SPINACH_SUITE_REPORT_PATH} knapsack/${CI_PROJECT_NAME}/spinach-pg_node_*.json
207 208 209
    - scripts/merge-reports ${FLAKY_RSPEC_SUITE_REPORT_PATH} rspec_flaky/${CI_PROJECT_NAME}/all_node_*.json
    - '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $KNAPSACK_RSPEC_SUITE_REPORT_PATH $KNAPSACK_SPINACH_SUITE_REPORT_PATH'
    - '[[ -z ${TESTS_METADATA_S3_BUCKET} ]] || scripts/sync-reports put $TESTS_METADATA_S3_BUCKET $FLAKY_RSPEC_SUITE_REPORT_PATH'
210
    - rm -f knapsack/${CI_PROJECT_NAME}/*_node_*.json
211 212 213 214
    - rm -f rspec_flaky/${CI_PROJECT_NAME}/all_node_*.json

flaky-examples-check:
  <<: *dedicated-runner
215
  <<: *except-docs
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
  image: ruby:2.3-alpine
  services: []
  before_script: []
  cache: {}
  variables:
    SETUP_DB: "false"
    USE_BUNDLE_INSTALL: "false"
    NEW_FLAKY_SPECS_REPORT: rspec_flaky/${CI_PROJECT_NAME}/new_rspec_flaky_examples.json
  stage: post-test
  allow_failure: yes
  only:
    - branches
  except:
    - master
  artifacts:
    expire_in: 30d
    paths:
      - rspec_flaky/
  script:
    - '[[ -f $NEW_FLAKY_SPECS_REPORT ]] || echo "{}" > ${NEW_FLAKY_SPECS_REPORT}'
    - scripts/merge-reports $NEW_FLAKY_SPECS_REPORT rspec_flaky/${CI_PROJECT_NAME}/new_node_*.json
    - scripts/detect-new-flaky-examples $NEW_FLAKY_SPECS_REPORT
238 239

setup-test-env:
240
  <<: *use-pg
241
  <<: *dedicated-runner
242
  <<: *except-docs
243
  stage: prepare
244 245
  cache:
    <<: *default-cache
246
  script:
247
    - node --version
248
    - yarn install --frozen-lockfile --cache-folder .yarn-cache
249
    - bundle exec rake gettext:po_to_json
Mike Greiling's avatar
Mike Greiling committed
250
    - bundle exec rake gitlab:assets:compile
251
    - bundle exec ruby -Ispec -e 'require "spec_helper" ; TestEnv.init'
Jacob Vosmaer's avatar
Jacob Vosmaer committed
252
    - scripts/gitaly-test-build # Do not use 'bundle exec' here
253 254 255
  artifacts:
    expire_in: 7d
    paths:
256
      - node_modules
257 258 259
      - public/assets
      - tmp/tests

260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284
rspec-pg 0 25: *rspec-metadata-pg
rspec-pg 1 25: *rspec-metadata-pg
rspec-pg 2 25: *rspec-metadata-pg
rspec-pg 3 25: *rspec-metadata-pg
rspec-pg 4 25: *rspec-metadata-pg
rspec-pg 5 25: *rspec-metadata-pg
rspec-pg 6 25: *rspec-metadata-pg
rspec-pg 7 25: *rspec-metadata-pg
rspec-pg 8 25: *rspec-metadata-pg
rspec-pg 9 25: *rspec-metadata-pg
rspec-pg 10 25: *rspec-metadata-pg
rspec-pg 11 25: *rspec-metadata-pg
rspec-pg 12 25: *rspec-metadata-pg
rspec-pg 13 25: *rspec-metadata-pg
rspec-pg 14 25: *rspec-metadata-pg
rspec-pg 15 25: *rspec-metadata-pg
rspec-pg 16 25: *rspec-metadata-pg
rspec-pg 17 25: *rspec-metadata-pg
rspec-pg 18 25: *rspec-metadata-pg
rspec-pg 19 25: *rspec-metadata-pg
rspec-pg 20 25: *rspec-metadata-pg
rspec-pg 21 25: *rspec-metadata-pg
rspec-pg 22 25: *rspec-metadata-pg
rspec-pg 23 25: *rspec-metadata-pg
rspec-pg 24 25: *rspec-metadata-pg
285

286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
rspec-mysql 0 25: *rspec-metadata-mysql
rspec-mysql 1 25: *rspec-metadata-mysql
rspec-mysql 2 25: *rspec-metadata-mysql
rspec-mysql 3 25: *rspec-metadata-mysql
rspec-mysql 4 25: *rspec-metadata-mysql
rspec-mysql 5 25: *rspec-metadata-mysql
rspec-mysql 6 25: *rspec-metadata-mysql
rspec-mysql 7 25: *rspec-metadata-mysql
rspec-mysql 8 25: *rspec-metadata-mysql
rspec-mysql 9 25: *rspec-metadata-mysql
rspec-mysql 10 25: *rspec-metadata-mysql
rspec-mysql 11 25: *rspec-metadata-mysql
rspec-mysql 12 25: *rspec-metadata-mysql
rspec-mysql 13 25: *rspec-metadata-mysql
rspec-mysql 14 25: *rspec-metadata-mysql
rspec-mysql 15 25: *rspec-metadata-mysql
rspec-mysql 16 25: *rspec-metadata-mysql
rspec-mysql 17 25: *rspec-metadata-mysql
rspec-mysql 18 25: *rspec-metadata-mysql
rspec-mysql 19 25: *rspec-metadata-mysql
rspec-mysql 20 25: *rspec-metadata-mysql
rspec-mysql 21 25: *rspec-metadata-mysql
rspec-mysql 22 25: *rspec-metadata-mysql
rspec-mysql 23 25: *rspec-metadata-mysql
rspec-mysql 24 25: *rspec-metadata-mysql
311

312 313 314 315 316
spinach-pg 0 5: *spinach-metadata-pg
spinach-pg 1 5: *spinach-metadata-pg
spinach-pg 2 5: *spinach-metadata-pg
spinach-pg 3 5: *spinach-metadata-pg
spinach-pg 4 5: *spinach-metadata-pg
317

318 319 320 321 322
spinach-mysql 0 5: *spinach-metadata-mysql
spinach-mysql 1 5: *spinach-metadata-mysql
spinach-mysql 2 5: *spinach-metadata-mysql
spinach-mysql 3 5: *spinach-metadata-mysql
spinach-mysql 4 5: *spinach-metadata-mysql
323

324
# Static analysis jobs
325
.ruby-static-analysis: &ruby-static-analysis
326
  <<: *pull-cache
327 328 329 330
  variables:
    SIMPLECOV: "false"
    SETUP_DB: "false"

331
.rake-exec: &rake-exec
332
  <<: *ruby-static-analysis
333
  <<: *dedicated-runner
334
  <<: *except-docs
335
  <<: *pull-cache
336 337
  stage: test
  script:
338
    - bundle exec rake $CI_JOB_NAME
339

340
static-analysis:
341 342
  <<: *ruby-static-analysis
  <<: *dedicated-runner
343
  <<: *except-docs
344 345
  stage: test
  script:
346
    - scripts/static-analysis
347

348 349 350 351
# Documentation checks:
# - Check validity of relative links
# - Make sure cURL examples in API docs use the full switches
docs lint:
352
  <<: *dedicated-runner
353 354 355 356 357 358
  image: "registry.gitlab.com/gitlab-org/gitlab-build-images:nanoc-bootstrap-ruby-2.4-alpine"
  stage: test
  cache: {}
  dependencies: []
  before_script: []
  script:
359
    - scripts/lint-doc.sh
360 361 362 363 364 365 366
    - mv doc/ /nanoc/content/
    - cd /nanoc
    # Build HTML from Markdown
    - bundle exec nanoc
    # Check the internal links
    - bundle exec nanoc check internal_links

367 368
downtime_check:
  <<: *rake-exec
369 370 371 372
  except:
    - master
    - tags
    - /^[\d-]+-stable(-ee)?$/
373
    - /(^docs[\/-].*|.*-docs$)/
374

375 376
ee_compat_check:
  <<: *rake-exec
377 378 379 380 381
  only:
    - branches@gitlab-org/gitlab-ce
  except:
    - master
    - tags
382
    - /^[\d-]+-stable(-ee)?/
383 384
  allow_failure: yes
  cache:
385
    key: "ee_compat_check_repo"
386
    paths:
387
      - ee_compat_check/ee-repo/
388
  artifacts:
389
    name: "${CI_JOB_NAME}_${CI_COMIT_REF_NAME}_${CI_COMMIT_SHA}"
390 391 392 393 394
    when: on_failure
    expire_in: 10d
    paths:
      - ee_compat_check/patches/*.patch

395
# DB migration, rollback, and seed jobs
396
.db-migrate-reset: &db-migrate-reset
397
  <<: *dedicated-runner
398
  <<: *except-docs
399 400
  <<: *pull-cache
  stage: test
401
  script:
402
    - bundle exec rake db:migrate:reset
403

404
db:migrate:reset-pg:
405 406 407
  <<: *db-migrate-reset
  <<: *use-pg

408
db:migrate:reset-mysql:
409 410 411
  <<: *db-migrate-reset
  <<: *use-mysql

412 413
.migration-paths: &migration-paths
  <<: *dedicated-runner
414 415 416
  <<: *only-canonical-masters
  <<: *pull-cache
  stage: test
417 418 419 420 421 422
  variables:
    SETUP_DB: "false"
  script:
    - git fetch origin v8.14.10
    - git checkout -f FETCH_HEAD
    - bundle install $BUNDLE_INSTALL_FLAGS
423
    - cp config/gitlab.yml.example config/gitlab.yml
424 425 426 427 428 429 430 431 432 433 434 435 436 437
    - bundle exec rake db:drop db:create db:schema:load db:seed_fu
    - git checkout $CI_COMMIT_SHA
    - bundle install $BUNDLE_INSTALL_FLAGS
    - . scripts/prepare_build.sh
    - bundle exec rake db:migrate

migration:path-pg:
  <<: *migration-paths
  <<: *use-pg

migration:path-mysql:
  <<: *migration-paths
  <<: *use-mysql

438
.db-rollback: &db-rollback
439
  <<: *dedicated-runner
440
  <<: *except-docs
441 442
  <<: *pull-cache
  stage: test
443
  script:
444 445
    - bundle exec rake db:rollback STEP=120
    - bundle exec rake db:migrate
446

447
db:rollback-pg:
448 449 450
  <<: *db-rollback
  <<: *use-pg

451
db:rollback-mysql:
452 453 454 455
  <<: *db-rollback
  <<: *use-mysql

.db-seed_fu: &db-seed_fu
456
  <<: *dedicated-runner
457
  <<: *except-docs
458 459
  <<: *pull-cache
  stage: test
460 461 462 463 464 465 466 467 468 469 470 471 472
  variables:
    SIZE: "1"
    SETUP_DB: "false"
  script:
    - git clone https://gitlab.com/gitlab-org/gitlab-test.git
       /home/git/repositories/gitlab-org/gitlab-test.git
    - bundle exec rake db:setup db:seed_fu
  artifacts:
    when: on_failure
    expire_in: 1d
    paths:
      - log/development.log

473
db:seed_fu-pg:
474 475 476
  <<: *db-seed_fu
  <<: *use-pg

477
db:seed_fu-mysql:
478 479 480
  <<: *db-seed_fu
  <<: *use-mysql

481
# Frontend-related jobs
482
gitlab:assets:compile:
483
  <<: *dedicated-runner
484
  <<: *except-docs
485 486
  <<: *pull-cache
  stage: test
487 488 489 490 491 492 493
  dependencies: []
  variables:
    NODE_ENV: "production"
    RAILS_ENV: "production"
    SETUP_DB: "false"
    USE_DB: "false"
    SKIP_STORAGE_VALIDATION: "true"
494
    WEBPACK_REPORT: "true"
Mike Greiling's avatar
Mike Greiling committed
495
    NO_COMPRESSION: "true"
496
  script:
497
    - yarn install --frozen-lockfile --production --cache-folder .yarn-cache
498
    - bundle exec rake gettext:po_to_json
499
    - bundle exec rake gitlab:assets:compile
500 501 502 503
  artifacts:
    name: webpack-report
    expire_in: 31d
    paths:
504
      - webpack-report/
505

506
karma:
507
  <<: *use-pg
508
  <<: *dedicated-runner
509
  <<: *except-docs
510
  <<: *pull-cache
511
  image: "dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.3.3-golang-1.8-git-2.13-chrome-60.0-node-7.1-postgresql-9.6"
512
  stage: test
513 514
  variables:
    BABEL_ENV: "coverage"
515
    CHROME_LOG_FILE: "chrome_debug.log"
516
  script:
Jacob Vosmaer's avatar
Jacob Vosmaer committed
517
    - scripts/gitaly-test-spawn
518
    - bundle exec rake gettext:po_to_json
519
    - bundle exec rake karma
520
  coverage: '/^Statements *: (\d+\.\d+%)/'
521 522 523
  artifacts:
    name: coverage-javascript
    expire_in: 31d
524
    when: always
525
    paths:
526
    - chrome_debug.log
527
    - coverage-javascript/
528

529
codeclimate:
530
  <<: *except-docs
531
  <<: *pull-cache
532 533 534 535 536 537 538 539 540
  before_script: []
  image: docker:latest
  stage: test
  variables:
    SETUP_DB: "false"
    DOCKER_DRIVER: overlay
  services:
    - docker:dind
  script:
541 542
    - cp .rubocop.yml .rubocop.yml.bak
    - grep -v "rubocop-gitlab-security" .rubocop.yml.bak > .rubocop.yml
543
    - docker run --env CODECLIMATE_CODE="$PWD" --volume "$PWD":/code --volume /var/run/docker.sock:/var/run/docker.sock --volume /tmp/cc:/tmp/cc codeclimate/codeclimate analyze -f json > raw_codeclimate.json
544
    - cat raw_codeclimate.json | docker run -i stedolan/jq -c 'map({check_name,fingerprint,location})' > codeclimate.json
545
    - mv .rubocop.yml.bak .rubocop.yml
546 547 548
  artifacts:
    paths: [codeclimate.json]

549
coverage:
550
  <<: *dedicated-runner
551
  <<: *except-docs
552 553 554
  <<: *pull-cache
  stage: post-test
  services: []
555 556 557 558 559
  variables:
    SETUP_DB: "false"
    USE_BUNDLE_INSTALL: "true"
  script:
    - bundle exec scripts/merge-simplecov
560
  coverage: '/LOC \((\d+\.\d+%)\) covered.$/'
561 562 563 564 565 566 567
  artifacts:
    name: coverage
    expire_in: 31d
    paths:
    - coverage/index.html
    - coverage/assets/

568
lint:javascript:report:
569
  <<: *dedicated-runner
570
  <<: *except-docs
571
  <<: *pull-cache
572
  stage: post-test
573 574
  dependencies:
    - setup-test-env
575
  before_script: []
576
  script:
577
    - find app/ spec/ -name '*.js' -exec sed --in-place 's|/\* eslint-disable .*\*/||' {} \; # run report over all files
578
    - yarn run eslint-report || true # ignore exit code
579 580 581 582 583
  artifacts:
    name: eslint-report
    expire_in: 31d
    paths:
    - eslint-report.html
584 585

pages:
586 587
  <<: *dedicated-runner
  <<: *pull-cache
588 589 590 591
  before_script: []
  stage: pages
  dependencies:
    - coverage
592 593
    - karma
    - gitlab:assets:compile
594
    - lint:javascript:report
595 596 597
  script:
    - mv public/ .public/
    - mkdir public/
598
    - mv coverage/ public/coverage-ruby/ || true
599
    - mv coverage-javascript/ public/coverage-javascript/ || true
600
    - mv eslint-report.html public/ || true
601
    - mv webpack-report/ public/webpack-report/ || true
602 603 604 605
  artifacts:
    paths:
      - public
  only:
606
    - master@gitlab-org/gitlab-ce
607
    - master@gitlab-org/gitlab-ee
608 609 610 611

# Insurance in case a gem needed by one of our releases gets yanked from
# rubygems.org in the future.
cache gems:
612
  <<: *dedicated-runner
613
  <<: *pull-cache
614 615 616 617 618 619 620 621 622
  only:
    - tags
  variables:
    SETUP_DB: "false"
  script:
    - bundle package --all --all-platforms
  artifacts:
    paths:
      - vendor/cache
623 624
  only:
    - master@gitlab-org/gitlab-ce
625
    - master@gitlab-org/gitlab-ee
626 627

gitlab_git_test:
628 629
  <<: *pull-cache
  <<: *except-docs
630 631 632 633
  variables:
    SETUP_DB: "false"
  script:
    - spec/support/prepare-gitlab-git-test-for-commit --check-for-changes