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.

217 lines
5.6 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: ./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.5:
  112. <<: *defaults
  113. docker:
  114. - image: circleci/ruby:2.5.1-stretch-node
  115. environment: *ruby_environment
  116. - image: circleci/postgres:10.3-alpine
  117. environment:
  118. POSTGRES_USER: root
  119. - image: circleci/redis:4.0.9-alpine
  120. <<: *test_steps
  121. test-ruby2.4:
  122. <<: *defaults
  123. docker:
  124. - image: circleci/ruby:2.4.4-stretch-node
  125. environment: *ruby_environment
  126. - image: circleci/postgres:10.3-alpine
  127. environment:
  128. POSTGRES_USER: root
  129. - image: circleci/redis:4.0.9-alpine
  130. <<: *test_steps
  131. test-ruby2.3:
  132. <<: *defaults
  133. docker:
  134. - image: circleci/ruby:2.3.7-stretch-node
  135. environment: *ruby_environment
  136. - image: circleci/postgres:10.3-alpine
  137. environment:
  138. POSTGRES_USER: root
  139. - image: circleci/redis:4.0.9-alpine
  140. <<: *test_steps
  141. test-webui:
  142. <<: *defaults
  143. docker:
  144. - image: circleci/node:8.11.1-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.5:
  162. requires:
  163. - install
  164. - install-ruby2.4:
  165. requires:
  166. - install
  167. - install-ruby2.5
  168. - install-ruby2.3:
  169. requires:
  170. - install
  171. - install-ruby2.5
  172. - build:
  173. requires:
  174. - install-ruby2.5
  175. - test-ruby2.5:
  176. requires:
  177. - install-ruby2.5
  178. - build
  179. - test-ruby2.4:
  180. requires:
  181. - install-ruby2.4
  182. - build
  183. - test-ruby2.3:
  184. requires:
  185. - install-ruby2.3
  186. - build
  187. - test-webui:
  188. requires:
  189. - install
  190. - check-i18n:
  191. requires:
  192. - install-ruby2.5