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.

215 lines
5.4 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. working_directory: ~/projects/mastodon/
  16. - &attach_workspace
  17. attach_workspace:
  18. at: ~/projects/
  19. - &persist_to_workspace
  20. persist_to_workspace:
  21. root: ~/projects/
  22. paths:
  23. - ./mastodon/
  24. - &restore_ruby_dependencies
  25. restore_cache:
  26. keys:
  27. - v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
  28. - v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-
  29. - v2-ruby-dependencies-
  30. - &install_steps
  31. steps:
  32. - checkout
  33. - *attach_workspace
  34. - restore_cache:
  35. keys:
  36. - v1-node-dependencies-{{ checksum "yarn.lock" }}
  37. - v1-node-dependencies-
  38. - run: yarn install --frozen-lockfile
  39. - save_cache:
  40. key: v1-node-dependencies-{{ checksum "yarn.lock" }}
  41. paths:
  42. - ./node_modules/
  43. - *persist_to_workspace
  44. - &install_system_dependencies
  45. run:
  46. name: Install system dependencies
  47. command: |
  48. sudo apt-get update
  49. sudo apt-get install -y libicu-dev libidn11-dev libprotobuf-dev protobuf-compiler
  50. - &install_ruby_dependencies
  51. steps:
  52. - *attach_workspace
  53. - *install_system_dependencies
  54. - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
  55. - *restore_ruby_dependencies
  56. - run: bundle install --clean --jobs 16 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without development production && bundle clean
  57. - save_cache:
  58. key: v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
  59. paths:
  60. - ./.bundle/
  61. - ./vendor/bundle/
  62. - persist_to_workspace:
  63. root: ~/projects/
  64. paths:
  65. - ./mastodon/.bundle/
  66. - ./mastodon/vendor/bundle/
  67. - &test_steps
  68. steps:
  69. - *attach_workspace
  70. - *install_system_dependencies
  71. - run: sudo apt-get install -y ffmpeg
  72. - run:
  73. name: Prepare Tests
  74. command: ./bin/rails parallel:create parallel:load_schema parallel:prepare
  75. - run:
  76. name: Run Tests
  77. command: ./bin/retry bundle exec parallel_test ./spec/ --group-by filesize --type rspec
  78. jobs:
  79. install:
  80. <<: *defaults
  81. <<: *install_steps
  82. install-ruby2.5:
  83. <<: *defaults
  84. <<: *install_ruby_dependencies
  85. install-ruby2.4:
  86. <<: *defaults
  87. docker:
  88. - image: circleci/ruby:2.4.4-stretch-node
  89. environment: *ruby_environment
  90. <<: *install_ruby_dependencies
  91. install-ruby2.3:
  92. <<: *defaults
  93. docker:
  94. - image: circleci/ruby:2.3.7-stretch-node
  95. environment: *ruby_environment
  96. <<: *install_ruby_dependencies
  97. build:
  98. <<: *defaults
  99. steps:
  100. - *attach_workspace
  101. - *install_system_dependencies
  102. - run:
  103. name: Precompile assets
  104. command: ./bin/rails assets:precompile
  105. no_output_timeout: 40m
  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. workflows:
  155. version: 2
  156. build-and-test:
  157. jobs:
  158. - install
  159. - install-ruby2.5:
  160. requires:
  161. - install
  162. - install-ruby2.4:
  163. requires:
  164. - install
  165. - install-ruby2.5
  166. - install-ruby2.3:
  167. requires:
  168. - install
  169. - install-ruby2.5
  170. - build:
  171. requires:
  172. - install-ruby2.5
  173. - test-ruby2.5:
  174. requires:
  175. - install-ruby2.5
  176. - build
  177. - test-ruby2.4:
  178. requires:
  179. - install-ruby2.4
  180. - build
  181. - test-ruby2.3:
  182. requires:
  183. - install-ruby2.3
  184. - build
  185. - test-webui:
  186. requires:
  187. - install
  188. - check-i18n:
  189. requires:
  190. - install-ruby2.5