Created
May 25, 2019 05:15
-
-
Save hecbuma/9563d719a9de0a50a71fbd2125cc6651 to your computer and use it in GitHub Desktop.
CircleCI Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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.5.3-node-browsers | |
environment: | |
PGHOST: 127.0.0.1 | |
PGUSER: postgres | |
RAILS_ENV: test | |
RAKE_ENV: test | |
# Specify service dependencies here if necessary | |
# CircleCI maintains a library of pre-built images | |
# documented at https://circleci.com/docs/2.0/circleci-images/ | |
- image: circleci/postgres:9.4 | |
environment: | |
POSTGRES_USER: postgres | |
POSTGRES_DB: mcm_test | |
POSTGRES_PASSWORD: "" | |
steps: | |
- checkout | |
# Download and cache dependencies | |
- restore_cache: | |
keys: | |
- v1-dependencies-{{ checksum "Gemfile.lock" }} | |
# fallback to using the latest cache if no exact match is found | |
- v1-dependencies- | |
- run: | |
name: Configure Bundler | |
command: | | |
echo 'export BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")' >> $BASH_ENV | |
source $BASH_ENV | |
gem install bundler | |
- run: | |
name: install dependencies | |
command: | | |
bundle install --jobs=4 --retry=3 --no-deployment --path vendor/bundle | |
- save_cache: | |
paths: | |
- ./vendor/bundle | |
key: v1-dependencies-{{ checksum "Gemfile.lock" }} | |
- run: bin/rails app:update:bin | |
# Database setup | |
- run: | |
name: Wait for DB | |
command: dockerize -wait tcp://localhost:5432 -timeout 1m | |
- run: bundle exec rake db:create | |
- run: bundle exec rake db:schema:load | |
# run tests! | |
- run: | |
name: run tests | |
command: bundle exec rails test | |
# run tests! | |
- run: | |
name: run system test | |
command: bundle exec rails test:system | |
# collect reports | |
- store_test_results: | |
path: /tmp/test-results | |
- store_artifacts: | |
path: /tmp/test-results | |
destination: test-results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment