I’m putting here the build scripts that https://ci.gitlab.com uses to build GitLab projects.
GitLab Community Edition
Build settings
Get code: git clone
Timeout: 60
Spinach
export PATH=~/bin:/usr/local/bin:/usr/bin:/bin
ruby -v
which ruby
gem install bundler --no-ri --no-rdoc
cp config/database.yml.mysql config/database.yml
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 --without postgres production
bundle exec rake db:create RAILS_ENV=test
RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach
Rspec
export PATH=~/bin:/usr/local/bin:/usr/bin:/bin
ruby -v
which ruby
gem install bundler --no-ri --no-rdoc
cp config/database.yml.mysql config/database.yml
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 --without postgres production
bundle exec rake db:create RAILS_ENV=test
RAILS_ENV=test SIMPLECOV=true bundle exec rake spec
Jasmine
export PATH=~/bin:/usr/local/bin:/usr/bin:/bin
ruby -v
which ruby
gem install bundler --no-ri --no-rdoc
cp config/database.yml.mysql config/database.yml
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 --without postgres production
bundle exec rake db:create RAILS_ENV=test
RAILS_ENV=test SIMPLECOV=true bundle exec rake jasmine:ci
Rubocop
export PATH=~/bin:/usr/local/bin:/usr/bin:/bin
ruby -v
which ruby
gem install bundler --no-ri --no-rdoc
cp config/database.yml.mysql config/database.yml
cp config/gitlab.yml.example config/gitlab.yml
bundle --without postgres production
bundle exec rubocop
Brakeman
export PATH=~/bin:/usr/local/bin:/usr/bin:/bin
ruby -v
which ruby
gem install bundler --no-ri --no-rdoc
cp config/database.yml.mysql config/database.yml
cp config/gitlab.yml.example config/gitlab.yml
bundle --without postgres production
bundle exec rake brakeman
GitLab CI
Build settings
Get code: git clone
Timeout: 30
Rspec
export PATH=~/bin:/usr/local/bin:/usr/bin:/bin
export RAILS_ENV=test
ruby -v
gem install bundler --no-ri --no-rdoc
cp config/database.yml.mysql config/database.yml
cp config/application.yml.example config/application.yml
sed "s/username\:.*$/username\: runner/" -i config/database.yml
sed "s/password\:.*$/password\: 'password'/" -i config/database.yml
bundle --without postgres --jobs $(($(nproc) + 1))
bundle exec rake db:setup
bundle exec rspec spec
status=$?
echo $status
exit $status
GitLab CI Runner
Build settings
Get code: git fetch
Timeout: 30
Rspec
bundle
bundle exec rspec
GitLab Shell
Build settings
Get code: git clone
Timeout: 30
Rspec
export PATH=/home/gitlab-runner/bin:/usr/local/bin/usr/bin:/bin
gem install bundler
cp config.yml.example config.yml
bundle
bundle exec rspec spec
