Basic GitLab CI configuration for Rails Project


GitLab CI is one of the good CI tool for individual developer becasue it is possible to use for free.
In this article, I would like to show basic GitLab CI configuration for basic Ruby on Rails project.

😀 .gitlab-ci.yml

.gitlab-ci.yml which is GitLab CI configuration is as follows:

image: ruby:latest

variables:
BUNDLE_CACHE: "vendor/bundle/"
RAILS_ENV: "test"
DB_HOST: postgres
DB_USERNAME: postgres
DB_PASSWORD: ""

cache:
untracked: true
key: "$CI_BUILD_NAME"
paths:
- vendor/bundle/

services:
- postgres:latest

before_script:
- bundle install --path vendor/bundle
- bundle exec rake db:create
- bundle exec rake db:migrate

stages:
- test

rspec:
stage: test
script:
- bundle exec rspec

rubocop:
stage: test
script:
- bundle exec rubocop

bundle-audit:
stage: test
script:
- bundle exec bundle-audit update
- bundle exec bundle-audit check

🖥 Recommended VPS Service

VULTR provides high performance cloud compute environment for you. Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour). In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!