Even with the simplicity of yml
configuration that is trending now-a-days, there aren't many sites and documentations that can help us configure rspec pipelines with as ease as configuring jenkins or gitlab.
Below is the sample file that I used for achieving the same.
You can find it over here as well.
image: absk1317/ruby-node-pg:2.6
pipelines:
default:
- parallel:
- step:
name: Test
caches:
- bundler
script:
- cp .env.example .env
- export DATABASE_URL=postgresql://postgres:root@localhost/test_db
- bundle install -j 4 --path vendor
- bundle exec rake db:migrate --trace RAILS_ENV=test
- bundle exec rspec
services:
- postgres
- step:
name: Lint
caches:
- bundler
script:
- sed '$d' Gemfile.lock | sed '$d' | sed '$d' > Gemfile.temp_lock && mv Gemfile.temp_lock Gemfile.lock
- bundle install --path vendor
- bundle exec pronto run -f bitbucket_pr -c origin/master
definitions:
caches:
bundler: ./vendor
services:
postgres:
image: postgres:9.5
environment:
POSTGRES_DB: test_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: root
I'm not going in much details here, as it looks quite straight forward. However will add proper comments later on.