.gitlab-ci.yml 3.32 KB
Newer Older
1
image: "ruby:2.2"
2 3 4 5 6 7 8 9 10

services:
  - mysql:latest
  - postgres:latest
  - redis:latest

variables:
  MYSQL_ALLOW_EMPTY_PASSWORD: "1"

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
11
before_script:
Kamil Trzcinski's avatar
Kamil Trzcinski committed
12
  - source ./scripts/prepare_build.sh
Valery Sizov's avatar
Valery Sizov committed
13 14
  - ruby -v
  - which ruby
15
  - gem install bundler --no-ri --no-rdoc
Valery Sizov's avatar
Valery Sizov committed
16 17 18
  - cp config/gitlab.yml.example config/gitlab.yml
  - touch log/application.log
  - touch log/test.log
19
  - bundle install --without postgres production --jobs $(nproc)  "${FLAGS[@]}"
20
  - RAILS_ENV=test bundle exec rake db:drop db:create db:schema:load db:migrate
21

22 23 24 25
stages:
- test
- notifications

26
spec:feature:
27
  stage: test
28
  script:
29
    - RAILS_ENV=test bundle exec rake assets:precompile 2>/dev/null
30 31 32 33 34 35
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:feature
  tags:
    - ruby
    - mysql

spec:api:
36
  stage: test
37 38 39 40 41 42
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:api
  tags:
    - ruby
    - mysql

Douwe Maan's avatar
Douwe Maan committed
43
spec:models:
44
  stage: test
Douwe Maan's avatar
Douwe Maan committed
45 46 47 48 49 50
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:models
  tags:
    - ruby
    - mysql

Douwe Maan's avatar
Douwe Maan committed
51
spec:lib:
52
  stage: test
Douwe Maan's avatar
Douwe Maan committed
53 54 55 56 57 58 59
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:lib
  tags:
    - ruby
    - mysql

spec:services:
60
  stage: test
Douwe Maan's avatar
Douwe Maan committed
61 62 63 64 65 66
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:services
  tags:
    - ruby
    - mysql

67
spec:benchmark:
68
  stage: test
69 70 71 72 73
  script:
    - RAILS_ENV=test bundle exec rake spec:benchmark
  tags:
    - ruby
    - mysql
74
  allow_failure: true
75

76
spec:other:
77
  stage: test
78 79 80 81 82 83
  script:
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:other
  tags:
    - ruby
    - mysql

Douwe Maan's avatar
Douwe Maan committed
84
spinach:project:half:
85
  stage: test
Valery Sizov's avatar
Valery Sizov committed
86
  script:
Douwe Maan's avatar
Douwe Maan committed
87 88 89 90 91 92
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project:half
  tags:
    - ruby
    - mysql

spinach:project:rest:
93
  stage: test
Valery Sizov's avatar
Valery Sizov committed
94
  script:
Douwe Maan's avatar
Douwe Maan committed
95
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project:rest
Valery Sizov's avatar
Valery Sizov committed
96 97 98 99
  tags:
    - ruby
    - mysql

100
spinach:other:
101
  stage: test
Valery Sizov's avatar
Valery Sizov committed
102
  script:
103
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:other
Valery Sizov's avatar
Valery Sizov committed
104 105 106 107
  tags:
    - ruby
    - mysql

108
teaspoon:
109
  stage: test
Valery Sizov's avatar
Valery Sizov committed
110
  script:
111
    - RAILS_ENV=test bundle exec teaspoon
Valery Sizov's avatar
Valery Sizov committed
112 113 114 115
  tags:
    - ruby
    - mysql

116
rubocop:
117
  stage: test
Valery Sizov's avatar
Valery Sizov committed
118 119 120 121 122 123
  script:
    - bundle exec rubocop
  tags:
    - ruby
    - mysql

124
brakeman:
125
  stage: test
Valery Sizov's avatar
Valery Sizov committed
126 127 128 129
  script:
    - bundle exec rake brakeman
  tags:
    - ruby
130
    - mysql
131 132

flog:
133
  stage: test
134 135 136 137 138
  script:
    - bundle exec rake flog
  tags:
    - ruby
    - mysql
139 140

flay:
141
  stage: test
142 143 144 145 146
  script:
    - bundle exec rake flay
  tags:
    - ruby
    - mysql
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
147

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
148
bundler:audit:
149
  stage: test
150
  script:
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
151 152
    - "bundle exec bundle-audit update"
    - "bundle exec bundle-audit check"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
153 154 155
  tags:
    - ruby
    - mysql
156
  allow_failure: true
157

158
## Ruby 2.1 jobs
159

James Lopez's avatar
James Lopez committed
160
spec:ruby21:
161
  stage: test
162 163 164
  image: ruby:2.1
  script:
    - RAILS_ENV=test bundle exec rake assets:precompile 2>/dev/null
James Lopez's avatar
James Lopez committed
165
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spec
166 167 168 169 170 171
  tags:
    - ruby
    - mysql
  only:
  - master

James Lopez's avatar
James Lopez committed
172
spinach:ruby21:
173
  stage: test
174 175
  image: ruby:2.1
  script:
James Lopez's avatar
James Lopez committed
176
    - RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach
177 178 179 180 181
  tags:
    - ruby
    - mysql
  only:
  - master
182 183 184 185

notify:slack:
  stage: notifications
  script:
186
    - source ./scripts/notify_slack.sh "#ci-test" "Build failed for master/tags!"
187
  when: on_failure
188 189 190 191 192 193
  # TODO: uncomment these lines.
  #only:
  #  - master@gitlab-org/gitlab-ce
  #  - tags@gitlab-org/gitlab-ce
  #  - master@gitlab-org/gitlab-ee
  #  - tags@gitlab-org/gitlab-ee