config.yml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. version: 2
  2. aliases:
  3. - &defaults
  4. docker:
  5. - image: circleci/ruby:2.6.0-stretch-node
  6. environment: &ruby_environment
  7. BUNDLE_APP_CONFIG: ./.bundle/
  8. DB_HOST: localhost
  9. DB_USER: root
  10. RAILS_ENV: test
  11. PARALLEL_TEST_PROCESSORS: 4
  12. ALLOW_NOPAM: true
  13. CONTINUOUS_INTEGRATION: true
  14. DISABLE_SIMPLECOV: true
  15. PAM_ENABLED: true
  16. PAM_DEFAULT_SERVICE: pam_test
  17. PAM_CONTROLLED_SERVICE: pam_test_controlled
  18. working_directory: ~/projects/mastodon/
  19. - &attach_workspace
  20. attach_workspace:
  21. at: ~/projects/
  22. - &persist_to_workspace
  23. persist_to_workspace:
  24. root: ~/projects/
  25. paths:
  26. - ./mastodon/
  27. - &restore_ruby_dependencies
  28. restore_cache:
  29. keys:
  30. - v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
  31. - v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-
  32. - v2-ruby-dependencies-
  33. - &install_steps
  34. steps:
  35. - checkout
  36. - *attach_workspace
  37. - restore_cache:
  38. keys:
  39. - v1-node-dependencies-{{ checksum "yarn.lock" }}
  40. - v1-node-dependencies-
  41. - run: yarn install --frozen-lockfile
  42. - save_cache:
  43. key: v1-node-dependencies-{{ checksum "yarn.lock" }}
  44. paths:
  45. - ./node_modules/
  46. - *persist_to_workspace
  47. - &install_system_dependencies
  48. run:
  49. name: Install system dependencies
  50. command: |
  51. sudo apt-get update
  52. sudo apt-get install -y libicu-dev libidn11-dev libprotobuf-dev protobuf-compiler
  53. - &install_ruby_dependencies
  54. steps:
  55. - *attach_workspace
  56. - *install_system_dependencies
  57. - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
  58. - *restore_ruby_dependencies
  59. - run: bundle install --clean --jobs 16 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without development production && bundle clean
  60. - save_cache:
  61. key: v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
  62. paths:
  63. - ./.bundle/
  64. - ./vendor/bundle/
  65. - persist_to_workspace:
  66. root: ~/projects/
  67. paths:
  68. - ./mastodon/.bundle/
  69. - ./mastodon/vendor/bundle/
  70. - &test_steps
  71. steps:
  72. - *attach_workspace
  73. - *install_system_dependencies
  74. - run: sudo apt-get install -y ffmpeg
  75. - run:
  76. name: Prepare Tests
  77. command: ./bin/rails parallel:create parallel:load_schema parallel:prepare
  78. - run:
  79. name: Run Tests
  80. command: ./bin/retry bundle exec parallel_test ./spec/ --group-by filesize --type rspec
  81. jobs:
  82. install:
  83. <<: *defaults
  84. <<: *install_steps
  85. install-ruby2.6:
  86. <<: *defaults
  87. <<: *install_ruby_dependencies
  88. install-ruby2.5:
  89. <<: *defaults
  90. docker:
  91. - image: circleci/ruby:2.5.3-stretch-node
  92. environment: *ruby_environment
  93. <<: *install_ruby_dependencies
  94. install-ruby2.4:
  95. <<: *defaults
  96. docker:
  97. - image: circleci/ruby:2.4.5-stretch-node
  98. environment: *ruby_environment
  99. <<: *install_ruby_dependencies
  100. build:
  101. <<: *defaults
  102. steps:
  103. - *attach_workspace
  104. - *install_system_dependencies
  105. - run: ./bin/rails assets:precompile
  106. - persist_to_workspace:
  107. root: ~/projects/
  108. paths:
  109. - ./mastodon/public/assets
  110. - ./mastodon/public/packs-test/
  111. test-ruby2.6:
  112. <<: *defaults
  113. docker:
  114. - image: circleci/ruby:2.6.0-stretch-node
  115. environment: *ruby_environment
  116. - image: circleci/postgres:10.6-alpine
  117. environment:
  118. POSTGRES_USER: root
  119. - image: circleci/redis:5.0.3-alpine3.8
  120. <<: *test_steps
  121. test-ruby2.5:
  122. <<: *defaults
  123. docker:
  124. - image: circleci/ruby:2.5.3-stretch-node
  125. environment: *ruby_environment
  126. - image: circleci/postgres:10.6-alpine
  127. environment:
  128. POSTGRES_USER: root
  129. - image: circleci/redis:4.0.12-alpine
  130. <<: *test_steps
  131. test-ruby2.4:
  132. <<: *defaults
  133. docker:
  134. - image: circleci/ruby:2.4.5-stretch-node
  135. environment: *ruby_environment
  136. - image: circleci/postgres:10.6-alpine
  137. environment:
  138. POSTGRES_USER: root
  139. - image: circleci/redis:4.0.12-alpine
  140. <<: *test_steps
  141. test-webui:
  142. <<: *defaults
  143. docker:
  144. - image: circleci/node:8.15.0-stretch
  145. steps:
  146. - *attach_workspace
  147. - run: ./bin/retry yarn test:jest
  148. check-i18n:
  149. <<: *defaults
  150. steps:
  151. - *attach_workspace
  152. - run: bundle exec i18n-tasks check-normalized
  153. - run: bundle exec i18n-tasks unused
  154. - run: bundle exec i18n-tasks missing -t plural
  155. - run: bundle exec i18n-tasks check-consistent-interpolations
  156. workflows:
  157. version: 2
  158. build-and-test:
  159. jobs:
  160. - install
  161. - install-ruby2.6:
  162. requires:
  163. - install
  164. - install-ruby2.5:
  165. requires:
  166. - install
  167. - install-ruby2.6
  168. - install-ruby2.4:
  169. requires:
  170. - install
  171. - install-ruby2.6
  172. - build:
  173. requires:
  174. - install-ruby2.6
  175. - test-ruby2.6:
  176. requires:
  177. - install-ruby2.6
  178. - build
  179. - test-ruby2.5:
  180. requires:
  181. - install-ruby2.5
  182. - build
  183. - test-ruby2.4:
  184. requires:
  185. - install-ruby2.4
  186. - build
  187. - test-webui:
  188. requires:
  189. - install
  190. - check-i18n:
  191. requires:
  192. - install-ruby2.6