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.5 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
  57. - save_cache:
  58. key: v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
  59. paths:
  60. - ./.bundle/
  61. - ./vendor/bundle/
  62. - &test_steps
  63. steps:
  64. - *attach_workspace
  65. - *install_system_dependencies
  66. - run: sudo apt-get install -y ffmpeg
  67. - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
  68. - *restore_ruby_dependencies
  69. - run:
  70. name: Prepare Tests
  71. command: ./bin/rails parallel:create parallel:load_schema parallel:prepare
  72. - run:
  73. name: Run Tests
  74. command: ./bin/retry bundle exec parallel_test ./spec/ --group-by filesize --type rspec
  75. jobs:
  76. install:
  77. <<: *defaults
  78. <<: *install_steps
  79. install-ruby2.5:
  80. <<: *defaults
  81. <<: *install_ruby_dependencies
  82. install-ruby2.4:
  83. <<: *defaults
  84. docker:
  85. - image: circleci/ruby:2.4.4-stretch-node
  86. environment: *ruby_environment
  87. <<: *install_ruby_dependencies
  88. install-ruby2.3:
  89. <<: *defaults
  90. docker:
  91. - image: circleci/ruby:2.3.7-stretch-node
  92. environment: *ruby_environment
  93. <<: *install_ruby_dependencies
  94. build:
  95. <<: *defaults
  96. steps:
  97. - *attach_workspace
  98. - *install_system_dependencies
  99. - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
  100. - *restore_ruby_dependencies
  101. - run:
  102. name: Precompile assets
  103. command: ./bin/rails assets:precompile
  104. no_output_timeout: 40m
  105. - persist_to_workspace:
  106. root: ~/projects/
  107. paths:
  108. - ./mastodon/public/assets
  109. - ./mastodon/public/packs-test/
  110. test-ruby2.5:
  111. <<: *defaults
  112. docker:
  113. - image: circleci/ruby:2.5.1-stretch-node
  114. environment: *ruby_environment
  115. - image: circleci/postgres:10.3-alpine
  116. environment:
  117. POSTGRES_USER: root
  118. - image: circleci/redis:4.0.9-alpine
  119. <<: *test_steps
  120. test-ruby2.4:
  121. <<: *defaults
  122. docker:
  123. - image: circleci/ruby:2.4.4-stretch-node
  124. environment: *ruby_environment
  125. - image: circleci/postgres:10.3-alpine
  126. environment:
  127. POSTGRES_USER: root
  128. - image: circleci/redis:4.0.9-alpine
  129. <<: *test_steps
  130. test-ruby2.3:
  131. <<: *defaults
  132. docker:
  133. - image: circleci/ruby:2.3.7-stretch-node
  134. environment: *ruby_environment
  135. - image: circleci/postgres:10.3-alpine
  136. environment:
  137. POSTGRES_USER: root
  138. - image: circleci/redis:4.0.9-alpine
  139. <<: *test_steps
  140. test-webui:
  141. <<: *defaults
  142. docker:
  143. - image: circleci/node:8.11.1-stretch
  144. steps:
  145. - *attach_workspace
  146. - run: ./bin/retry yarn test:jest
  147. check-i18n:
  148. <<: *defaults
  149. steps:
  150. - *attach_workspace
  151. - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
  152. - *restore_ruby_dependencies
  153. - run: bundle exec i18n-tasks check-normalized
  154. - run: bundle exec i18n-tasks unused
  155. workflows:
  156. version: 2
  157. build-and-test:
  158. jobs:
  159. - install
  160. - install-ruby2.5:
  161. requires:
  162. - install
  163. - install-ruby2.4:
  164. requires:
  165. - install
  166. - install-ruby2.3:
  167. requires:
  168. - install
  169. - build:
  170. requires:
  171. - install-ruby2.5
  172. - test-ruby2.5:
  173. requires:
  174. - install-ruby2.5
  175. - build
  176. - test-ruby2.4:
  177. requires:
  178. - install-ruby2.4
  179. - build
  180. - test-ruby2.3:
  181. requires:
  182. - install-ruby2.3
  183. - build
  184. - test-webui:
  185. requires:
  186. - install
  187. - check-i18n:
  188. requires:
  189. - install-ruby2.5