Commit 71edcf59 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Improve .gitlab-ci.yml

parent 5ebc2a53
...@@ -15,35 +15,13 @@ variables: ...@@ -15,35 +15,13 @@ variables:
RSPEC_RETRY_RETRY_COUNT: "3" RSPEC_RETRY_RETRY_COUNT: "3"
RAILS_ENV: "test" RAILS_ENV: "test"
SIMPLECOV: "true" SIMPLECOV: "true"
USE_DB: "true"
before_script: before_script:
- source ./scripts/prepare_build.sh - 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 - 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[@]}" - retry bundle install --without postgres production --jobs $(nproc) "${FLAGS[@]}"
- bundle exec rake db:drop db:create db:schema:load db:migrate - '[ "$USE_DB" != "true" ] || 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
stages: stages:
- build - build
...@@ -52,6 +30,8 @@ stages: ...@@ -52,6 +30,8 @@ stages:
prepare: prepare:
stage: build stage: build
variables:
USE_DB: "false"
script: script:
- bundle exec rake assets:precompile - bundle exec rake assets:precompile
- echo "{}" > knapsack_rspec_report.json - echo "{}" > knapsack_rspec_report.json
...@@ -62,57 +42,48 @@ prepare: ...@@ -62,57 +42,48 @@ prepare:
- knapsack_rspec_report.json - knapsack_rspec_report.json
- knapsack_cucumber_report.json - knapsack_cucumber_report.json
spec 0 10: *rspec_tests .knapsack: &knapsack
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:
stage: test stage: test
script: script:
- bundle exec teaspoon - JOB_NAME=( $CI_BUILD_NAME )
- export CI_NODE_INDEX=${JOB_NAME[1]}
rubocop: - export CI_NODE_TOTAL=${JOB_NAME[2]}
stage: test - bundle exec rake knapsack:${JOB_NAME[0]}
script:
- bundle exec rubocop .exec: &exec
stage: test
scss-lint: script:
stage: test - bundle exec $CI_BUILD_NAME
script:
- bundle exec rake scss_lint rspec 0 10: *knapsack
rspec 1 10: *knapsack
brakeman: rspec 2 10: *knapsack
stage: test rspec 3 10: *knapsack
script: rspec 4 10: *knapsack
- bundle exec rake brakeman rspec 5 10: *knapsack
rspec 6 10: *knapsack
flog: rspec 7 10: *knapsack
stage: test rspec 8 10: *knapsack
script: rspec 9 10: *knapsack
- bundle exec rake flog
spinach 0 10: *knapsack
flay: spinach 1 10: *knapsack
stage: test spinach 2 10: *knapsack
script: spinach 3 10: *knapsack
- bundle exec rake flay 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: bundler:audit:
stage: test stage: test
...@@ -121,11 +92,6 @@ bundler:audit: ...@@ -121,11 +92,6 @@ bundler:audit:
script: script:
- "bundle exec bundle-audit check --update --ignore OSVDB-115941" - "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 # Ruby 2.2 jobs
spec:feature:ruby22: spec:feature:ruby22:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment