Browse Source

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.
ThibG 2 months ago
parent
commit
5059989cc7
1 changed files with 8 additions and 8 deletions
  1. 8
    8
      .circleci/config.yml

+ 8
- 8
.circleci/config.yml View File

@@ -64,12 +64,17 @@ aliases:
64 64
 
65 65
         - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
66 66
         - *restore_ruby_dependencies
67
-        - run: bundle install --clean --jobs 16 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without development production
67
+        - run: bundle install --clean --jobs 16 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without development production && bundle clean
68 68
         - save_cache:
69 69
             key: v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
70 70
             paths:
71 71
               - ./.bundle/
72 72
               - ./vendor/bundle/
73
+        - persist_to_workspace:
74
+            root: ~/projects/
75
+            paths:
76
+                - ./mastodon/.bundle/
77
+                - ./mastodon/vendor/bundle/
73 78
 
74 79
   - &test_steps
75 80
       steps:
@@ -78,9 +83,6 @@ aliases:
78 83
         - *install_system_dependencies
79 84
         - run: sudo apt-get install -y ffmpeg
80 85
 
81
-        - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
82
-        - *restore_ruby_dependencies
83
-
84 86
         - run:
85 87
             name: Prepare Tests
86 88
             command: ./bin/rails parallel:create parallel:load_schema parallel:prepare
@@ -116,8 +118,6 @@ jobs:
116 118
     steps:
117 119
       - *attach_workspace
118 120
       - *install_system_dependencies
119
-      - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
120
-      - *restore_ruby_dependencies
121 121
       - run: ./bin/rails assets:precompile
122 122
       - persist_to_workspace:
123 123
           root: ~/projects/
@@ -170,8 +170,6 @@ jobs:
170 170
     <<: *defaults
171 171
     steps:
172 172
       - *attach_workspace
173
-      - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
174
-      - *restore_ruby_dependencies
175 173
       - run: bundle exec i18n-tasks check-normalized
176 174
       - run: bundle exec i18n-tasks unused
177 175
 
@@ -186,9 +184,11 @@ workflows:
186 184
       - install-ruby2.4:
187 185
           requires:
188 186
             - install
187
+            - install-ruby2.5
189 188
       - install-ruby2.3:
190 189
           requires:
191 190
             - install
191
+            - install-ruby2.5
192 192
       - build:
193 193
           requires:
194 194
             - install-ruby2.5