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.

246 lines
6.8 KiB

  1. version: 2
  2. aliases:
  3. - &defaults
  4. docker:
  5. - image: circleci/ruby:2.7-buster-node
  6. environment: &ruby_environment
  7. BUNDLE_APP_CONFIG: ./.bundle/
  8. BUNDLE_PATH: ./vendor/bundle/
  9. DB_HOST: localhost
  10. DB_USER: root
  11. RAILS_ENV: test
  12. PARALLEL_TEST_PROCESSORS: 4
  13. ALLOW_NOPAM: true
  14. CONTINUOUS_INTEGRATION: true
  15. DISABLE_SIMPLECOV: true
  16. PAM_ENABLED: true
  17. PAM_DEFAULT_SERVICE: pam_test
  18. PAM_CONTROLLED_SERVICE: pam_test_controlled
  19. working_directory: ~/projects/mastodon/
  20. - &attach_workspace
  21. attach_workspace:
  22. at: ~/projects/
  23. - &persist_to_workspace
  24. persist_to_workspace:
  25. root: ~/projects/
  26. paths:
  27. - ./mastodon/
  28. - &restore_ruby_dependencies
  29. restore_cache:
  30. keys:
  31. - v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
  32. - v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-
  33. - v2-ruby-dependencies-
  34. - &install_steps
  35. steps:
  36. - checkout
  37. - *attach_workspace
  38. - restore_cache:
  39. keys:
  40. - v1-node-dependencies-{{ checksum "yarn.lock" }}
  41. - v1-node-dependencies-
  42. - run: yarn install --frozen-lockfile
  43. - save_cache:
  44. key: v1-node-dependencies-{{ checksum "yarn.lock" }}
  45. paths:
  46. - ./node_modules/
  47. - *persist_to_workspace
  48. - &install_system_dependencies
  49. run:
  50. name: Install system dependencies
  51. command: |
  52. sudo apt-get update
  53. sudo apt-get install -y libicu-dev libidn11-dev libprotobuf-dev protobuf-compiler
  54. ## TODO: FIX THESE BUSTER DEPENDANCES
  55. sudo wget http://ftp.au.debian.org/debian/pool/main/i/icu/libicu57_57.1-6+deb9u3_amd64.deb
  56. sudo dpkg -i libicu57_57.1-6+deb9u3_amd64.deb
  57. sudo wget http://ftp.au.debian.org/debian/pool/main/p/protobuf/libprotobuf10_3.0.0-9_amd64.deb
  58. sudo dpkg -i libprotobuf10_3.0.0-9_amd64.deb
  59. - &install_ruby_dependencies
  60. steps:
  61. - *attach_workspace
  62. - *install_system_dependencies
  63. - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
  64. - *restore_ruby_dependencies
  65. - run: bundle config set clean 'true'
  66. - run: bundle config set deployment 'true'
  67. - run: bundle config set with 'pam_authentication'
  68. - run: bundle config set without 'development production'
  69. - run: bundle config set frozen 'true'
  70. - run: bundle install --jobs 16 --retry 3 && bundle clean
  71. - save_cache:
  72. key: v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
  73. paths:
  74. - ./.bundle/
  75. - ./vendor/bundle/
  76. - persist_to_workspace:
  77. root: ~/projects/
  78. paths:
  79. - ./mastodon/.bundle/
  80. - ./mastodon/vendor/bundle/
  81. - &test_steps
  82. steps:
  83. - *attach_workspace
  84. - *install_system_dependencies
  85. - run: sudo apt-get install -y ffmpeg
  86. - run:
  87. name: Prepare Tests
  88. command: ./bin/rails parallel:create parallel:load_schema parallel:prepare
  89. - run:
  90. name: Run Tests
  91. command: ./bin/retry bundle exec parallel_test ./spec/ --group-by filesize --type rspec
  92. jobs:
  93. install:
  94. <<: *defaults
  95. <<: *install_steps
  96. install-ruby2.7:
  97. <<: *defaults
  98. <<: *install_ruby_dependencies
  99. install-ruby2.6:
  100. <<: *defaults
  101. docker:
  102. - image: circleci/ruby:2.6-buster-node
  103. environment: *ruby_environment
  104. <<: *install_ruby_dependencies
  105. install-ruby2.5:
  106. <<: *defaults
  107. docker:
  108. - image: circleci/ruby:2.5-buster-node
  109. environment: *ruby_environment
  110. <<: *install_ruby_dependencies
  111. build:
  112. <<: *defaults
  113. steps:
  114. - *attach_workspace
  115. - *install_system_dependencies
  116. - run: ./bin/rails assets:precompile
  117. - persist_to_workspace:
  118. root: ~/projects/
  119. paths:
  120. - ./mastodon/public/assets
  121. - ./mastodon/public/packs-test/
  122. test-migrations:
  123. <<: *defaults
  124. docker:
  125. - image: circleci/ruby:2.7-buster-node
  126. environment: *ruby_environment
  127. - image: circleci/postgres:10.6-alpine
  128. environment:
  129. POSTGRES_USER: root
  130. - image: circleci/redis:5-alpine
  131. steps:
  132. - *attach_workspace
  133. - *install_system_dependencies
  134. - run:
  135. name: Create database
  136. command: ./bin/rails parallel:create
  137. - run:
  138. name: Run migrations
  139. command: ./bin/rails parallel:migrate
  140. test-ruby2.7:
  141. <<: *defaults
  142. docker:
  143. - image: circleci/ruby:2.7-buster-node
  144. environment: *ruby_environment
  145. - image: circleci/postgres:10.6-alpine
  146. environment:
  147. POSTGRES_USER: root
  148. - image: circleci/redis:5-alpine
  149. <<: *test_steps
  150. test-ruby2.6:
  151. <<: *defaults
  152. docker:
  153. - image: circleci/ruby:2.6-buster-node
  154. environment: *ruby_environment
  155. - image: circleci/postgres:10.6-alpine
  156. environment:
  157. POSTGRES_USER: root
  158. - image: circleci/redis:5-alpine
  159. <<: *test_steps
  160. test-ruby2.5:
  161. <<: *defaults
  162. docker:
  163. - image: circleci/ruby:2.5-buster-node
  164. environment: *ruby_environment
  165. - image: circleci/postgres:10.6-alpine
  166. environment:
  167. POSTGRES_USER: root
  168. - image: circleci/redis:5-alpine
  169. <<: *test_steps
  170. test-webui:
  171. <<: *defaults
  172. docker:
  173. - image: circleci/node:12-buster
  174. steps:
  175. - *attach_workspace
  176. - run: ./bin/retry yarn test:jest
  177. check-i18n:
  178. <<: *defaults
  179. steps:
  180. - *attach_workspace
  181. - *install_system_dependencies
  182. - run: bundle exec i18n-tasks check-normalized
  183. - run: bundle exec i18n-tasks unused -l en
  184. - run: bundle exec i18n-tasks check-consistent-interpolations
  185. - run: bundle exec rake repo:check_locales_files
  186. workflows:
  187. version: 2
  188. build-and-test:
  189. jobs:
  190. - install
  191. - install-ruby2.7:
  192. requires:
  193. - install
  194. - install-ruby2.6:
  195. requires:
  196. - install
  197. - install-ruby2.7
  198. - install-ruby2.5:
  199. requires:
  200. - install
  201. - install-ruby2.7
  202. - build:
  203. requires:
  204. - install-ruby2.7
  205. - test-migrations:
  206. requires:
  207. - install-ruby2.7
  208. - test-ruby2.7:
  209. requires:
  210. - install-ruby2.7
  211. - build
  212. - test-ruby2.6:
  213. requires:
  214. - install-ruby2.6
  215. - build
  216. - test-ruby2.5:
  217. requires:
  218. - install-ruby2.5
  219. - build
  220. - test-webui:
  221. requires:
  222. - install
  223. - check-i18n:
  224. requires:
  225. - install-ruby2.7