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.

266 lines
7.2 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. 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. ## TODO: FIX THESE BUSTER DEPENDANCES
  54. sudo wget http://ftp.au.debian.org/debian/pool/main/i/icu/libicu57_57.1-6+deb9u3_amd64.deb
  55. sudo dpkg -i libicu57_57.1-6+deb9u3_amd64.deb
  56. sudo wget http://ftp.au.debian.org/debian/pool/main/p/protobuf/libprotobuf10_3.0.0-9_amd64.deb
  57. sudo dpkg -i libprotobuf10_3.0.0-9_amd64.deb
  58. - &install_ruby_dependencies
  59. steps:
  60. - *attach_workspace
  61. - *install_system_dependencies
  62. - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
  63. - *restore_ruby_dependencies
  64. - run: bundle install --clean --jobs 16 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without development production && bundle clean
  65. - save_cache:
  66. key: v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
  67. paths:
  68. - ./.bundle/
  69. - ./vendor/bundle/
  70. - persist_to_workspace:
  71. root: ~/projects/
  72. paths:
  73. - ./mastodon/.bundle/
  74. - ./mastodon/vendor/bundle/
  75. - &test_steps
  76. steps:
  77. - *attach_workspace
  78. - *install_system_dependencies
  79. - run: sudo apt-get install -y ffmpeg
  80. - run:
  81. name: Prepare Tests
  82. command: ./bin/rails parallel:create parallel:load_schema parallel:prepare
  83. - run:
  84. name: Run Tests
  85. command: ./bin/retry bundle exec parallel_test ./spec/ --group-by filesize --type rspec
  86. jobs:
  87. install:
  88. <<: *defaults
  89. <<: *install_steps
  90. install-ruby2.7:
  91. <<: *defaults
  92. <<: *install_ruby_dependencies
  93. install-ruby2.6:
  94. <<: *defaults
  95. docker:
  96. - image: circleci/ruby:2.6-buster-node
  97. environment: *ruby_environment
  98. <<: *install_ruby_dependencies
  99. install-ruby2.5:
  100. <<: *defaults
  101. docker:
  102. - image: circleci/ruby:2.5-buster-node
  103. environment: *ruby_environment
  104. <<: *install_ruby_dependencies
  105. install-ruby2.4:
  106. <<: *defaults
  107. docker:
  108. - image: circleci/ruby:2.4-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-ruby2.4:
  171. <<: *defaults
  172. docker:
  173. - image: circleci/ruby:2.4-buster-node
  174. environment: *ruby_environment
  175. - image: circleci/postgres:10.6-alpine
  176. environment:
  177. POSTGRES_USER: root
  178. - image: circleci/redis:5-alpine
  179. <<: *test_steps
  180. test-webui:
  181. <<: *defaults
  182. docker:
  183. - image: circleci/node:12-buster
  184. steps:
  185. - *attach_workspace
  186. - run: ./bin/retry yarn test:jest
  187. check-i18n:
  188. <<: *defaults
  189. steps:
  190. - *attach_workspace
  191. - *install_system_dependencies
  192. - run: bundle exec i18n-tasks check-normalized
  193. - run: bundle exec i18n-tasks unused -l en
  194. - run: bundle exec i18n-tasks check-consistent-interpolations
  195. - run: bundle exec rake repo:check_locales_files
  196. workflows:
  197. version: 2
  198. build-and-test:
  199. jobs:
  200. - install
  201. - install-ruby2.7:
  202. requires:
  203. - install
  204. - install-ruby2.6:
  205. requires:
  206. - install
  207. - install-ruby2.7
  208. - install-ruby2.5:
  209. requires:
  210. - install
  211. - install-ruby2.7
  212. - install-ruby2.4:
  213. requires:
  214. - install
  215. - install-ruby2.7
  216. - build:
  217. requires:
  218. - install-ruby2.7
  219. - test-migrations:
  220. requires:
  221. - install-ruby2.7
  222. - test-ruby2.7:
  223. requires:
  224. - install-ruby2.7
  225. - build
  226. - test-ruby2.6:
  227. requires:
  228. - install-ruby2.6
  229. - build
  230. - test-ruby2.5:
  231. requires:
  232. - install-ruby2.5
  233. - build
  234. - test-ruby2.4:
  235. requires:
  236. - install-ruby2.4
  237. - build
  238. - test-webui:
  239. requires:
  240. - install
  241. - check-i18n:
  242. requires:
  243. - install-ruby2.7