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.

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