Configuration files for CircleCI
Last active
July 13, 2020 14:32
-
-
Save aquaflamingo/440d02b68350981d098be37abd0ecdb8 to your computer and use it in GitHub Desktop.
Ruby on Rails application .circleci/config.yml (with caching)
This file contains hidden or 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
version: 2.1 | |
executors: | |
default: | |
working_directory: ~/app | |
docker: | |
- image: circleci/ruby:2.5.5-node-browsers | |
environment: | |
RAILS_ENV: test | |
RACK_ENV: test | |
- image: circleci/postgres:9.6 | |
environment: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: rails_app_db_name | |
jobs: | |
build: | |
executor: default | |
steps: | |
- checkout | |
- run: | | |
sudo apt-get update | |
sudo apt-get install -y postgresql-client | |
curl -o -L https://yarnpkg.com/install.sh | bash | |
- restore_cache: | |
name: gem | |
keys: | |
- gem-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }} | |
- gem-cache-v1-{{ arch }}-{{ .Branch }} | |
- gem-cache-v1 | |
- restore_cache: | |
name: yarn | |
keys: | |
# when lock file changes, use increasingly general patterns to restore cache | |
- yarn-packages-v1-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }} | |
- yarn-packages-v1-{{ arch }}-{{ .Branch }} | |
- yarn-packages-v1-{{ arch }} | |
- yarn-packages-v1 | |
- restore_cache: | |
name: precompile assets | |
keys: | |
- asset-cache-v1-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }} | |
- asset-cache-v1-{{ arch }}-{{ .Branch }} | |
- asset-cache-v1 | |
- run: | |
name: install gems | |
command: | | |
gem install bundler:2.0.2 | |
bundle install --jobs=5 --path vendor/bundle | |
- run: | |
name: yarn deps | |
command: yarn install --frozen-lockfile | |
- run: | |
name: compile assets | |
command: RAILS_ENV=test bundle exec rails webpacker:compile | |
- save_cache: | |
name: save gem cache | |
key: gem-cache-v1-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }} | |
paths: | |
- vendor/bundle | |
- save_cache: | |
name: save yarn cache | |
key: yarn-packages-v1-{{ .Branch }}-{{ checksum "yarn.lock" }} | |
paths: | |
- ~/.cache/yarn | |
- save_cache: | |
name: save asset cache | |
key: asset-cache-v1-{{ arch }}-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }} | |
paths: | |
- tmp/cache/webpacker | |
- public/packs-test | |
- run: | |
name: db | |
command: bundle exec rails db:drop db:create db:schema:load --trace | |
- run: | |
name: specs | |
command: | | |
bundle exec rspec --profile 10 --format progress | |
workflows: | |
version: 2 | |
integration: | |
jobs: | |
- build |
This file contains hidden or 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
version: 2.1 | |
executors: | |
default: | |
working_directory: ~/app | |
docker: | |
- image: circleci/ruby:2.5.5 | |
environment: | |
RACK_ENV: test | |
APP_ENV: test | |
- image: circleci/postgres:9.6 | |
environment: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: db_name | |
jobs: | |
build: | |
executor: default | |
steps: | |
- checkout | |
- run: | | |
sudo apt-get update | |
sudo apt-get install -y postgresql-client | |
# Restore bundle cache | |
- restore_cache: | |
name: gems | |
key: app-{{ checksum "Gemfile.lock" }} | |
- run: | |
name: install gems | |
command: | | |
gem install bundler:2.0.2 | |
bundle install --jobs=5 --path vendor/bundle | |
- save_cache: | |
name: save gem cache | |
key: app-{{ checksum "Gemfile.lock" }} | |
paths: | |
- vendor/bundle | |
- run: | |
name: db | |
command: bundle exec rake db:drop db:create db:schema:load --trace | |
- run: | |
name: specs | |
command: | | |
bundle exec rspec --profile 10 --format progress | |
workflows: | |
version: 2 | |
integration: | |
jobs: | |
- build |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment