You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

219 lines
5.6 KiB

5 years ago
5 years ago
5 years ago
5 years ago
  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:
  106. name: Precompile assets
  107. command: ./bin/rails assets:precompile
  108. no_output_timeout: 40m
  109. - persist_to_workspace:
  110. root: ~/projects/
  111. paths:
  112. - ./mastodon/public/assets
  113. - ./mastodon/public/packs-test/
  114. test-ruby2.6:
  115. <<: *defaults
  116. docker:
  117. - image: circleci/ruby:2.6.0-stretch-node
  118. environment: *ruby_environment
  119. - image: circleci/postgres:10.6-alpine
  120. environment:
  121. POSTGRES_USER: root
  122. - image: circleci/redis:5.0.3-alpine3.8
  123. <<: *test_steps
  124. test-ruby2.5:
  125. <<: *defaults
  126. docker:
  127. - image: circleci/ruby:2.5.3-stretch-node
  128. environment: *ruby_environment
  129. - image: circleci/postgres:10.6-alpine
  130. environment:
  131. POSTGRES_USER: root
  132. - image: circleci/redis:4.0.12-alpine
  133. <<: *test_steps
  134. test-ruby2.4:
  135. <<: *defaults
  136. docker:
  137. - image: circleci/ruby:2.4.5-stretch-node
  138. environment: *ruby_environment
  139. - image: circleci/postgres:10.6-alpine
  140. environment:
  141. POSTGRES_USER: root
  142. - image: circleci/redis:4.0.12-alpine
  143. <<: *test_steps
  144. test-webui:
  145. <<: *defaults
  146. docker:
  147. - image: circleci/node:8.15.0-stretch
  148. steps:
  149. - *attach_workspace
  150. - run: ./bin/retry yarn test:jest
  151. check-i18n:
  152. <<: *defaults
  153. steps:
  154. - *attach_workspace
  155. - run: bundle exec i18n-tasks check-normalized
  156. - run: bundle exec i18n-tasks unused -l en
  157. - run: bundle exec i18n-tasks check-consistent-interpolations
  158. workflows:
  159. version: 2
  160. build-and-test:
  161. jobs:
  162. - install
  163. - install-ruby2.6:
  164. requires:
  165. - install
  166. - install-ruby2.5:
  167. requires:
  168. - install
  169. - install-ruby2.6
  170. - install-ruby2.4:
  171. requires:
  172. - install
  173. - install-ruby2.6
  174. - build:
  175. requires:
  176. - install-ruby2.6
  177. - test-ruby2.6:
  178. requires:
  179. - install-ruby2.6
  180. - build
  181. - test-ruby2.5:
  182. requires:
  183. - install-ruby2.5
  184. - build
  185. - test-ruby2.4:
  186. requires:
  187. - install-ruby2.4
  188. - build
  189. - test-webui:
  190. requires:
  191. - install
  192. - check-i18n:
  193. requires:
  194. - install-ruby2.6