diff options
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r-- | .gitlab-ci.yml | 140 |
1 files changed, 55 insertions, 85 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 475346dcd34..492f5ef715d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,14 +7,13 @@ cache: variables: MYSQL_ALLOW_EMPTY_PASSWORD: "1" - # retry tests only in CI environment - RSPEC_RETRY_RETRY_COUNT: "3" RAILS_ENV: "test" SIMPLECOV: "true" SETUP_DB: "true" USE_BUNDLE_INSTALL: "true" GIT_DEPTH: "20" PHANTOMJS_VERSION: "2.1.1" + GET_SOURCES_ATTEMPTS: "3" before_script: - source ./scripts/prepare_build.sh @@ -34,7 +33,6 @@ stages: .dedicated-runner: &dedicated-runner tags: - gitlab-org - - 2gb .knapsack-state: &knapsack-state services: [] @@ -111,11 +109,16 @@ setup-test-env: <<: *dedicated-runner stage: prepare script: - - bundle exec rake assets:precompile 2>/dev/null + - node --version + - yarn --version + - yarn install --pure-lockfile + - yarn check # ensure that yarn.lock matches package.json + - bundle exec rake gitlab:assets:compile - bundle exec ruby -Ispec -e 'require "spec_helper" ; TestEnv.init' artifacts: expire_in: 7d paths: + - node_modules - public/assets - tmp/tests @@ -165,64 +168,7 @@ spinach 7 10: *spinach-knapsack spinach 8 10: *spinach-knapsack spinach 9 10: *spinach-knapsack -# Execute all testing suites against Ruby 2.1 -.ruby-21: &ruby-21 - image: "dev.gitlab.org:5005/gitlab/gitlab-build-images:ruby-2.1-git-2.7-phantomjs-2.1" - <<: *use-db - only: - - master@gitlab-org/gitlab-ce - - master@gitlab-org/gitlab-ee - - master@gitlab/gitlabhq - - master@gitlab/gitlab-ee - cache: - key: "ruby21" - paths: - - vendor/ruby - -.rspec-knapsack-ruby21: &rspec-knapsack-ruby21 - <<: *rspec-knapsack - <<: *dedicated-runner - <<: *ruby-21 - -.spinach-knapsack-ruby21: &spinach-knapsack-ruby21 - <<: *spinach-knapsack - <<: *dedicated-runner - <<: *ruby-21 - -rspec 0 20 ruby21: *rspec-knapsack-ruby21 -rspec 1 20 ruby21: *rspec-knapsack-ruby21 -rspec 2 20 ruby21: *rspec-knapsack-ruby21 -rspec 3 20 ruby21: *rspec-knapsack-ruby21 -rspec 4 20 ruby21: *rspec-knapsack-ruby21 -rspec 5 20 ruby21: *rspec-knapsack-ruby21 -rspec 6 20 ruby21: *rspec-knapsack-ruby21 -rspec 7 20 ruby21: *rspec-knapsack-ruby21 -rspec 8 20 ruby21: *rspec-knapsack-ruby21 -rspec 9 20 ruby21: *rspec-knapsack-ruby21 -rspec 10 20 ruby21: *rspec-knapsack-ruby21 -rspec 11 20 ruby21: *rspec-knapsack-ruby21 -rspec 12 20 ruby21: *rspec-knapsack-ruby21 -rspec 13 20 ruby21: *rspec-knapsack-ruby21 -rspec 14 20 ruby21: *rspec-knapsack-ruby21 -rspec 15 20 ruby21: *rspec-knapsack-ruby21 -rspec 16 20 ruby21: *rspec-knapsack-ruby21 -rspec 17 20 ruby21: *rspec-knapsack-ruby21 -rspec 18 20 ruby21: *rspec-knapsack-ruby21 -rspec 19 20 ruby21: *rspec-knapsack-ruby21 - -spinach 0 10 ruby21: *spinach-knapsack-ruby21 -spinach 1 10 ruby21: *spinach-knapsack-ruby21 -spinach 2 10 ruby21: *spinach-knapsack-ruby21 -spinach 3 10 ruby21: *spinach-knapsack-ruby21 -spinach 4 10 ruby21: *spinach-knapsack-ruby21 -spinach 5 10 ruby21: *spinach-knapsack-ruby21 -spinach 6 10 ruby21: *spinach-knapsack-ruby21 -spinach 7 10 ruby21: *spinach-knapsack-ruby21 -spinach 8 10 ruby21: *spinach-knapsack-ruby21 -spinach 9 10 ruby21: *spinach-knapsack-ruby21 - # Other generic tests - .ruby-static-analysis: &ruby-static-analysis variables: SIMPLECOV: "false" @@ -236,9 +182,16 @@ spinach 9 10 ruby21: *spinach-knapsack-ruby21 script: - bundle exec $CI_BUILD_NAME -rubocop: *exec +rubocop: + <<: *ruby-static-analysis + <<: *dedicated-runner + stage: test + script: + - bundle exec "rubocop --require rubocop-rspec" + rake haml_lint: *exec rake scss_lint: *exec +rake config_lint: *exec rake brakeman: *exec rake flay: *exec license_finder: *exec @@ -269,7 +222,7 @@ rake db:migrate:reset: <<: *use-db <<: *dedicated-runner script: - - rake db:migrate:reset + - bundle exec rake db:migrate:reset rake db:seed_fu: stage: test @@ -289,23 +242,40 @@ rake db:seed_fu: paths: - log/development.log -teaspoon: +rake gitlab:assets:compile: + stage: test + <<: *dedicated-runner + dependencies: [] + variables: + NODE_ENV: "production" + RAILS_ENV: "production" + SETUP_DB: "false" + USE_DB: "false" + SKIP_STORAGE_VALIDATION: "true" + WEBPACK_REPORT: "true" + script: + - bundle exec rake yarn:install gitlab:assets:compile + artifacts: + name: webpack-report + expire_in: 31d + paths: + - webpack-report/ + +rake karma: cache: paths: - vendor/ruby - - node_modules/ + - node_modules stage: test <<: *use-db <<: *dedicated-runner script: - - npm install - - npm link istanbul - - rake teaspoon + - bundle exec rake karma artifacts: name: coverage-javascript expire_in: 31d paths: - - coverage-javascript/default/ + - coverage-javascript/ lint-doc: stage: test @@ -332,7 +302,7 @@ bundler:audit: - master@gitlab/gitlabhq - master@gitlab/gitlab-ee script: - - "bundle exec bundle-audit check --update --ignore OSVDB-115941" + - "bundle exec bundle-audit check --update" migration paths: stage: test @@ -351,10 +321,10 @@ migration paths: - cp config/resque.yml.example config/resque.yml - sed -i 's/localhost/redis/g' config/resque.yml - bundle install --without postgres production --jobs $(nproc) $FLAGS --retry=3 - - rake db:drop db:create db:schema:load db:seed_fu + - bundle exec rake db:drop db:create db:schema:load db:seed_fu - git checkout $CI_BUILD_REF - source scripts/prepare_build.sh - - rake db:migrate + - bundle exec rake db:migrate coverage: stage: post-test @@ -378,11 +348,9 @@ lint:javascript: paths: - node_modules/ stage: test - image: "node:7.1" - before_script: - - npm install + before_script: [] script: - - npm --silent run eslint + - yarn run eslint lint:javascript:report: <<: *dedicated-runner @@ -390,12 +358,10 @@ lint:javascript:report: paths: - node_modules/ stage: post-test - image: "node:7.1" - before_script: - - npm install + before_script: [] script: - find app/ spec/ -name '*.js' -or -name '*.js.es6' -exec sed --in-place 's|/\* eslint-disable .*\*/||' {} \; # run report over all files - - npm --silent run eslint-report || true # ignore exit code + - yarn run eslint-report || true # ignore exit code artifacts: name: eslint-report expire_in: 31d @@ -428,7 +394,7 @@ notify:slack: SETUP_DB: "false" USE_BUNDLE_INSTALL: "false" script: - - ./scripts/notify_slack.sh "#development" "Build on \`$CI_BUILD_REF_NAME\` failed! Commit \`$(git log -1 --oneline)\` See <https://gitlab.com/gitlab-org/$(basename "$PWD")/commit/"$CI_BUILD_REF"/builds>" + - ./scripts/notify_slack.sh "#development" "Build on \`$CI_BUILD_REF_NAME\` failed! Commit \`$(git log -1 --oneline)\` See <https://gitlab.com/gitlab-org/$(basename "$PWD")/commit/"$CI_BUILD_REF"/pipelines>" when: on_failure only: - master@gitlab-org/gitlab-ce @@ -442,19 +408,22 @@ pages: <<: *dedicated-runner dependencies: - coverage - - teaspoon + - rake karma + - rake gitlab:assets:compile - lint:javascript:report script: - mv public/ .public/ - mkdir public/ - - mv coverage public/coverage-ruby - - mv coverage-javascript/default/ public/coverage-javascript/ - - mv eslint-report.html public/ + - mv coverage/ public/coverage-ruby/ || true + - mv coverage-javascript/ public/coverage-javascript/ || true + - mv eslint-report.html public/ || true + - mv webpack-report/ public/webpack-report/ || true artifacts: paths: - public only: - master@gitlab-org/gitlab-ce + - master@gitlab-org/gitlab-ee # Insurance in case a gem needed by one of our releases gets yanked from # rubygems.org in the future. @@ -471,3 +440,4 @@ cache gems: - vendor/cache only: - master@gitlab-org/gitlab-ce + - master@gitlab-org/gitlab-ee |