Use CircleCI workflows for ruby dependencies (#8228)

* Add “bundle clean” suggestion from CircleCI doc

Cf. https://circleci.com/docs/2.0/caching/#bundler-ruby

* Use workspaces instead of caches for ruby gems

Cache are not guaranteed to be available, while the test jobs *require* their
depencies to run. Workspaces are thus more suitable.

One downside is that the order of workspace layer additions need to be
deterministic, which is why install-ruby{2.3,2.4} now depend on
install-ruby2.5.
This commit is contained in:
ThibG 2018-08-18 04:05:42 +02:00 committed by Eugen Rochko
parent edb1de7800
commit 5059989cc7

View File

@ -64,12 +64,17 @@ aliases:
- run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
- *restore_ruby_dependencies - *restore_ruby_dependencies
- run: bundle install --clean --jobs 16 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without development production - run: bundle install --clean --jobs 16 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without development production && bundle clean
- save_cache: - save_cache:
key: v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }} key: v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
paths: paths:
- ./.bundle/ - ./.bundle/
- ./vendor/bundle/ - ./vendor/bundle/
- persist_to_workspace:
root: ~/projects/
paths:
- ./mastodon/.bundle/
- ./mastodon/vendor/bundle/
- &test_steps - &test_steps
steps: steps:
@ -78,9 +83,6 @@ aliases:
- *install_system_dependencies - *install_system_dependencies
- run: sudo apt-get install -y ffmpeg - run: sudo apt-get install -y ffmpeg
- run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
- *restore_ruby_dependencies
- run: - run:
name: Prepare Tests name: Prepare Tests
command: ./bin/rails parallel:create parallel:load_schema parallel:prepare command: ./bin/rails parallel:create parallel:load_schema parallel:prepare
@ -116,8 +118,6 @@ jobs:
steps: steps:
- *attach_workspace - *attach_workspace
- *install_system_dependencies - *install_system_dependencies
- run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
- *restore_ruby_dependencies
- run: ./bin/rails assets:precompile - run: ./bin/rails assets:precompile
- persist_to_workspace: - persist_to_workspace:
root: ~/projects/ root: ~/projects/
@ -170,8 +170,6 @@ jobs:
<<: *defaults <<: *defaults
steps: steps:
- *attach_workspace - *attach_workspace
- run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
- *restore_ruby_dependencies
- run: bundle exec i18n-tasks check-normalized - run: bundle exec i18n-tasks check-normalized
- run: bundle exec i18n-tasks unused - run: bundle exec i18n-tasks unused
@ -186,9 +184,11 @@ workflows:
- install-ruby2.4: - install-ruby2.4:
requires: requires:
- install - install
- install-ruby2.5
- install-ruby2.3: - install-ruby2.3:
requires: requires:
- install - install
- install-ruby2.5
- build: - build:
requires: requires:
- install-ruby2.5 - install-ruby2.5