Was missing the checksum which would cause Ruby to be downloaded and rebuilt each time. The Docker image has been updated to use an unspecified version to reduce version maintenance. The `CI_RUBY_VERSION` environment variable was introduced to be dynamically set based on value in the `.ruby-version` for improved maintainability.
62 lines
1.6 KiB
YAML
62 lines
1.6 KiB
YAML
version: 2
|
|
jobs:
|
|
build:
|
|
working_directory: ~/project
|
|
docker:
|
|
- image: circleci/ruby
|
|
environment:
|
|
BUNDLE_JOBS: 3
|
|
BUNDLE_RETRY: 3
|
|
BUNDLE_PATH: vendor/bundle
|
|
EDITOR: vim
|
|
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 Cache Restore
|
|
key: bundle-{{ checksum "Gemfile" }}
|
|
|
|
- run:
|
|
name: Bundler Install
|
|
command: |
|
|
gem update --system
|
|
bundle check || bundle install
|
|
|
|
- type: cache-save
|
|
name: Bundler Cache Store
|
|
key: bundle-{{ checksum "Gemfile" }}
|
|
paths:
|
|
- vendor/bundle
|
|
|
|
- run:
|
|
name: Rake Run
|
|
command: bundle exec rake
|