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