GitLab steht Mittwoch, den 23. September, zwischen 10:00 und 12:00 Uhr aufgrund von Wartungsarbeiten nicht zur Verfügung.

.gitlab-ci.yml 4.71 KB
Newer Older
James Lopez's avatar
James Lopez committed
1
image: "ruby:2.1"
2 3 4 5 6

services:
  - mysql:latest
  - redis:latest

7
cache:
8
  key: "ruby21"
9 10 11
  paths:
  - vendor

12 13
variables:
  MYSQL_ALLOW_EMPTY_PASSWORD: "1"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
14 15
  # retry tests only in CI environment
  RSPEC_RETRY_RETRY_COUNT: "3"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
16 17
  RAILS_ENV: "test"
  SIMPLECOV: "true"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
18
  USE_DB: "true"
19

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
20
before_script:
21
  - source ./scripts/prepare_build.sh
Valery Sizov's avatar
Valery Sizov committed
22
  - cp config/gitlab.yml.example config/gitlab.yml
Kamil Trzcinski's avatar
Test  
Kamil Trzcinski committed
23
  - bundle --version
Kamil Trzcinski's avatar
Kamil Trzcinski committed
24
  - retry bundle install --without postgres production --jobs $(nproc) "${FLAGS[@]}"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
25
  - retry gem install knapsack
Kamil Trzcinski's avatar
Kamil Trzcinski committed
26
  - '[ "$USE_DB" != "true" ] || bundle exec rake db:drop db:create db:schema:load db:migrate'
27

Kamil Trzcinski's avatar
Kamil Trzcinski committed
28
stages:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
29
- prepare
Kamil Trzcinski's avatar
Kamil Trzcinski committed
30 31
- test
- notifications
32

Kamil Trzcinski's avatar
Kamil Trzcinski committed
33
prepare:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
34
  stage: prepare
Kamil Trzcinski's avatar
Kamil Trzcinski committed
35 36
  variables:
    USE_DB: "false"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
37
  script:
Kamil Trzcinski's avatar
WIP  
Kamil Trzcinski committed
38
    - bundle exec rake assets:precompile
Kamil Trzcinski's avatar
Kamil Trzcinski committed
39 40 41
    - mkdir knapsack/
    - echo "{}" > knapsack/rspec_report.json
    - echo "{}" > knapsack/spinach_report.json
Kamil Trzcinski's avatar
Kamil Trzcinski committed
42 43
  artifacts:
    paths:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
44
    - public/assets/
Kamil Trzcinski's avatar
Kamil Trzcinski committed
45
    - knapsack/
Kamil Trzcinski's avatar
Kamil Trzcinski committed
46

Kamil Trzcinski's avatar
Kamil Trzcinski committed
47
.knapsack: &knapsack
48 49
  stage: test
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
50 51 52
    - JOB_NAME=( $CI_BUILD_NAME )
    - export CI_NODE_INDEX=${JOB_NAME[1]}
    - export CI_NODE_TOTAL=${JOB_NAME[2]}
Kamil Trzcinski's avatar
Kamil Trzcinski committed
53 54 55 56 57 58
    - export KNAPSACK_REPORT_PATH=knapsack/${JOB_NAME}_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json
    - cp knapsack/${JOB_NAME}_report.json ${KNAPSACK_REPORT_PATH}
    - knapsack ${JOB_NAME[0]}
  artifacts:
    paths:
    - knapsack/
59

Kamil Trzcinski's avatar
Kamil Trzcinski committed
60
.exec: &exec
61 62
  stage: test
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
63 64
    - bundle exec $CI_BUILD_NAME

Kamil Trzcinski's avatar
Kamil Trzcinski committed
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
rspec 0 20: *knapsack
rspec 1 20: *knapsack
rspec 2 20: *knapsack
rspec 3 20: *knapsack
rspec 4 20: *knapsack
rspec 5 20: *knapsack
rspec 6 20: *knapsack
rspec 7 20: *knapsack
rspec 8 20: *knapsack
rspec 9 20: *knapsack
rspec 10 20: *knapsack
rspec 11 20: *knapsack
rspec 12 20: *knapsack
rspec 13 20: *knapsack
rspec 14 20: *knapsack
rspec 15 20: *knapsack
rspec 16 20: *knapsack
rspec 17 20: *knapsack
rspec 18 20: *knapsack
rspec 19 20: *knapsack
Kamil Trzcinski's avatar
Kamil Trzcinski committed
85

Kamil Trzcinski's avatar
Kamil Trzcinski committed
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
spinach 0 20: *knapsack
spinach 1 20: *knapsack
spinach 2 20: *knapsack
spinach 3 20: *knapsack
spinach 4 20: *knapsack
spinach 5 20: *knapsack
spinach 6 20: *knapsack
spinach 7 20: *knapsack
spinach 8 20: *knapsack
spinach 9 20: *knapsack
spinach 10 20: *knapsack
spinach 11 20: *knapsack
spinach 12 20: *knapsack
spinach 13 20: *knapsack
spinach 14 20: *knapsack
spinach 15 20: *knapsack
spinach 16 20: *knapsack
spinach 17 20: *knapsack
spinach 18 20: *knapsack
spinach 19 20: *knapsack
Kamil Trzcinski's avatar
Kamil Trzcinski committed
106 107 108 109 110 111 112 113

teaspoon: *exec
rubocop: *exec
rake scss_lint: *exec
rake brakeman: *exec
rake flog: *exec
rake flay: *exec
rake db:migrate:reset: *exec
114 115 116

bundler:audit:
  stage: test
117 118
  only:
    - master
119
  script:
120
    - "bundle exec bundle-audit check --update --ignore OSVDB-115941"
121 122 123 124 125 126 127

# Ruby 2.2 jobs

spec:feature:ruby22:
  stage: test
  image: ruby:2.2
  only:
128
    - master
129
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
130 131
    - bundle exec rake assets:precompile 2>/dev/null
    - bundle exec rake spec:feature
132 133 134 135 136 137 138 139 140 141 142
  cache:
    key: "ruby22"
    paths:
    - vendor

spec:api:ruby22:
  stage: test
  image: ruby:2.2
  only:
  - master
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
143
    - bundle exec rake spec:api
144 145 146 147 148 149 150 151 152 153 154
  cache:
    key: "ruby22"
    paths:
    - vendor

spec:models:ruby22:
  stage: test
  image: ruby:2.2
  only:
  - master
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
155
    - bundle exec rake spec:models
156 157 158 159 160 161 162 163 164 165 166
  cache:
    key: "ruby22"
    paths:
    - vendor

spec:lib:ruby22:
  stage: test
  image: ruby:2.2
  only:
  - master
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
167
    - bundle exec rake spec:lib
168 169 170 171 172 173 174 175 176 177 178
  cache:
    key: "ruby22"
    paths:
    - vendor

spec:services:ruby22:
  stage: test
  image: ruby:2.2
  only:
  - master
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
179
    - bundle exec rake spec:services
180 181 182 183 184 185 186 187 188 189 190
  cache:
    key: "ruby22"
    paths:
    - vendor

spec:other:ruby22:
  stage: test
  image: ruby:2.2
  only:
  - master
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
191
    - bundle exec rake spec:other
192 193 194 195 196 197 198 199 200 201 202
  cache:
    key: "ruby22"
    paths:
    - vendor

spinach:project:half:ruby22:
  stage: test
  image: ruby:2.2
  only:
  - master
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
203 204
    - bundle exec rake assets:precompile 2>/dev/null
    - bundle exec rake spinach:project:half
205 206 207 208 209 210 211 212 213 214 215
  cache:
    key: "ruby22"
    paths:
    - vendor

spinach:project:rest:ruby22:
  stage: test
  image: ruby:2.2
  only:
  - master
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
216 217
    - bundle exec rake assets:precompile 2>/dev/null
    - bundle exec rake spinach:project:rest
218 219 220 221 222 223 224 225 226 227 228
  cache:
    key: "ruby22"
    paths:
    - vendor

spinach:other:ruby22:
  stage: test
  image: ruby:2.2
  only:
  - master
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
229 230
    - bundle exec rake assets:precompile 2>/dev/null
    - bundle exec rake spinach:other
231 232 233 234
  cache:
    key: "ruby22"
    paths:
    - vendor
235 236 237 238

notify:slack:
  stage: notifications
  script:
James Lopez's avatar
James Lopez committed
239
    - ./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>"
240 241 242 243 244
  when: on_failure
  only:
    - master@gitlab-org/gitlab-ce
    - tags@gitlab-org/gitlab-ce
    - master@gitlab-org/gitlab-ee
245
    - tags@gitlab-org/gitlab-ee