.circleci/config.yml
# Ruby CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-ruby/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/ruby:2.7.2-node-browsers
environment:
RACK_ENV: test
DATABASE_URL: postgresql://ubuntu:test@127.0.0.1:5432/circle_ruby_test
BUNDLE_PATH: ~/vendor/bundle
BUNDLER_VERSION: 2.1.4
- image: postgres:9
environment:
POSTGRES_USER: ubuntu
POSTGRES_PASSWORD: test
POSTGRES_DB: circle_ruby_test
working_directory: ~/repo
attach_workspace:
at: '~'
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v0-dependencies-{{ checksum "Gemfile.lock" }}
- run: gem install bundler:2.1.4
- run: bundle install --jobs=4 --retry=3
- save_cache:
paths:
- ~/vendor/bundle
key: v0-dependencies-{{ checksum "Gemfile.lock" }}
- persist_to_workspace:
root: '~'
paths:
- vendor/bundle
# Database setup
- run: bundle exec rake setup
- run: bundle exec rake db:create
- run: bundle exec rake db:migrate
# run tests!
- run:
name: run tests
command: |
bundle exec rspec --format progress \
--format documentation \
--order rand