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.

192 lines
5.0 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. DISABLE_SIMPLECOV: true
  14. working_directory: ~/projects/mastodon/
  15. - &attach_workspace
  16. attach_workspace:
  17. at: ~/projects/
  18. - &persist_to_workspace
  19. persist_to_workspace:
  20. root: ~/projects/
  21. paths:
  22. - ./mastodon/
  23. - &restore_ruby_dependencies
  24. restore_cache:
  25. keys:
  26. - v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
  27. - v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-
  28. - v2-ruby-dependencies-
  29. - &install_steps
  30. steps:
  31. - checkout
  32. - *attach_workspace
  33. - restore_cache:
  34. keys:
  35. - v1-node-dependencies-{{ checksum "yarn.lock" }}
  36. - v1-node-dependencies-
  37. - run: yarn install --frozen-lockfile
  38. - save_cache:
  39. key: v1-node-dependencies-{{ checksum "yarn.lock" }}
  40. paths:
  41. - ./node_modules/
  42. - *persist_to_workspace
  43. - &install_system_dependencies
  44. run:
  45. name: Install system dependencies
  46. command: |
  47. sudo apt-get update
  48. sudo apt-get install -y libicu-dev libidn11-dev libprotobuf-dev protobuf-compiler
  49. - &install_ruby_dependencies
  50. steps:
  51. - *attach_workspace
  52. - *install_system_dependencies
  53. - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
  54. - *restore_ruby_dependencies
  55. - run: bundle install --clean --jobs 16 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without development production
  56. - save_cache:
  57. key: v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
  58. paths:
  59. - ./.bundle/
  60. - ./vendor/bundle/
  61. - &test_steps
  62. steps:
  63. - *attach_workspace
  64. - *install_system_dependencies
  65. - run: sudo apt-get install -y ffmpeg
  66. - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
  67. - *restore_ruby_dependencies
  68. - restore_cache:
  69. keys:
  70. - precompiled-assets-{{ .Branch }}-{{ .Revision }}
  71. - precompiled-assets-{{ .Branch }}-
  72. - precompiled-assets-
  73. - run:
  74. name: Prepare Tests
  75. command: ./bin/rails parallel:create parallel:load_schema parallel:prepare
  76. - run:
  77. name: Run Tests
  78. command: ./bin/retry bundle exec parallel_test ./spec/ --group-by filesize --type rspec
  79. jobs:
  80. install:
  81. <<: *defaults
  82. <<: *install_steps
  83. install-ruby2.5:
  84. <<: *defaults
  85. <<: *install_ruby_dependencies
  86. install-ruby2.4:
  87. <<: *defaults
  88. docker:
  89. - image: circleci/ruby:2.4.4-stretch-node
  90. environment: *ruby_environment
  91. <<: *install_ruby_dependencies
  92. build:
  93. <<: *defaults
  94. steps:
  95. - *attach_workspace
  96. - *install_system_dependencies
  97. - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
  98. - *restore_ruby_dependencies
  99. - run: ./bin/rails assets:precompile
  100. - save_cache:
  101. key: precompiled-assets-{{ .Branch }}-{{ .Revision }}
  102. paths:
  103. - ./public/assets
  104. - ./public/packs-test/
  105. test-ruby2.5:
  106. <<: *defaults
  107. docker:
  108. - image: circleci/ruby:2.5.1-stretch-node
  109. environment: *ruby_environment
  110. - image: circleci/postgres:10.3-alpine
  111. environment:
  112. POSTGRES_USER: root
  113. - image: circleci/redis:4.0.9-alpine
  114. <<: *test_steps
  115. test-ruby2.4:
  116. <<: *defaults
  117. docker:
  118. - image: circleci/ruby:2.4.4-stretch-node
  119. environment: *ruby_environment
  120. - image: circleci/postgres:10.3-alpine
  121. environment:
  122. POSTGRES_USER: root
  123. - image: circleci/redis:4.0.9-alpine
  124. <<: *test_steps
  125. test-webui:
  126. <<: *defaults
  127. docker:
  128. - image: circleci/node:8.11.1-stretch
  129. steps:
  130. - *attach_workspace
  131. - run: ./bin/retry yarn test:jest
  132. check-i18n:
  133. <<: *defaults
  134. steps:
  135. - *attach_workspace
  136. - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
  137. - *restore_ruby_dependencies
  138. - run: bundle exec i18n-tasks check-normalized
  139. - run: bundle exec i18n-tasks unused
  140. workflows:
  141. version: 2
  142. build-and-test:
  143. jobs:
  144. - install
  145. - install-ruby2.5:
  146. requires:
  147. - install
  148. - install-ruby2.4:
  149. requires:
  150. - install
  151. - build:
  152. requires:
  153. - install-ruby2.5
  154. - test-ruby2.5:
  155. requires:
  156. - install-ruby2.5
  157. - build
  158. - test-ruby2.4:
  159. requires:
  160. - install-ruby2.4
  161. - build
  162. - test-webui:
  163. requires:
  164. - install
  165. - check-i18n:
  166. requires:
  167. - install-ruby2.5