Created
August 13, 2018 10:17
-
-
Save regonn/2ce63aae710c370c72b6ba08dc0099d2 to your computer and use it in GitHub Desktop.
.circleci/config.yml
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
version: 2 | |
jobs: | |
build: | |
docker: | |
- image: circleci/ruby:2.5-node-browsers | |
environment: | |
RAILS_ENV: test | |
# https://circleci.com/docs/2.0/faq/#how-can-i-set-the-timezone-in-docker-images | |
TZ: "/usr/share/zoneinfo/Asia/Tokyo" | |
- image: circleci/postgres:10-alpine | |
working_directory: /tmp/sample-ci | |
steps: | |
- checkout | |
# 日本語フォント | |
- run: | |
name: Install Japanese Font | |
command: | | |
sudo apt-get install fonts-migmix | |
# Yarn | |
- restore_cache: | |
key: v1-dependencies-{{ .Branch }}-{{ checksum "yarn.lock" }} | |
- run: | |
name: Yarn | |
command: | | |
yarn | |
- save_cache: | |
key: v1-dependencies-{{ .Branch }}-{{ checksum "yarn.lock" }} | |
paths: | |
- /tmp/sample-ci/node_modules | |
- /tmp/sample-ci/.cache/yarn/ | |
# Bundle | |
- restore_cache: | |
keys: | |
- v1-dependencies-{{ checksum "Gemfile.lock" }} | |
# fallback to using the latest cache if no exact match is found | |
- v1-dependencies- | |
- run: | |
name: Bundle Install | |
command: | | |
bundle install --jobs=4 --retry=3 --without development --path vendor/bundle | |
- save_cache: | |
paths: | |
- vendor/bundle | |
key: v1-dependencies-{{ checksum "Gemfile.lock" }} | |
# Setup database | |
- run: | |
name: Setup database | |
command: | | |
cp config/database.yml.circleci config/database.yml | |
bundle exec rake db:create | |
bundle exec rake db:schema:load | |
# Run tests! | |
- run: | |
name: Run rspec | |
# .rspecに書いた設定が何故か効かないので--requireをつけている | |
command: | | |
COVERAGE=true bundle exec rspec --require spec_helper --require rails_helper | |
# Collect reports | |
- store_artifacts: | |
path: /tmp/sample-ci/coverage | |
destination: coverage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment