debian-mirror-gitlab/.gitlab/ci/rails.gitlab-ci.yml

288 lines
7.8 KiB
YAML
Raw Normal View History

2019-07-31 22:56:46 +05:30
.use-pg: &use-pg
services:
2019-09-30 21:07:59 +05:30
- name: postgres:9.6.11
2019-07-31 22:56:46 +05:30
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
- name: redis:alpine
.use-pg-10: &use-pg-10
services:
2019-09-04 21:01:54 +05:30
- name: postgres:10.7
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
- name: redis:alpine
2019-07-31 22:56:46 +05:30
.only-schedules-master: &only-schedules-master
only:
- 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
.gitlab-setup: &gitlab-setup
2019-09-30 21:07:59 +05:30
extends:
- .dedicated-no-docs-and-no-qa-pull-cache-job
- .use-pg
2019-07-31 22:56:46 +05:30
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
.rake-exec: &rake-exec
extends: .dedicated-no-docs-no-db-pull-cache-job
script:
- bundle exec rake $CI_JOB_NAME
.rspec-metadata: &rspec-metadata
2019-09-30 21:07:59 +05:30
extends:
- .dedicated-pull-cache-job
- .no-docs-and-no-qa
2019-07-31 22:56:46 +05:30
stage: test
script:
- JOB_NAME=( $CI_JOB_NAME )
- TEST_TOOL=${JOB_NAME[0]}
2019-09-04 21:01:54 +05:30
- 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
2019-07-31 22:56:46 +05:30
- 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
2019-09-04 21:01:54 +05:30
- date
- 'export KNAPSACK_TEST_FILE_PATTERN=$(ruby -r./lib/quality/test_level.rb -e "puts Quality::TestLevel.new.pattern(:${TEST_LEVEL})")'
2019-09-30 21:07:59 +05:30
- 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"
2019-09-04 21:01:54 +05:30
- knapsack rspec "--color --format documentation --format RspecJunitFormatter --out junit_rspec.xml --tag level:${TEST_LEVEL} --tag ~geo"
- date
2019-07-31 22:56:46 +05:30
artifacts:
expire_in: 31d
when: always
paths:
- coverage/
- knapsack/
- rspec_flaky/
- rspec_profiling/
- tmp/capybara/
2019-09-30 21:07:59 +05:30
- tmp/memory_test/
# reports:
# junit: junit_rspec.xml
2019-07-31 22:56:46 +05:30
.rspec-metadata-pg: &rspec-metadata-pg
<<: *rspec-metadata
<<: *use-pg
.rspec-metadata-pg-10: &rspec-metadata-pg-10
<<: *rspec-metadata
<<: *use-pg-10
2019-09-04 21:01:54 +05:30
image: "dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.6.3-golang-1.11-git-2.21-chrome-73.0-node-12.x-yarn-1.16-postgresql-10-graphicsmagick-1.3.29"
2019-07-31 22:56:46 +05:30
# DB migration, rollback, and seed jobs
.db-migrate-reset: &db-migrate-reset
extends: .dedicated-no-docs-and-no-qa-pull-cache-job
script:
- bundle exec rake db:migrate:reset
dependencies:
- setup-test-env
.migration-paths: &migration-paths
extends: .dedicated-no-docs-and-no-qa-pull-cache-job
variables:
SETUP_DB: "false"
script:
2019-09-04 21:01:54 +05:30
- git fetch https://gitlab.com/gitlab-org/gitlab-ce.git v11.11.0
2019-07-31 22:56:46 +05:30
- git checkout -f FETCH_HEAD
- sed -i "s/gem 'oj', '~> 2.17.4'//" Gemfile
2019-09-04 21:01:54 +05:30
- sed -i "s/gem 'bootsnap', '~> 1.0.0'/gem 'bootsnap'/" Gemfile
- bundle update google-protobuf grpc bootsnap
2019-07-31 22:56:46 +05:30
- 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
dependencies:
- setup-test-env
setup-test-env:
2019-09-30 21:07:59 +05:30
extends:
- .dedicated-runner-default-cache
- .no-docs
- .use-pg
2019-07-31 22:56:46 +05:30
stage: prepare
script:
- bundle exec ruby -Ispec -e 'require "spec_helper" ; TestEnv.init'
2019-09-04 21:01:54 +05:30
- scripts/gitaly-test-build # Do not use 'bundle exec' here
2019-07-31 22:56:46 +05:30
artifacts:
expire_in: 7d
paths:
- tmp/tests
- config/secrets.yml
- vendor/gitaly-ruby
2019-09-04 21:01:54 +05:30
rspec unit pg:
<<: *rspec-metadata-pg
parallel: 20
rspec integration pg:
2019-07-31 22:56:46 +05:30
<<: *rspec-metadata-pg
2019-09-04 21:01:54 +05:30
parallel: 6
rspec system pg:
<<: *rspec-metadata-pg
parallel: 24
rspec unit pg-10:
<<: *rspec-metadata-pg-10
<<: *only-schedules-master
parallel: 20
rspec integration pg-10:
<<: *rspec-metadata-pg-10
<<: *only-schedules-master
parallel: 6
2019-07-31 22:56:46 +05:30
2019-09-04 21:01:54 +05:30
rspec system pg-10:
2019-07-31 22:56:46 +05:30
<<: *rspec-metadata-pg-10
<<: *only-schedules-master
2019-09-04 21:01:54 +05:30
parallel: 24
2019-07-31 22:56:46 +05:30
rspec-fast-spec-helper:
<<: *rspec-metadata-pg
script:
- bundle exec rspec spec/fast_spec_helper.rb
.rspec-quarantine: &rspec-quarantine
<<: *only-schedules-master
script:
- export CACHE_CLASSES=true
- scripts/gitaly-test-spawn
2019-09-04 21:01:54 +05:30
- bin/rspec --color --format documentation --tag quarantine -- spec/
2019-07-31 22:56:46 +05:30
2019-09-04 21:01:54 +05:30
rspec quarantine pg:
2019-07-31 22:56:46 +05:30
<<: *rspec-metadata-pg
<<: *rspec-quarantine
allow_failure: true
static-analysis:
extends: .dedicated-no-docs-no-db-pull-cache-job
dependencies:
- compile-assets
2019-09-30 21:07:59 +05:30
- compile-assets pull-cache
2019-07-31 22:56:46 +05:30
- setup-test-env
script:
- scripts/static-analysis
cache:
2019-09-04 21:01:54 +05:30
key: "debian-stretch-ruby-2.6.3-node-12.x-and-rubocop"
2019-07-31 22:56:46 +05:30
paths:
- vendor/ruby
- .yarn-cache/
- tmp/rubocop_cache
policy: pull-push
downtime_check:
<<: *rake-exec
except:
2019-09-30 21:07:59 +05:30
refs:
- master
- tags
- /^[\d-]+-stable(-ee)?$/
- /(^docs[\/-].*|.*-docs$)/
- /(^qa[\/-].*|.*-qa$)/
2019-07-31 22:56:46 +05:30
dependencies:
- setup-test-env
ee_compat_check:
<<: *rake-exec
dependencies: []
except:
2019-09-30 21:07:59 +05:30
refs:
- master
- tags
- /[\d-]+-stable(-ee)?/
- /^security-/
- branches@gitlab-org/gitlab-ee
- branches@gitlab/gitlab-ee
2019-07-31 22:56:46 +05:30
retry: 0
artifacts:
name: "${CI_JOB_NAME}_${CI_COMIT_REF_NAME}_${CI_COMMIT_SHA}"
when: always
expire_in: 10d
paths:
- ee_compat_check/patches/*.patch
db:migrate:reset-pg:
<<: *db-migrate-reset
<<: *use-pg
db:check-schema-pg:
<<: *db-migrate-reset
<<: *use-pg
script:
- source scripts/schema_changed.sh
migration:path-pg:
<<: *migration-paths
<<: *use-pg
.db-rollback: &db-rollback
extends: .dedicated-no-docs-and-no-qa-pull-cache-job
script:
2019-09-30 21:07:59 +05:30
- bundle exec rake db:migrate VERSION=20180101160629
- bundle exec rake db:migrate SKIP_SCHEMA_VERSION_CHECK=true
2019-07-31 22:56:46 +05:30
dependencies:
- setup-test-env
db:rollback-pg:
<<: *db-rollback
<<: *use-pg
gitlab:setup-pg:
<<: *gitlab-setup
<<: *use-pg
dependencies:
- setup-test-env
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
2019-09-30 21:07:59 +05:30
extends:
- .dedicated-runner-default-cache
- .no-docs-and-no-qa
2019-07-31 22:56:46 +05:30
cache:
policy: pull
variables:
SETUP_DB: "false"
stage: post-test
script:
- bundle exec scripts/merge-simplecov
2019-09-30 21:07:59 +05:30
- bundle exec scripts/gather-test-memory-data
2019-07-31 22:56:46 +05:30
coverage: '/LOC \((\d+\.\d+%)\) covered.$/'
artifacts:
name: coverage
expire_in: 31d
paths:
2019-09-04 21:01:54 +05:30
- coverage/index.html
- coverage/assets/
2019-09-30 21:07:59 +05:30
- tmp/memory_test/