summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-05-21 20:51:09 -0500
committerKamil Trzcinski <ayufan@ayufan.eu>2016-06-03 17:08:17 +0200
commit71edcf59ee1f8bf7047ca293d5693642feeb3669 (patch)
tree2298cc95a01eb36d8825c66d07ad8ac578b552d7 /.gitlab-ci.yml
parent5ebc2a53ef536982f93fb7d32dd616a1162c07b3 (diff)
downloadgitlab-ce-71edcf59ee1f8bf7047ca293d5693642feeb3669.tar.gz
Improve .gitlab-ci.yml
Diffstat (limited to '.gitlab-ci.yml')
-rw-r--r--.gitlab-ci.yml122
1 files changed, 44 insertions, 78 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d7b99cf27bb..dc81a698551 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -15,35 +15,13 @@ variables:
RSPEC_RETRY_RETRY_COUNT: "3"
RAILS_ENV: "test"
SIMPLECOV: "true"
+ USE_DB: "true"
before_script:
- source ./scripts/prepare_build.sh
- - ruby -v
- - which ruby
- - retry gem install bundler --no-ri --no-rdoc
- cp config/gitlab.yml.example config/gitlab.yml
- - touch log/application.log
- - touch log/test.log
- retry bundle install --without postgres production --jobs $(nproc) "${FLAGS[@]}"
- - bundle exec rake db:drop db:create db:schema:load db:migrate
-
-.rspec_tests: &rspec_tests
- stage: test
- script:
- - JOB_NAME=( $CI_BUILD_NAME )
- - export CI_NODE_INDEX=${JOB_NAME[1]}
- - export CI_NODE_TOTAL=${JOB_NAME[2]}
- - bundle exec rake assets:precompile 2>/dev/null
- - bundle exec rake knapsack:rspec
-
-.spinach_tests: &spinach_tests
- stage: test
- script:
- - JOB_NAME=( $CI_BUILD_NAME )
- - export CI_NODE_INDEX=${JOB_NAME[1]}
- - export CI_NODE_TOTAL=${JOB_NAME[2]}
- - bundle exec rake assets:precompile 2>/dev/null
- - bundle exec rake knapsack:cucumber
+ - '[ "$USE_DB" != "true" ] || bundle exec rake db:drop db:create db:schema:load db:migrate'
stages:
- build
@@ -52,6 +30,8 @@ stages:
prepare:
stage: build
+ variables:
+ USE_DB: "false"
script:
- bundle exec rake assets:precompile
- echo "{}" > knapsack_rspec_report.json
@@ -62,57 +42,48 @@ prepare:
- knapsack_rspec_report.json
- knapsack_cucumber_report.json
-spec 0 10: *rspec_tests
-spec 1 10: *rspec_tests
-spec 2 10: *rspec_tests
-spec 3 10: *rspec_tests
-spec 4 10: *rspec_tests
-spec 5 10: *rspec_tests
-spec 6 10: *rspec_tests
-spec 7 10: *rspec_tests
-spec 8 10: *rspec_tests
-spec 9 10: *rspec_tests
-
-spinach 0 10: *spinach_tests
-spinach 1 10: *spinach_tests
-spinach 2 10: *spinach_tests
-spinach 3 10: *spinach_tests
-spinach 4 10: *spinach_tests
-spinach 5 10: *spinach_tests
-spinach 6 10: *spinach_tests
-spinach 7 10: *spinach_tests
-spinach 8 10: *spinach_tests
-spinach 9 10: *spinach_tests
-
-teaspoon:
+.knapsack: &knapsack
stage: test
script:
- - bundle exec teaspoon
-
-rubocop:
- stage: test
- script:
- - bundle exec rubocop
-
-scss-lint:
- stage: test
- script:
- - bundle exec rake scss_lint
-
-brakeman:
- stage: test
- script:
- - bundle exec rake brakeman
-
-flog:
- stage: test
- script:
- - bundle exec rake flog
-
-flay:
- stage: test
- script:
- - bundle exec rake flay
+ - JOB_NAME=( $CI_BUILD_NAME )
+ - export CI_NODE_INDEX=${JOB_NAME[1]}
+ - export CI_NODE_TOTAL=${JOB_NAME[2]}
+ - bundle exec rake knapsack:${JOB_NAME[0]}
+
+.exec: &exec
+ stage: test
+ script:
+ - bundle exec $CI_BUILD_NAME
+
+rspec 0 10: *knapsack
+rspec 1 10: *knapsack
+rspec 2 10: *knapsack
+rspec 3 10: *knapsack
+rspec 4 10: *knapsack
+rspec 5 10: *knapsack
+rspec 6 10: *knapsack
+rspec 7 10: *knapsack
+rspec 8 10: *knapsack
+rspec 9 10: *knapsack
+
+spinach 0 10: *knapsack
+spinach 1 10: *knapsack
+spinach 2 10: *knapsack
+spinach 3 10: *knapsack
+spinach 4 10: *knapsack
+spinach 5 10: *knapsack
+spinach 6 10: *knapsack
+spinach 7 10: *knapsack
+spinach 8 10: *knapsack
+spinach 9 10: *knapsack
+
+teaspoon: *exec
+rubocop: *exec
+rake scss_lint: *exec
+rake brakeman: *exec
+rake flog: *exec
+rake flay: *exec
+rake db:migrate:reset: *exec
bundler:audit:
stage: test
@@ -121,11 +92,6 @@ bundler:audit:
script:
- "bundle exec bundle-audit check --update --ignore OSVDB-115941"
-db-migrate-reset:
- stage: test
- script:
- - bundle exec rake db:migrate:reset
-
# Ruby 2.2 jobs
spec:feature:ruby22: