diff options
Diffstat (limited to '.gitlab/ci/rails.gitlab-ci.yml')
-rw-r--r-- | .gitlab/ci/rails.gitlab-ci.yml | 223 |
1 files changed, 56 insertions, 167 deletions
diff --git a/.gitlab/ci/rails.gitlab-ci.yml b/.gitlab/ci/rails.gitlab-ci.yml index 28ec96b838a..e8087aebcef 100644 --- a/.gitlab/ci/rails.gitlab-ci.yml +++ b/.gitlab/ci/rails.gitlab-ci.yml @@ -1,48 +1,43 @@ .rails:needs:setup-and-assets: - needs: ["setup-test-env pg11", "compile-assets pull-cache"] + needs: ["setup-test-env", "compile-assets pull-cache"] .rails-job-base: extends: - .default-retry - - .default-cache - .default-before_script + - .rails-cache -#################### -# EE and FOSS jobs # -.base-setup-test-env: +####################################################### +# EE/FOSS: default refs (MRs, master, schedules) jobs # +setup-test-env: extends: - .rails-job-base + - .rails:rules:default-refs-code-backstage-qa + - .use-pg11 stage: prepare + variables: + GITLAB_TEST_EAGER_LOAD: "0" script: - - bundle exec ruby -Ispec -e 'require "spec_helper" ; TestEnv.init' - - scripts/gitaly-test-build # Do not use 'bundle exec' here + - run_timed_command "bundle exec ruby -I. -e 'require \"config/environment\"; TestEnv.init'" + - run_timed_command "scripts/gitaly-test-build" # Do not use 'bundle exec' here + - rm tmp/tests/gitaly/.ruby-bundle # This file prevents gems from being installed even if vendor/gitaly-ruby is missing artifacts: expire_in: 7d paths: - - tmp/tests - config/secrets.yml - - vendor/gitaly-ruby + - tmp/tests/gitaly + - tmp/tests/gitlab-elasticsearch-indexer + - tmp/tests/gitlab-shell + - tmp/tests/gitlab-test-fork + - tmp/tests/gitlab-test-fork_bare + - tmp/tests/gitlab-test + - tmp/tests/gitlab-workhorse + - tmp/tests/repositories + - tmp/tests/second_storage + when: always cache: policy: pull-push -setup-test-env pg11: - extends: - - .base-setup-test-env - - .rails:rules:default-refs-code-backstage-qa - - .use-pg11 - -setup-test-env pg10: - extends: - - .base-setup-test-env - - .rails:rules:master-refs-code-backstage - - .use-pg10 - -setup-test-env pg9: - extends: - - .base-setup-test-env - - .rails:rules:nightly-master-refs-code-backstage - - .use-pg9 - static-analysis: extends: - .rails-job-base @@ -55,7 +50,7 @@ static-analysis: script: - scripts/static-analysis cache: - key: "ruby-2.6.5-pg11-rubocop" + key: "ruby-2.6.6-pg11-rubocop" paths: - vendor/ruby - tmp/rubocop_cache @@ -64,8 +59,8 @@ static-analysis: downtime_check: extends: - .rails-job-base - - .rails:needs:setup-and-assets - .rails:rules:downtime_check + needs: ["setup-test-env"] stage: test variables: SETUP_DB: "false" @@ -75,8 +70,10 @@ downtime_check: .rspec-base: extends: .rails-job-base stage: test - needs: ["setup-test-env pg11", "retrieve-tests-metadata", "compile-assets pull-cache"] + needs: ["setup-test-env", "retrieve-tests-metadata", "compile-assets pull-cache"] script: + - run_timed_command "scripts/gitaly-test-build" + - run_timed_command "scripts/gitaly-test-spawn" - source scripts/rspec_helpers.sh - rspec_paralellized_job "--tag ~quarantine --tag ~geo --tag ~level:migration" artifacts: @@ -89,7 +86,7 @@ downtime_check: - rspec_profiling/ - tmp/capybara/ - tmp/memory_test/ - - junit_rspec.xml + - log/*.log reports: junit: junit_rspec.xml @@ -101,6 +98,8 @@ downtime_check: .rspec-base-migration: script: + - run_timed_command "scripts/gitaly-test-build" + - run_timed_command "scripts/gitaly-test-spawn" - source scripts/rspec_helpers.sh - rspec_paralellized_job "--tag ~quarantine --tag ~geo --tag level:migration" @@ -133,7 +132,7 @@ rspec fast_spec_helper: - .rails:rules:ee-and-foss - .use-pg11 stage: test - needs: ["setup-test-env pg11"] + needs: ["setup-test-env"] db:migrate:reset: extends: .db-job-base @@ -141,28 +140,28 @@ db:migrate:reset: - bundle exec rake db:migrate:reset db:check-schema: - extends: .db-job-base + extends: + - .db-job-base + - .rails:rules:ee-mr-and-master-only script: - source scripts/schema_changed.sh -db:migrate-from-v11.11.0: +db:migrate-from-v12.10.0: extends: .db-job-base variables: SETUP_DB: "false" script: - - 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"' + - export PROJECT_TO_CHECKOUT="gitlab" + - export TAG_TO_CHECKOUT="v12.10.0-ee" + - '[[ -d "ee/" ]] || export PROJECT_TO_CHECKOUT="gitlab-foss"' + - '[[ -d "ee/" ]] || export TAG_TO_CHECKOUT="v12.10.0"' - git fetch https://gitlab.com/gitlab-org/$PROJECT_TO_CHECKOUT.git $TAG_TO_CHECKOUT - 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 + - bundle exec rake db:drop db:create db:structure:load db:seed_fu - date - git checkout -f $CI_COMMIT_SHA - bundle install $BUNDLE_INSTALL_FLAGS @@ -186,23 +185,24 @@ gitlab:setup: # 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 + - run_timed_command "scripts/gitaly-test-build" + - run_timed_command "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 + - log/*.log rspec:coverage: extends: - .rails-job-base - - .rails:rules:ee-only + - .rails:rules:ee-mr-and-master-only stage: post-test # We cannot use needs since it would mean needing 84 jobs (since most are parallelized) # so we use `dependencies` here. dependencies: - - setup-test-env pg11 + - setup-test-env - rspec migration pg11 - rspec unit pg11 - rspec integration pg11 @@ -231,104 +231,11 @@ rspec:coverage: - coverage/index.html - coverage/assets/ - tmp/memory_test/ -# EE and FOSS jobs # -#################### - -#################### -# master-only jobs # -.rspec-base-pg10: - extends: - - .rspec-base - - .rails:rules:master-refs-code-backstage - - .use-pg10 - needs: ["setup-test-env pg10", "retrieve-tests-metadata", "compile-assets pull-cache"] +# EE/FOSS: default refs (MRs, master, schedules) jobs # +####################################################### -rspec migration pg10: - extends: - - .rspec-base-pg10 - - .rspec-base-migration - parallel: 5 - -rspec unit pg10: - extends: .rspec-base-pg10 - parallel: 20 - -rspec integration pg10: - extends: .rspec-base-pg10 - parallel: 8 - -rspec system pg10: - extends: .rspec-base-pg10 - parallel: 24 -# master-only jobs # -#################### - -###################### -# nightly-only jobs # -.rspec-base-pg9: - extends: - - .rspec-base - - .rails:rules:nightly-master-refs-code-backstage - - .use-pg9 - needs: ["setup-test-env pg9", "retrieve-tests-metadata", "compile-assets pull-cache"] - -rspec migration pg9: - extends: - - .rspec-base-pg9 - - .rspec-base-migration - parallel: 5 - -rspec unit pg9: - extends: .rspec-base-pg9 - parallel: 20 - -rspec integration pg9: - extends: .rspec-base-pg9 - parallel: 8 - -rspec system pg9: - extends: .rspec-base-pg9 - parallel: 24 -# nightly-only jobs # -##################### - -####################### -# EE master-only jobs # -.rspec-ee-base-pg10: - extends: - - .rspec-base-ee - - .use-pg10-ee - needs: ["setup-test-env pg10", "retrieve-tests-metadata", "compile-assets pull-cache"] - -rspec-ee migration pg10: - extends: - - .rspec-ee-base-pg10 - - .rspec-base-migration - - .rails:rules:master-refs-code-backstage - parallel: 2 - -rspec-ee unit pg10: - extends: - - .rspec-ee-base-pg10 - - .rails:rules:master-refs-code-backstage - parallel: 10 - -rspec-ee integration pg10: - extends: - - .rspec-ee-base-pg10 - - .rails:rules:master-refs-code-backstage - parallel: 4 - -rspec-ee system pg10: - extends: - - .rspec-ee-base-pg10 - - .rails:rules:master-refs-code-backstage - parallel: 6 -# EE master-only jobs # -####################### - -################ -# EE-only jobs # +################################################## +# EE: default refs (MRs, master, schedules) jobs # .rspec-base-ee: extends: - .rspec-base @@ -336,10 +243,11 @@ rspec-ee system pg10: .rspec-base-pg11-as-if-foss: extends: - - .rspec-base-ee + - .rspec-base + - .rails:rules:as-if-foss - .as-if-foss - .use-pg11 - needs: ["setup-test-env pg11", "retrieve-tests-metadata", "compile-assets pull-cache as-if-foss"] + needs: ["setup-test-env", "retrieve-tests-metadata", "compile-assets pull-cache as-if-foss"] .rspec-ee-base-pg11: extends: @@ -385,6 +293,8 @@ rspec-ee system pg11: .rspec-ee-base-geo: extends: .rspec-base-ee script: + - run_timed_command "scripts/gitaly-test-build" + - run_timed_command "scripts/gitaly-test-spawn" - source scripts/rspec_helpers.sh - scripts/prepare_postgres_fdw.sh - rspec_paralellized_job "--tag ~quarantine --tag geo" @@ -411,26 +321,5 @@ db:rollback geo: script: - bundle exec rake geo:db:migrate VERSION=20170627195211 - bundle exec rake geo:db:migrate -# EE-only jobs # -################ - -######################## -# 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 # -######################## +# EE: default refs (MRs, master, schedules) jobs # +################################################## |