闭社主体 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.

212 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
  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: ./bin/rails assets:precompile
  102. - persist_to_workspace:
  103. root: ~/projects/
  104. paths:
  105. - ./mastodon/public/assets
  106. - ./mastodon/public/packs-test/
  107. test-ruby2.5:
  108. <<: *defaults
  109. docker:
  110. - image: circleci/ruby:2.5.1-stretch-node
  111. environment: *ruby_environment
  112. - image: circleci/postgres:10.3-alpine
  113. environment:
  114. POSTGRES_USER: root
  115. - image: circleci/redis:4.0.9-alpine
  116. <<: *test_steps
  117. test-ruby2.4:
  118. <<: *defaults
  119. docker:
  120. - image: circleci/ruby:2.4.4-stretch-node
  121. environment: *ruby_environment
  122. - image: circleci/postgres:10.3-alpine
  123. environment:
  124. POSTGRES_USER: root
  125. - image: circleci/redis:4.0.9-alpine
  126. <<: *test_steps
  127. test-ruby2.3:
  128. <<: *defaults
  129. docker:
  130. - image: circleci/ruby:2.3.7-stretch-node
  131. environment: *ruby_environment
  132. - image: circleci/postgres:10.3-alpine
  133. environment:
  134. POSTGRES_USER: root
  135. - image: circleci/redis:4.0.9-alpine
  136. <<: *test_steps
  137. test-webui:
  138. <<: *defaults
  139. docker:
  140. - image: circleci/node:8.11.1-stretch
  141. steps:
  142. - *attach_workspace
  143. - run: ./bin/retry yarn test:jest
  144. check-i18n:
  145. <<: *defaults
  146. steps:
  147. - *attach_workspace
  148. - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
  149. - *restore_ruby_dependencies
  150. - run: bundle exec i18n-tasks check-normalized
  151. - run: bundle exec i18n-tasks unused
  152. workflows:
  153. version: 2
  154. build-and-test:
  155. jobs:
  156. - install
  157. - install-ruby2.5:
  158. requires:
  159. - install
  160. - install-ruby2.4:
  161. requires:
  162. - install
  163. - install-ruby2.3:
  164. requires:
  165. - install
  166. - build:
  167. requires:
  168. - install-ruby2.5
  169. - test-ruby2.5:
  170. requires:
  171. - install-ruby2.5
  172. - build
  173. - test-ruby2.4:
  174. requires:
  175. - install-ruby2.4
  176. - build
  177. - test-ruby2.3:
  178. requires:
  179. - install-ruby2.3
  180. - build
  181. - test-webui:
  182. requires:
  183. - install
  184. - check-i18n:
  185. requires:
  186. - install-ruby2.5