gitlab-org--gitlab-foss/.gitlab/ci/rails.gitlab-ci.yml
Kyle Wiebers bca0f6055f Add DAG to setup-test-env jobs and review-cng-base to speed up pipeline
Add needs for all jobs which require setup-test-env and
move review-build-cng to additional stage review-prepare
to decrease wait time for jobs in pipeline
2019-09-05 08:58:59 -05:00

316 lines
8 KiB
YAML

.only-schedules-master:
only:
refs:
- schedules@gitlab-org/gitlab-ce
- schedules@gitlab-org/gitlab-ee
- master@gitlab-org/gitlab-ce
- master@gitlab-org/gitlab-ee
- master@gitlab/gitlabhq
- master@gitlab/gitlab-ee
.rake-exec:
extends:
- .default-tags
- .default-retry
- .default-cache
- .default-before_script
variables:
SETUP_DB: "false"
script:
- bundle exec rake $CI_JOB_NAME
.rspec-base:
extends:
- .default-tags
- .default-retry
- .default-cache
- .default-before_script
- .except-docs-qa
stage: test
script:
- JOB_NAME=( $CI_JOB_NAME )
- TEST_TOOL=${JOB_NAME[0]}
- TEST_LEVEL=${JOB_NAME[1]}
- DATABASE=${JOB_NAME[2]}
- export KNAPSACK_REPORT_PATH=knapsack/${CI_PROJECT_NAME}/${TEST_TOOL}_${TEST_LEVEL}_${DATABASE}_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
- export KNAPSACK_GENERATE_REPORT=true KNAPSACK_LOG_LEVEL=debug KNAPSACK_TEST_DIR=spec
- export SUITE_FLAKY_RSPEC_REPORT_PATH=${FLAKY_RSPEC_SUITE_REPORT_PATH}
- export FLAKY_RSPEC_REPORT_PATH=rspec_flaky/all_${TEST_TOOL}_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
- export NEW_FLAKY_RSPEC_REPORT_PATH=rspec_flaky/new_${TEST_TOOL}_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
- export FLAKY_RSPEC_GENERATE_REPORT=true
- export CACHE_CLASSES=true
- cp ${KNAPSACK_RSPEC_SUITE_REPORT_PATH} ${KNAPSACK_REPORT_PATH}
- '[[ -f $FLAKY_RSPEC_REPORT_PATH ]] || echo "{}" > ${FLAKY_RSPEC_REPORT_PATH}'
- '[[ -f $NEW_FLAKY_RSPEC_REPORT_PATH ]] || echo "{}" > ${NEW_FLAKY_RSPEC_REPORT_PATH}'
- scripts/gitaly-test-spawn
- date
- 'export KNAPSACK_TEST_FILE_PATTERN=$(ruby -r./lib/quality/test_level.rb -e "puts Quality::TestLevel.new.pattern(:${TEST_LEVEL})")'
- mkdir -p tmp/memory_test
- export MEMORY_TEST_PATH="tmp/memory_test/${TEST_TOOL}_${TEST_LEVEL}_${DATABASE}_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_memory.csv"
- knapsack rspec "--color --format documentation --format RspecJunitFormatter --out junit_rspec.xml --tag level:${TEST_LEVEL} --tag ~geo"
- date
artifacts:
expire_in: 31d
when: always
paths:
- coverage/
- knapsack/
- rspec_flaky/
- rspec_profiling/
- tmp/capybara/
- tmp/memory_test/
reports:
junit: junit_rspec.xml
.rspec-base-pg:
extends:
- .rspec-base
- .use-pg
.rspec-base-pg-10:
extends:
- .rspec-base
- .use-pg-10
setup-test-env:
extends:
- .default-tags
- .default-retry
- .default-cache
- .default-before_script
- .use-pg
- .except-docs
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
rspec unit pg:
extends: .rspec-base-pg
parallel: 20
rspec integration pg:
extends: .rspec-base-pg
parallel: 6
rspec system pg:
extends: .rspec-base-pg
parallel: 24
rspec unit pg-10:
extends:
- .rspec-base-pg-10
- .only-schedules-master
parallel: 20
rspec integration pg-10:
extends:
- .rspec-base-pg-10
- .only-schedules-master
parallel: 6
rspec system pg-10:
extends:
- .rspec-base-pg-10
- .only-schedules-master
parallel: 24
rspec-fast-spec-helper:
extends: .rspec-base-pg
script:
- bundle exec rspec spec/fast_spec_helper.rb
rspec quarantine pg:
extends:
- .default-before_script
- .rspec-base-pg
- .only-schedules-master
script:
- export NO_KNAPSACK=1 CACHE_CLASSES=true
- scripts/gitaly-test-spawn
- bin/rspec --color --format documentation --tag quarantine -- spec/
allow_failure: true
static-analysis:
extends:
- .default-tags
- .default-retry
- .default-cache
- .default-before_script
- .except-docs
dependencies: ["setup-test-env", "compile-assets", "compile-assets pull-cache"]
variables:
SETUP_DB: "false"
script:
- scripts/static-analysis
cache:
key: "debian-stretch-ruby-2.6.3-and-rubocop"
paths:
- vendor/ruby
- tmp/rubocop_cache
policy: pull-push
downtime_check:
extends: .rake-exec
except:
refs:
- master
- tags
- /^[\d-]+-stable(-ee)?$/
- /(^docs[\/-].+|.+-docs$)/
- /(^qa[\/-].*|.*-qa$)/
stage: test
dependencies: ["setup-test-env"]
needs: ["setup-test-env"]
ee_compat_check:
extends: .rake-exec
dependencies: []
except:
refs:
- master
- tags
- branches@gitlab-org/gitlab-ee
- branches@gitlab/gitlab-ee
- /^[\d-]+-stable(-ee)?$/
- /(^docs[\/-].+|.+-docs$)/
- /^security-/
artifacts:
name: "${CI_JOB_NAME}_${CI_COMIT_REF_NAME}_${CI_COMMIT_SHA}"
when: always
expire_in: 10d
paths:
- ee_compat_check/patches/*.patch
# DB migration, rollback, and seed jobs
db:migrate:reset:
extends:
- .default-tags
- .default-retry
- .default-cache
- .default-before_script
- .use-pg
- .except-docs-qa
stage: test
dependencies: ["setup-test-env"]
needs: ["setup-test-env"]
script:
- bundle exec rake db:migrate:reset
db:check-schema:
extends:
- .default-tags
- .default-retry
- .default-cache
- .default-before_script
- .use-pg
- .except-docs-qa
stage: test
dependencies: ["setup-test-env"]
needs: ["setup-test-env"]
script:
- source scripts/schema_changed.sh
db:migrate-from-v11.11.0:
extends:
- .default-tags
- .default-retry
- .default-cache
- .default-before_script
- .use-pg
- .except-docs-qa
stage: test
dependencies: ["setup-test-env"]
needs: ["setup-test-env"]
variables:
SETUP_DB: "false"
script:
- git fetch https://gitlab.com/gitlab-org/gitlab-ce.git v11.11.0
- 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
db:rollback:
extends:
- .default-tags
- .default-retry
- .default-cache
- .default-before_script
- .use-pg
- .except-docs-qa
stage: test
dependencies: ["setup-test-env"]
needs: ["setup-test-env"]
script:
- bundle exec rake db:migrate VERSION=20180101160629
- bundle exec rake db:migrate SKIP_SCHEMA_VERSION_CHECK=true
gitlab:setup:
extends:
- .default-tags
- .default-retry
- .default-cache
- .default-before_script
- .use-pg
- .except-docs-qa
stage: test
dependencies: ["setup-test-env"]
needs: ["setup-test-env"]
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
coverage:
# Don't include dedicated-no-docs-no-db-pull-cache-job here since we need to
# download artifacts from all the rspec jobs instead of from setup-test-env only
extends:
- .default-tags
- .default-retry
- .default-cache
- .default-before_script
- .except-docs-qa
cache:
policy: pull
variables:
SETUP_DB: "false"
stage: post-test
script:
- bundle exec scripts/merge-simplecov
- bundle exec scripts/gather-test-memory-data
coverage: '/LOC \((\d+\.\d+%)\) covered.$/'
artifacts:
name: coverage
expire_in: 31d
paths:
- coverage/index.html
- coverage/assets/
- tmp/memory_test/