version: 2 jobs: build: working_directory: ~/project docker: - image: circleci/ruby environment: BUNDLE_JOBS: 3 BUNDLE_RETRY: 3 BUNDLE_PATH: vendor/bundle EDITOR: vim RAILS_ENV: test steps: - checkout - run: name: Environment Setup command: | printf "%s\n" 'export CI_RUBY_VERSION=$(cat ".ruby-version" | tr -d "\n")' >> $BASH_ENV - type: cache-restore name: Ruby Restore key: ruby-{{checksum ".ruby-version"}} - run: name: Ruby Install command: | curl https://cache.ruby-lang.org/pub/ruby/${CI_RUBY_VERSION::-2}/ruby-$CI_RUBY_VERSION.tar.bz2 > ../ruby-$CI_RUBY_VERSION.tar.gz cd .. tar --extract --bzip2 --verbose --file ruby-$CI_RUBY_VERSION.tar.gz cd ruby-$CI_RUBY_VERSION ./configure make make update-gems make extract-gems sudo make install - type: cache-save name: Ruby Store key: ruby-{{checksum ".ruby-version"}} paths: - ../ruby-$CI_RUBY_VERSION - type: cache-restore name: Bundler Restore key: bundler-{{checksum "<%= config.dig(:gem, :name) %>.gemspec"}} - run: name: Bundler Install command: | gem update --system bundle install --path vendor/bundle - type: cache-save name: Bundler Store key: bundler-{{checksum "<%= config.dig(:gem, :name) %>.gemspec"}} paths: - vendor/bundle <%- if config.dig(:generate, :code_climate) -%> - run: name: Code Climate Install command: | curl --location https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter chmod +x ./cc-test-reporter <%- end -%> - run: name: Build command: | <%- if config.dig(:generate, :code_climate) -%> ./cc-test-reporter before-build <%- end -%> bundle exec rake <%- if config.dig(:generate, :code_climate) -%> ./cc-test-reporter after-build --coverage-input-type simplecov --exit-code $? <%- end -%>