From b6688f830b5e83ed670f061e619f96487ac8a6a2 Mon Sep 17 00:00:00 2001 From: Marin Jankovski Date: Wed, 17 Jun 2015 12:23:43 +0200 Subject: [PATCH] Add a build preparation script, modify gitlab.ci.yml to use the script. --- .gitlab-ci.yml | 14 ++++---------- bin/prepare_build.sh | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 10 deletions(-) create mode 100755 bin/prepare_build.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8fba268be7d..a58fbc57b39 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,19 +1,13 @@ # This file is generated by GitLab CI before_script: - - export PATH=$HOME/bin:/usr/local/bin:/usr/bin:/bin + - ./bin/build_prepare.sh - ruby -v - which ruby - - gem install bundler - - which bundle - - echo $PATH - - cp config/database.yml.mysql config/database.yml + - gem install bundler --no-ri --no-rdoc - cp config/gitlab.yml.example config/gitlab.yml - - 'sed "s/username\:.*$/username\: runner/" -i config/database.yml' - - 'sed "s/password\:.*$/password\: ''password''/" -i config/database.yml' - - sed "s/gitlabhq_test/gitlabhq_test_$((RANDOM/5000))/" -i config/database.yml - touch log/application.log - touch log/test.log - - bundle install --without postgres production --jobs $(nproc) + - bundle install --without postgres production --jobs $(nproc) "${FLAGS[@]}" - bundle exec rake db:create RAILS_ENV=test Rspec: script: @@ -48,4 +42,4 @@ Brakeman: - bundle exec rake brakeman tags: - ruby - - mysql \ No newline at end of file + - mysql diff --git a/bin/prepare_build.sh b/bin/prepare_build.sh new file mode 100755 index 00000000000..5525ab77435 --- /dev/null +++ b/bin/prepare_build.sh @@ -0,0 +1,24 @@ +#!/bin/bash +if [ -f /.dockerinit ]; then + wget -q http://ftp.de.debian.org/debian/pool/main/p/phantomjs/phantomjs_1.9.0-1+b1_amd64.deb + dpkg -i phantomjs_1.9.0-1+b1_amd64.deb + + apt-get update -qq + apt-get install -y -qq libicu-dev libkrb5-dev cmake nodejs + + cp config/database.yml.mysql config/database.yml + sed -i 's/username:.*/username: root/g' config/database.yml + sed -i 's/password:.*/password:/g' config/database.yml + sed -i 's/# socket:.*/host: mysql/g' config/database.yml + + cp config/resque.yml.example config/resque.yml + sed -i 's/localhost/redis/g' config/resque.yml + FLAGS=(--deployment --path /cache) + export FLAGS +else + export PATH=$HOME/bin:/usr/local/bin:/usr/bin:/bin + cp config/database.yml.mysql config/database.yml + sed "s/username\:.*$/username\: runner/" -i config/database.yml + sed "s/password\:.*$/password\: 'password'/" -i config/database.yml + sed "s/gitlabhq_test/gitlabhq_test_$((RANDOM/5000))/" -i config/database.yml +fi