Commit 059d8263 authored by James Lopez's avatar James Lopez

update ci configuration to send slack notifications on failure and added rake task

parent 49402844
......@@ -19,7 +19,12 @@ before_script:
- bundle install --without postgres production --jobs $(nproc) "${FLAGS[@]}"
- RAILS_ENV=test bundle exec rake db:drop db:create db:schema:load db:migrate
stages:
- test
- notifications
spec:feature:
stage: test
script:
- RAILS_ENV=test bundle exec rake assets:precompile 2>/dev/null
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:feature
......@@ -28,6 +33,7 @@ spec:feature:
- mysql
spec:api:
stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:api
tags:
......@@ -35,6 +41,7 @@ spec:api:
- mysql
spec:models:
stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:models
tags:
......@@ -42,6 +49,7 @@ spec:models:
- mysql
spec:lib:
stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:lib
tags:
......@@ -49,6 +57,7 @@ spec:lib:
- mysql
spec:services:
stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:services
tags:
......@@ -56,6 +65,7 @@ spec:services:
- mysql
spec:benchmark:
stage: test
script:
- RAILS_ENV=test bundle exec rake spec:benchmark
tags:
......@@ -64,6 +74,7 @@ spec:benchmark:
allow_failure: true
spec:other:
stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:other
tags:
......@@ -71,6 +82,7 @@ spec:other:
- mysql
spinach:project:half:
stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project:half
tags:
......@@ -78,6 +90,7 @@ spinach:project:half:
- mysql
spinach:project:rest:
stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project:rest
tags:
......@@ -85,6 +98,7 @@ spinach:project:rest:
- mysql
spinach:other:
stage: test
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:other
tags:
......@@ -92,6 +106,7 @@ spinach:other:
- mysql
teaspoon:
stage: test
script:
- RAILS_ENV=test bundle exec teaspoon
tags:
......@@ -99,6 +114,7 @@ teaspoon:
- mysql
rubocop:
stage: test
script:
- bundle exec rubocop
tags:
......@@ -106,6 +122,7 @@ rubocop:
- mysql
brakeman:
stage: test
script:
- bundle exec rake brakeman
tags:
......@@ -113,6 +130,7 @@ brakeman:
- mysql
flog:
stage: test
script:
- bundle exec rake flog
tags:
......@@ -120,6 +138,7 @@ flog:
- mysql
flay:
stage: test
script:
- bundle exec rake flay
tags:
......@@ -127,6 +146,7 @@ flay:
- mysql
bundler:audit:
stage: test
script:
- "bundle exec bundle-audit update"
- "bundle exec bundle-audit check"
......@@ -135,9 +155,10 @@ bundler:audit:
- mysql
allow_failure: true
# Ruby 2.1 jobs
## Ruby 2.1 jobs
spec:ruby21:
stage: test
image: ruby:2.1
script:
- RAILS_ENV=test bundle exec rake assets:precompile 2>/dev/null
......@@ -149,6 +170,7 @@ spec:ruby21:
- master
spinach:ruby21:
stage: test
image: ruby:2.1
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach
......@@ -157,3 +179,12 @@ spinach:ruby21:
- mysql
only:
- master
notify:slack:
stage: notifications
script:
- bundle exec rake ci:slack
when: on_failure
# only:
# - master
# - tags
\ No newline at end of file
namespace :ci do
namespace :slack do
desc "GitLab CI | Send slack notification on build failure"
task error: :environment do
error_text = 'Build failed for master/tags'
Kernel.system "curl -X POST --data-urlencode 'payload={\"channel\": \"#ci-test\", \"username\": \"gitlab-ci\", \"text\": \"#{error_text}\", \"icon_emoji\": \":gitlab:\"}' $CI_SLACK_WEBHOOK_URL"
end
end
end
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