aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks
diff options
context:
space:
mode:
authorAlban Peignier2018-03-09 15:28:35 +0100
committerAlban Peignier2018-03-09 15:28:39 +0100
commit665727fc7392de55bb19b8f9ccac90b068e86ba5 (patch)
treecec88605d422c59566c0e808f968c2329941c4d4 /lib/tasks
parent523d3e418539cfe6af98bdcbae82d1f7d3fdd3c0 (diff)
downloadchouette-core-665727fc7392de55bb19b8f9ccac90b068e86ba5.tar.bz2
Create ci:build, ci:docker and ci:docker:clean. Rename config/database/jenkins.yml in ci.yml. Refs #6047
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/ci.rake26
1 files changed, 23 insertions, 3 deletions
diff --git a/lib/tasks/ci.rake b/lib/tasks/ci.rake
index 89f9aa9c8..5b2c8ae3c 100644
--- a/lib/tasks/ci.rake
+++ b/lib/tasks/ci.rake
@@ -1,9 +1,18 @@
namespace :ci do
+
+ def database_name
+ @database_name ||=
+ begin
+ config = YAML.load(ERB.new(File.read('config/database.yml')).result)
+ config["test"]["database"]
+ end
+ end
+
desc "Prepare CI build"
task :setup do
- cp "config/database/jenkins.yml", "config/database.yml"
+ cp "config/database/ci.yml", "config/database.yml"
+ puts "Use #{database_name} database"
sh "RAILS_ENV=test rake db:drop db:create db:migrate"
- sh "yarn --no-progress install"
end
def git_branch
@@ -59,7 +68,18 @@ namespace :ci do
sh "rm -rf log/test.log"
sh "RAILS_ENV=test bundle exec rake assets:clobber"
end
+
+ task :build => ["ci:setup", "ci:assets", "ci:i18n_js_export", "spec", "ci:jest", "cucumber", "ci:check_security"]
+
+ namespace :docker do
+ task :clean do
+ puts "Drop #{database_name} database"
+ sh "RAILS_ENV=test rake db:drop"
+ end
+ end
+
+ task :docker => ["ci:build"]
end
desc "Run continuous integration tasks (spec, ...)"
-task :ci => ["ci:setup", "ci:assets", "ci:i18n_js_export", "spec", "ci:jest", "cucumber", "ci:check_security", "ci:deploy", "ci:clean"]
+task :ci => ["ci:build", "ci:deploy", "ci:clean"]