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.

220 lines
5.7 KiB

  1. version: 2
  2. aliases:
  3. - &defaults
  4. docker:
  5. - image: circleci/ruby:2.5.1-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.5:
  86. <<: *defaults
  87. <<: *install_ruby_dependencies
  88. install-ruby2.4:
  89. <<: *defaults
  90. docker:
  91. - image: circleci/ruby:2.4.4-stretch-node
  92. environment: *ruby_environment
  93. <<: *install_ruby_dependencies
  94. install-ruby2.3:
  95. <<: *defaults
  96. docker:
  97. - image: circleci/ruby:2.3.7-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.5:
  115. <<: *defaults
  116. docker:
  117. - image: circleci/ruby:2.5.1-stretch-node
  118. environment: *ruby_environment
  119. - image: circleci/postgres:10.3-alpine
  120. environment:
  121. POSTGRES_USER: root
  122. - image: circleci/redis:4.0.9-alpine
  123. <<: *test_steps
  124. test-ruby2.4:
  125. <<: *defaults
  126. docker:
  127. - image: circleci/ruby:2.4.4-stretch-node
  128. environment: *ruby_environment
  129. - image: circleci/postgres:10.3-alpine
  130. environment:
  131. POSTGRES_USER: root
  132. - image: circleci/redis:4.0.9-alpine
  133. <<: *test_steps
  134. test-ruby2.3:
  135. <<: *defaults
  136. docker:
  137. - image: circleci/ruby:2.3.7-stretch-node
  138. environment: *ruby_environment
  139. - image: circleci/postgres:10.3-alpine
  140. environment:
  141. POSTGRES_USER: root
  142. - image: circleci/redis:4.0.9-alpine
  143. <<: *test_steps
  144. test-webui:
  145. <<: *defaults
  146. docker:
  147. - image: circleci/node:8.11.1-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
  157. - run: bundle exec i18n-tasks missing -t plural
  158. - run: bundle exec i18n-tasks check-consistent-interpolations
  159. workflows:
  160. version: 2
  161. build-and-test:
  162. jobs:
  163. - install
  164. - install-ruby2.5:
  165. requires:
  166. - install
  167. - install-ruby2.4:
  168. requires:
  169. - install
  170. - install-ruby2.5
  171. - install-ruby2.3:
  172. requires:
  173. - install
  174. - install-ruby2.5
  175. - build:
  176. requires:
  177. - install-ruby2.5
  178. - test-ruby2.5:
  179. requires:
  180. - install-ruby2.5
  181. - build
  182. - test-ruby2.4:
  183. requires:
  184. - install-ruby2.4
  185. - build
  186. - test-ruby2.3:
  187. requires:
  188. - install-ruby2.3
  189. - build
  190. - test-webui:
  191. requires:
  192. - install
  193. - check-i18n:
  194. requires:
  195. - install-ruby2.5