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

.gitlab-ci.yml 4.54 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-gitlab
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
- build
Kamil Trzcinski's avatar
Kamil Trzcinski committed
30 31
- test
- notifications
32

Kamil Trzcinski's avatar
Kamil Trzcinski committed
33 34
prepare:
  stage: build
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
    - echo "{}" > knapsack_rspec_report.json
Kamil Trzcinski's avatar
Kamil Trzcinski committed
40
    - echo "{}" > knapsack_spinach_report.json
Kamil Trzcinski's avatar
Kamil Trzcinski committed
41 42
  artifacts:
    paths:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
43
    - public/assets/
Kamil Trzcinski's avatar
Kamil Trzcinski committed
44
    - knapsack_rspec_report.json
Kamil Trzcinski's avatar
Kamil Trzcinski committed
45
    - knapsack_spinach_report.json
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
    - knapsack-gitlab ${JOB_NAME[0]}
54

Kamil Trzcinski's avatar
Kamil Trzcinski committed
55
.exec: &exec
56 57
  stage: test
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
58 59
    - bundle exec $CI_BUILD_NAME

Kamil Trzcinski's avatar
Kamil Trzcinski committed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
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
80

Kamil Trzcinski's avatar
Kamil Trzcinski committed
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
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
101 102 103 104 105 106 107 108

teaspoon: *exec
rubocop: *exec
rake scss_lint: *exec
rake brakeman: *exec
rake flog: *exec
rake flay: *exec
rake db:migrate:reset: *exec
109 110 111

bundler:audit:
  stage: test
112 113
  only:
    - master
114
  script:
115
    - "bundle exec bundle-audit check --update --ignore OSVDB-115941"
116 117 118 119 120 121 122

# Ruby 2.2 jobs

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

spec:api:ruby22:
  stage: test
  image: ruby:2.2
  only:
  - master
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
138
    - bundle exec rake spec:api
139 140 141 142 143 144 145 146 147 148 149
  cache:
    key: "ruby22"
    paths:
    - vendor

spec:models:ruby22:
  stage: test
  image: ruby:2.2
  only:
  - master
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
150
    - bundle exec rake spec:models
151 152 153 154 155 156 157 158 159 160 161
  cache:
    key: "ruby22"
    paths:
    - vendor

spec:lib:ruby22:
  stage: test
  image: ruby:2.2
  only:
  - master
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
162
    - bundle exec rake spec:lib
163 164 165 166 167 168 169 170 171 172 173
  cache:
    key: "ruby22"
    paths:
    - vendor

spec:services:ruby22:
  stage: test
  image: ruby:2.2
  only:
  - master
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
174
    - bundle exec rake spec:services
175 176 177 178 179 180 181 182 183 184 185
  cache:
    key: "ruby22"
    paths:
    - vendor

spec:other:ruby22:
  stage: test
  image: ruby:2.2
  only:
  - master
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
186
    - bundle exec rake spec:other
187 188 189 190 191 192 193 194 195 196 197
  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
198 199
    - bundle exec rake assets:precompile 2>/dev/null
    - bundle exec rake spinach:project:half
200 201 202 203 204 205 206 207 208 209 210
  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
211 212
    - bundle exec rake assets:precompile 2>/dev/null
    - bundle exec rake spinach:project:rest
213 214 215 216 217 218 219 220 221 222 223
  cache:
    key: "ruby22"
    paths:
    - vendor

spinach:other:ruby22:
  stage: test
  image: ruby:2.2
  only:
  - master
  script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
224 225
    - bundle exec rake assets:precompile 2>/dev/null
    - bundle exec rake spinach:other
226 227 228 229
  cache:
    key: "ruby22"
    paths:
    - vendor
230 231 232 233

notify:slack:
  stage: notifications
  script:
James Lopez's avatar
James Lopez committed
234
    - ./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>"
235 236 237 238 239
  when: on_failure
  only:
    - master@gitlab-org/gitlab-ce
    - tags@gitlab-org/gitlab-ce
    - master@gitlab-org/gitlab-ee
240
    - tags@gitlab-org/gitlab-ee