闭社主体 forked from https://github.com/tootsuite/mastodon
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.

216 lines
5.6 KiB

  1. version: 2
  2. aliases:
  3. - &defaults
  4. docker:
  5. - image: circleci/ruby:2.6.0-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.6:
  86. <<: *defaults
  87. <<: *install_ruby_dependencies
  88. install-ruby2.5:
  89. <<: *defaults
  90. docker:
  91. - image: circleci/ruby:2.5.3-stretch-node
  92. environment: *ruby_environment
  93. <<: *install_ruby_dependencies
  94. install-ruby2.4:
  95. <<: *defaults
  96. docker:
  97. - image: circleci/ruby:2.4.5-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.6:
  112. <<: *defaults
  113. docker:
  114. - image: circleci/ruby:2.6.0-stretch-node
  115. environment: *ruby_environment
  116. - image: circleci/postgres:10.6-alpine
  117. environment:
  118. POSTGRES_USER: root
  119. - image: circleci/redis:5.0.3-alpine3.8
  120. <<: *test_steps
  121. test-ruby2.5:
  122. <<: *defaults
  123. docker:
  124. - image: circleci/ruby:2.5.3-stretch-node
  125. environment: *ruby_environment
  126. - image: circleci/postgres:10.6-alpine
  127. environment:
  128. POSTGRES_USER: root
  129. - image: circleci/redis:4.0.12-alpine
  130. <<: *test_steps
  131. test-ruby2.4:
  132. <<: *defaults
  133. docker:
  134. - image: circleci/ruby:2.4.5-stretch-node
  135. environment: *ruby_environment
  136. - image: circleci/postgres:10.6-alpine
  137. environment:
  138. POSTGRES_USER: root
  139. - image: circleci/redis:4.0.12-alpine
  140. <<: *test_steps
  141. test-webui:
  142. <<: *defaults
  143. docker:
  144. - image: circleci/node:8.15.0-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 -l en
  154. - run: bundle exec i18n-tasks check-consistent-interpolations
  155. workflows:
  156. version: 2
  157. build-and-test:
  158. jobs:
  159. - install
  160. - install-ruby2.6:
  161. requires:
  162. - install
  163. - install-ruby2.5:
  164. requires:
  165. - install
  166. - install-ruby2.6
  167. - install-ruby2.4:
  168. requires:
  169. - install
  170. - install-ruby2.6
  171. - build:
  172. requires:
  173. - install-ruby2.6
  174. - test-ruby2.6:
  175. requires:
  176. - install-ruby2.6
  177. - build
  178. - test-ruby2.5:
  179. requires:
  180. - install-ruby2.5
  181. - build
  182. - test-ruby2.4:
  183. requires:
  184. - install-ruby2.4
  185. - build
  186. - test-webui:
  187. requires:
  188. - install
  189. - check-i18n:
  190. requires:
  191. - install-ruby2.6