Commit f5f65d69 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Refactor all testing suites

parent e6567bc1
...@@ -32,16 +32,7 @@ stages: ...@@ -32,16 +32,7 @@ stages:
- post-test - post-test
- notifications - notifications
precompile: # Prepare and merge knapsack tests
stage: prepare
services: []
variables:
USE_DB: "false"
script:
- bundle exec rake assets:precompile
artifacts:
paths:
- public/assets/
.knapsack_state: &knapsack_state .knapsack_state: &knapsack_state
services: [] services: []
...@@ -56,20 +47,6 @@ precompile: ...@@ -56,20 +47,6 @@ precompile:
paths: paths:
- knapsack/ - knapsack/
.knapsack: &knapsack
stage: test
script:
- JOB_NAME=( $CI_BUILD_NAME )
- export CI_NODE_INDEX=${JOB_NAME[1]}
- export CI_NODE_TOTAL=${JOB_NAME[2]}
- export KNAPSACK_REPORT_PATH=knapsack/${JOB_NAME}_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
- export KNAPSACK_GENERATE_REPORT=true
- cp knapsack/${JOB_NAME}_report.json ${KNAPSACK_REPORT_PATH}
- knapsack ${JOB_NAME[0]}
artifacts:
paths:
- knapsack/
knapsack: knapsack:
<<: *knapsack_state <<: *knapsack_state
stage: prepare stage: prepare
...@@ -86,10 +63,22 @@ update-knapsack: ...@@ -86,10 +63,22 @@ update-knapsack:
- scripts/merge-reports knapsack/spinach_report.json knapsack/spinach_node_*.json - scripts/merge-reports knapsack/spinach_report.json knapsack/spinach_node_*.json
- rm -f knapsack/*_node_*.json - rm -f knapsack/*_node_*.json
.exec: &exec # Execute all testing suites
.knapsack: &knapsack
stage: test stage: test
script: script:
- bundle exec $CI_BUILD_NAME - bundle exec rake assets:precompile 2>/dev/null
- JOB_NAME=( $CI_BUILD_NAME )
- export CI_NODE_INDEX=${JOB_NAME[1]}
- export CI_NODE_TOTAL=${JOB_NAME[2]}
- export KNAPSACK_REPORT_PATH=knapsack/${JOB_NAME}_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
- export KNAPSACK_GENERATE_REPORT=true
- cp knapsack/${JOB_NAME}_report.json ${KNAPSACK_REPORT_PATH}
- knapsack ${JOB_NAME[0]}
artifacts:
paths:
- knapsack/
rspec 0 20: *knapsack rspec 0 20: *knapsack
rspec 1 20: *knapsack rspec 1 20: *knapsack
...@@ -123,137 +112,76 @@ spinach 7 10: *knapsack ...@@ -123,137 +112,76 @@ spinach 7 10: *knapsack
spinach 8 10: *knapsack spinach 8 10: *knapsack
spinach 9 10: *knapsack spinach 9 10: *knapsack
teaspoon: *exec # Execute all testing suites against Ruby 2.2
rubocop: *exec
rake scss_lint: *exec
rake brakeman: *exec
rake flog: *exec
rake flay: *exec
rake db:migrate:reset: *exec
bundler:audit: .knapsack-ruby22: &knapsack-ruby22
stage: test <<: *knapsack
image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.2
only: only:
- master - master
script:
- "bundle exec bundle-audit check --update --ignore OSVDB-115941"
# Ruby 2.2 jobs
spec:feature:ruby22:
stage: test
image: ruby:2.2
only:
- master
script:
- bundle exec rake assets:precompile 2>/dev/null
- bundle exec rake spec:feature
cache:
key: "ruby22"
paths:
- vendor
spec:api:ruby22:
stage: test
image: ruby:2.2
only:
- master
script:
- bundle exec rake spec:api
cache: cache:
key: "ruby22" key: "ruby22"
paths: paths:
- vendor - vendor
spec:models:ruby22: rspec 0 20 ruby22: *knapsack-ruby22
stage: test rspec 1 20 ruby22: *knapsack-ruby22
image: ruby:2.2 rspec 2 20 ruby22: *knapsack-ruby22
only: rspec 3 20 ruby22: *knapsack-ruby22
- master rspec 4 20 ruby22: *knapsack-ruby22
script: rspec 5 20 ruby22: *knapsack-ruby22
- bundle exec rake spec:models rspec 6 20 ruby22: *knapsack-ruby22
cache: rspec 7 20 ruby22: *knapsack-ruby22
key: "ruby22" rspec 8 20 ruby22: *knapsack-ruby22
paths: rspec 9 20 ruby22: *knapsack-ruby22
- vendor rspec 10 20 ruby22: *knapsack-ruby22
rspec 11 20 ruby22: *knapsack-ruby22
spec:lib:ruby22: rspec 12 20 ruby22: *knapsack-ruby22
stage: test rspec 13 20 ruby22: *knapsack-ruby22
image: ruby:2.2 rspec 14 20 ruby22: *knapsack-ruby22
only: rspec 15 20 ruby22: *knapsack-ruby22
- master rspec 16 20 ruby22: *knapsack-ruby22
script: rspec 17 20 ruby22: *knapsack-ruby22
- bundle exec rake spec:lib rspec 18 20 ruby22: *knapsack-ruby22
cache: rspec 19 20 ruby22: *knapsack-ruby22
key: "ruby22"
paths: spinach 0 10 ruby22: *knapsack-ruby22
- vendor spinach 1 10 ruby22: *knapsack-ruby22
spinach 2 10 ruby22: *knapsack-ruby22
spinach 3 10 ruby22: *knapsack-ruby22
spinach 4 10 ruby22: *knapsack-ruby22
spinach 5 10 ruby22: *knapsack-ruby22
spinach 6 10 ruby22: *knapsack-ruby22
spinach 7 10 ruby22: *knapsack-ruby22
spinach 8 10 ruby22: *knapsack-ruby22
spinach 9 10 ruby22: *knapsack-ruby22
# Other generic tests
spec:services:ruby22: .exec: &exec
stage: test
image: ruby:2.2
only:
- master
script:
- bundle exec rake spec:services
cache:
key: "ruby22"
paths:
- vendor
spec:other:ruby22:
stage: test stage: test
image: ruby:2.2
only:
- master
script: script:
- bundle exec rake spec:other - bundle exec $CI_BUILD_NAME
cache:
key: "ruby22"
paths:
- vendor
spinach:project:half:ruby22: teaspoon: *exec
stage: test rubocop: *exec
image: ruby:2.2 rake scss_lint: *exec
only: rake brakeman: *exec
- master rake flog: *exec
script: rake flay: *exec
- bundle exec rake assets:precompile 2>/dev/null rake db:migrate:reset: *exec
- bundle exec rake spinach:project:half
cache:
key: "ruby22"
paths:
- vendor
spinach:project:rest:ruby22: bundler:audit:
stage: test stage: test
image: ruby:2.2
only: only:
- master - master
script: script:
- bundle exec rake assets:precompile 2>/dev/null - "bundle exec bundle-audit check --update --ignore OSVDB-115941"
- bundle exec rake spinach:project:rest
cache:
key: "ruby22"
paths:
- vendor
spinach:other:ruby22: # Notify slack in the end
stage: test
image: ruby:2.2
only:
- master
script:
- bundle exec rake assets:precompile 2>/dev/null
- bundle exec rake spinach:other
cache:
key: "ruby22"
paths:
- vendor
notify:slack: notify:slack:
stage: notifications stage: post-test
script: script:
- ./scripts/notify_slack.sh "#builds" "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 "#builds" "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>"
when: on_failure when: on_failure
......
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