11version : 2
22
3+ # Monorepo CircleCI config for React on Rails Pro package
4+ # Updated to work from root directory with pro package in react_on_rails_pro/
5+
36aliases :
47 # Print critical data and executables versions.
58 - &print-system-info
@@ -13,38 +16,45 @@ aliases:
1316 echo "Yarn version: "; yarn --version
1417 echo "Bundler version: "; bundle --version
1518 - &lint-js
16- name : Linting of JS
19+ name : Linting of JS (Pro package only)
20+ working_directory : react_on_rails_pro
1721 command : yarn run nps eslint
1822
1923 - &lint-ruby
20- name : Linting of Ruby
24+ name : Linting of Ruby (Pro package only)
25+ working_directory : react_on_rails_pro
2126 command : bundle exec rubocop
2227
2328 - &format
24- name : Check formatting
29+ name : Check formatting (Pro package only)
30+ working_directory : react_on_rails_pro
2531 command : yarn run nps format.listDifferent
2632
2733 - &typescript-check
28- name : Check TypeScript
34+ name : Check TypeScript (Pro package only)
35+ working_directory : react_on_rails_pro
2936 command : yarn run nps check-typescript
3037
3138 # Install/update Node modules for renderer package unless existing set of modules is satisfying Yarn.
3239 - &install-package-node-modules
33- name : Install Node modules with Yarn for renderer package
40+ name : Install Node modules with Yarn for pro renderer package
41+ working_directory : react_on_rails_pro
3442 command : |
3543 sudo yarn global add yalc
3644 yarn install --frozen-lockfile --no-progress --no-emoji
3745
3846 # Install/update Node modules for dummy app unless existing set of modules is satisfying Yarn.
3947 - &install-dummy-app-node-modules
40- name : Install Node modules with Yarn for dummy app
48+ name : Install Node modules with Yarn for pro dummy app
49+ working_directory : react_on_rails_pro
4150 command : |
4251 cd spec/dummy
4352 yarn install --frozen-lockfile --no-progress --no-emoji
4453
4554 # Install ruby gems unless existing set of gems is satisfying bundler.
4655 - &install-dummy-app-ruby-gems
47- name : Install Ruby Gems for dummy app
56+ name : Install Ruby Gems for pro dummy app
57+ working_directory : react_on_rails_pro
4858 command : |
4959 gem install bundler -v "2.5.4"
5060 echo "Bundler version: "; bundle --version
@@ -53,14 +63,16 @@ aliases:
5363 cd spec/dummy && bundle lock --add-platform 'x86_64-linux' && bundle _2.5.4_ check || bundle _2.5.4_ install --jobs=4 --retry=3
5464
5565 - &generate-dummy-app-packs
56- name : Generate file-system based entrypoints
66+ name : Generate file-system based entrypoints (Pro)
67+ working_directory : react_on_rails_pro
5768 command : |
5869 cd spec/dummy
5970 bundle exec rake react_on_rails:generate_packs
6071
6172 # Install ruby gems unless existing set of gems is satisfying bundler.
6273 - &install-package-ruby-gems
63- name : Install Ruby Gems for package
74+ name : Install Ruby Gems for pro package
75+ working_directory : react_on_rails_pro
6476 command : |
6577 gem install bundler -v "2.5.4"
6678 echo "Bundler version: "; bundle --version
@@ -70,32 +82,32 @@ aliases:
7082
7183 # Restore node_modules dir from cache using yarn.lock checksum as a key.
7284 - &restore-package-node-modules-cache
73- name : Restore cached node_modules directory
85+ name : Restore cached node_modules directory (Pro)
7486 keys :
75- - v4-package-node-modules-cache-{{ checksum "yarn.lock" }}
87+ - v4-pro- package-node-modules-cache-{{ checksum "react_on_rails_pro/ yarn.lock" }}
7688
7789 # Restore spec/dummy/node_modules dir from cache using yarn.lock checksum as a key.
7890 - &restore-dummy-app-node-modules-cache
79- name : Restore cached spec/dummy/node_modules directory
91+ name : Restore cached spec/dummy/node_modules directory (Pro)
8092 keys :
81- - v4-dummy-app-node-modules-cache-{{ checksum "spec/dummy/yarn.lock" }}
93+ - v4-pro- dummy-app-node-modules-cache-{{ checksum "react_on_rails_pro/ spec/dummy/yarn.lock" }}
8294
8395 # Restore vendor/bundle dir from cache using Gemfile.lock checksum as a key.
8496 - &restore-dummy-app-gem-cache
85- name : Restore cached Ruby Gems for dummy app
97+ name : Restore cached Ruby Gems for pro dummy app
8698 keys :
87- - v4-dummy-app-gem-cache-{{ checksum "spec/dummy/Gemfile.lock" }}
99+ - v4-pro- dummy-app-gem-cache-{{ checksum "react_on_rails_pro/ spec/dummy/Gemfile.lock" }}
88100
89101 # Restore vendor/bundle dir from cache using react_on_rails_pro.gemspec checksum as a key.
90102 - &restore-package-gem-cache
91- name : Restore cached Ruby Gems for package
103+ name : Restore cached Ruby Gems for pro package
92104 keys :
93- - v4-package-app-gem-cache-{{ checksum "react_on_rails_pro.gemspec" }}
105+ - v4-pro- package-app-gem-cache-{{ checksum "react_on_rails_pro/ react_on_rails_pro.gemspec" }}
94106
95107 # Restore webpack bundles for dummy app from cache
96108 - &restore-dummy-app-webpack-bundle-cache
97- name : Restore cached webpack bundles for dummy app
98- key : v4-dummy-app-webpack-bundle-{{ .Revision }}
109+ name : Restore cached webpack bundles for pro dummy app
110+ key : v4-pro- dummy-app-webpack-bundle-{{ .Revision }}
99111
100112 # NOTE: Sometimes CI generated docker images are not updated in time to keep up with the minimum required
101113 # by chromedriver versions of Chrome. Just bump here Chrome version if chromedriver raises errors
@@ -129,7 +141,8 @@ jobs:
129141 - run : *install-dummy-app-ruby-gems
130142 - run : *install-dummy-app-node-modules
131143 - run :
132- name : Install Node modules with Yarn for ExecJS dummy app
144+ name : Install Node modules with Yarn for ExecJS dummy app (Pro)
145+ working_directory : react_on_rails_pro
133146 command : |
134147 cd spec/execjs-compatible-dummy
135148 yarn install --frozen-lockfile --no-progress --no-emoji
@@ -149,10 +162,10 @@ jobs:
149162 - restore_cache : *restore-package-node-modules-cache
150163 - run : *install-package-node-modules
151164 - save_cache :
152- name : Save root node_modules to cache
153- key : v4-package-node-modules-cache-{{ checksum "yarn.lock" }}
165+ name : Save pro root node_modules to cache
166+ key : v4-pro- package-node-modules-cache-{{ checksum "react_on_rails_pro/ yarn.lock" }}
154167 paths :
155- - node_modules
168+ - react_on_rails_pro/ node_modules
156169
157170 # Install Node modules for dummy app with Yarn and save them to cache.
158171 install-dummy-app-node-packages :
@@ -165,10 +178,10 @@ jobs:
165178 - run : *install-package-node-modules
166179 - run : *install-dummy-app-node-modules
167180 - save_cache :
168- name : Save spec/dummy/node_modules to cache
169- key : v4-dummy-app-node-modules-cache-{{ checksum "spec/dummy/yarn.lock" }}
181+ name : Save pro spec/dummy/node_modules to cache
182+ key : v4-pro- dummy-app-node-modules-cache-{{ checksum "react_on_rails_pro/ spec/dummy/yarn.lock" }}
170183 paths :
171- - spec/dummy/node_modules
184+ - react_on_rails_pro/ spec/dummy/node_modules
172185
173186 # Install Ruby gems for package with Bundler and save them to cache.
174187 install-package-ruby-gems :
@@ -180,10 +193,10 @@ jobs:
180193 - restore_cache : *restore-package-gem-cache
181194 - run : *install-package-ruby-gems
182195 - save_cache :
183- name : Save dummy app ruby gems to cache
184- key : v4-package-app-gem-cache-{{ checksum "react_on_rails_pro.gemspec" }}
196+ name : Save pro package ruby gems to cache
197+ key : v4-pro- package-app-gem-cache-{{ checksum "react_on_rails_pro/ react_on_rails_pro.gemspec" }}
185198 paths :
186- - vendor/bundle
199+ - react_on_rails_pro/ vendor/bundle
187200
188201 # Install Ruby gems for dummy app with Bundler and save them to cache.
189202 install-dummy-app-ruby-gems :
@@ -195,10 +208,10 @@ jobs:
195208 - restore_cache : *restore-dummy-app-gem-cache
196209 - run : *install-dummy-app-ruby-gems
197210 - save_cache :
198- name : Save dummy app ruby gems to cache
199- key : v4-dummy-app-gem-cache-{{ checksum "spec/dummy/Gemfile.lock" }}
211+ name : Save pro dummy app ruby gems to cache
212+ key : v4-pro- dummy-app-gem-cache-{{ checksum "react_on_rails_pro/ spec/dummy/Gemfile.lock" }}
200213 paths :
201- - spec/dummy/vendor/bundle
214+ - react_on_rails_pro/ spec/dummy/vendor/bundle
202215
203216 # Build client and server bundles for dummy app with Webpack and save them to cache.
204217 # NOTE: keeping around this cache in case we have multiple rspec suites in the future to tests
@@ -217,14 +230,15 @@ jobs:
217230 - run : *install-dummy-app-ruby-gems
218231 - run : *generate-dummy-app-packs
219232 - run :
220- name : Build test bundles for dummy app
233+ name : Build test bundles for pro dummy app
234+ working_directory : react_on_rails_pro
221235 command : cd spec/dummy && yarn run build:test
222236 - save_cache :
223237 name : Save test webpack bundles to cache (for build number checksum used by rspec job)
224- key : v4-dummy-app-webpack-bundle-{{ .Revision }}
238+ key : v4-pro- dummy-app-webpack-bundle-{{ .Revision }}
225239 paths :
226- - spec/dummy/public/webpack/test
227- - spec/dummy/ssr-generated
240+ - react_on_rails_pro/ spec/dummy/public/webpack/test
241+ - react_on_rails_pro/ spec/dummy/ssr-generated
228242
229243 # Run JS unit tests for Renderer package.
230244 package-js-tests :
@@ -234,13 +248,14 @@ jobs:
234248 - checkout
235249 - run : *print-system-info
236250 - restore_cache : *restore-package-node-modules-cache
237- - run : rm -rf spec/dummy/public/webpack
238- - run : rm -rf spec/dummy/ssr-generated
251+ - run : rm -rf react_on_rails_pro/ spec/dummy/public/webpack
252+ - run : rm -rf react_on_rails_pro/ spec/dummy/ssr-generated
239253 - restore_cache : *restore-dummy-app-webpack-bundle-cache
240254 - run : *install-package-node-modules
241255 # https://circleci.com/docs/collect-test-data/#jest
242256 - run :
243- name : Run JS unit tests for Renderer package
257+ name : Run JS unit tests for Pro Renderer package
258+ working_directory : react_on_rails_pro
244259 command : yarn run nps test.ci
245260 environment :
246261 JEST_JUNIT_OUTPUT_DIR : ./jest
@@ -257,13 +272,14 @@ jobs:
257272 - restore_cache : *restore-package-gem-cache
258273 - run : *install-package-ruby-gems
259274 - run :
260- name : Run rspec tests
275+ name : Run rspec tests (Pro package)
276+ working_directory : react_on_rails_pro
261277 command : |
262278 bundle exec rspec spec/react_on_rails_pro
263279 - store_test_results :
264280 path : ~/rspec
265281 - store_artifacts :
266- path : log/test.log
282+ path : react_on_rails_pro/ log/test.log
267283
268284 # Start Renderer and run RSpec test suite for dummy app.
269285 # NOTES:
@@ -280,31 +296,34 @@ jobs:
280296 - restore_cache : *restore-package-node-modules-cache
281297 - restore_cache : *restore-dummy-app-node-modules-cache
282298 - restore_cache : *restore-dummy-app-gem-cache
283- - run : rm -rf spec/dummy/public/webpack
284- - run : rm -rf spec/dummy/ssr-generated
299+ - run : rm -rf react_on_rails_pro/ spec/dummy/public/webpack
300+ - run : rm -rf react_on_rails_pro/ spec/dummy/ssr-generated
285301 - restore_cache : *restore-dummy-app-webpack-bundle-cache
286302 - run : *install-dummy-app-ruby-gems
287303 - run : *install-package-node-modules
288304 - run : *install-latest-chrome
289305 - run : *install-dummy-app-node-modules
290306 - run :
291- name : Generate file-system based entrypoints
307+ name : Generate file-system based entrypoints (Pro)
308+ working_directory : react_on_rails_pro
292309 command : cd spec/dummy && bundle exec rake react_on_rails:generate_packs
293310 - run :
294- name : Run Node renderer in a background
311+ name : Run Pro Node renderer in a background
312+ working_directory : react_on_rails_pro
295313 command : cd spec/dummy && yarn run node-renderer
296314 background : true
297315 - run :
298- name : run rails server in background
316+ name : run rails server in background (Pro dummy app)
317+ working_directory : react_on_rails_pro
299318 command : cd spec/dummy && RAILS_ENV=test rails server
300319 background : true
301320 - run :
302321 name : wait for rails server to start
303322 command : |
304323 while ! curl -s http://localhost:3000 > /dev/null; do sleep 1; done
305324 - run :
306- name : Run rspec tests
307- working_directory : spec/dummy
325+ name : Run rspec tests (Pro dummy app)
326+ working_directory : react_on_rails_pro/ spec/dummy
308327 command : |
309328 circleci tests glob "spec/**/*_spec.rb" |
310329 circleci tests run --command="xargs bundle exec rspec \
@@ -318,11 +337,11 @@ jobs:
318337 - store_test_results :
319338 path : ~/rspec
320339 - store_artifacts :
321- path : spec/dummy/tmp/screenshots
340+ path : react_on_rails_pro/ spec/dummy/tmp/screenshots
322341 - store_artifacts :
323- path : spec/dummy/log/test.log
342+ path : react_on_rails_pro/ spec/dummy/log/test.log
324343 - store_artifacts :
325- path : spec/dummy/yarn-error.log
344+ path : react_on_rails_pro/ spec/dummy/yarn-error.log
326345
327346workflows :
328347 version : 2
0 commit comments