|
| 1 | +version: 2 |
| 2 | + |
| 3 | +aliases: |
| 4 | + - &defaults |
| 5 | + docker: |
| 6 | + - image: circleci/ruby:2.6-stretch-node |
| 7 | + environment: &ruby_environment |
| 8 | + BUNDLE_APP_CONFIG: ./.bundle/ |
| 9 | + DB_HOST: localhost |
| 10 | + DB_USER: root |
| 11 | + RAILS_ENV: test |
| 12 | + PARALLEL_TEST_PROCESSORS: 4 |
| 13 | + ALLOW_NOPAM: true |
| 14 | + CONTINUOUS_INTEGRATION: true |
| 15 | + DISABLE_SIMPLECOV: true |
| 16 | + PAM_ENABLED: true |
| 17 | + PAM_DEFAULT_SERVICE: pam_test |
| 18 | + PAM_CONTROLLED_SERVICE: pam_test_controlled |
| 19 | + working_directory: ~/projects/mastodon/ |
| 20 | + |
| 21 | + - &attach_workspace |
| 22 | + attach_workspace: |
| 23 | + at: ~/projects/ |
| 24 | + |
| 25 | + - &persist_to_workspace |
| 26 | + persist_to_workspace: |
| 27 | + root: ~/projects/ |
| 28 | + paths: |
| 29 | + - ./mastodon/ |
| 30 | + |
| 31 | + - &restore_ruby_dependencies |
| 32 | + restore_cache: |
| 33 | + keys: |
| 34 | + - v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }} |
| 35 | + - v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}- |
| 36 | + - v2-ruby-dependencies- |
| 37 | + |
| 38 | + - &install_steps |
| 39 | + steps: |
| 40 | + - checkout |
| 41 | + - *attach_workspace |
| 42 | + |
| 43 | + - restore_cache: |
| 44 | + keys: |
| 45 | + - v1-node-dependencies-{{ checksum "yarn.lock" }} |
| 46 | + - v1-node-dependencies- |
| 47 | + - run: yarn install --frozen-lockfile |
| 48 | + - save_cache: |
| 49 | + key: v1-node-dependencies-{{ checksum "yarn.lock" }} |
| 50 | + paths: |
| 51 | + - ./node_modules/ |
| 52 | + |
| 53 | + - *persist_to_workspace |
| 54 | + |
| 55 | + - &install_system_dependencies |
| 56 | + run: |
| 57 | + name: Install system dependencies |
| 58 | + command: | |
| 59 | + sudo apt-get update |
| 60 | + sudo apt-get install -y libicu-dev libidn11-dev libprotobuf-dev protobuf-compiler |
| 61 | +
|
| 62 | + - &install_ruby_dependencies |
| 63 | + steps: |
| 64 | + - *attach_workspace |
| 65 | + |
| 66 | + - *install_system_dependencies |
| 67 | + |
| 68 | + - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version |
| 69 | + - *restore_ruby_dependencies |
| 70 | + - run: bundle install --clean --jobs 16 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without development production && bundle clean |
| 71 | + - save_cache: |
| 72 | + key: v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }} |
| 73 | + paths: |
| 74 | + - ./.bundle/ |
| 75 | + - ./vendor/bundle/ |
| 76 | + - persist_to_workspace: |
| 77 | + root: ~/projects/ |
| 78 | + paths: |
| 79 | + - ./mastodon/.bundle/ |
| 80 | + - ./mastodon/vendor/bundle/ |
| 81 | + |
| 82 | + - &test_steps |
| 83 | + steps: |
| 84 | + - *attach_workspace |
| 85 | + |
| 86 | + - *install_system_dependencies |
| 87 | + - run: sudo apt-get install -y ffmpeg |
| 88 | + |
| 89 | + - run: |
| 90 | + name: Prepare Tests |
| 91 | + command: ./bin/rails parallel:create parallel:load_schema parallel:prepare |
| 92 | + - run: |
| 93 | + name: Run Tests |
| 94 | + command: ./bin/retry bundle exec parallel_test ./spec/ --group-by filesize --type rspec |
| 95 | + |
| 96 | +jobs: |
| 97 | + install: |
| 98 | + <<: *defaults |
| 99 | + <<: *install_steps |
| 100 | + |
| 101 | + install-ruby2.6: |
| 102 | + <<: *defaults |
| 103 | + <<: *install_ruby_dependencies |
| 104 | + |
| 105 | + install-ruby2.5: |
| 106 | + <<: *defaults |
| 107 | + docker: |
| 108 | + - image: circleci/ruby:2.5-stretch-node |
| 109 | + environment: *ruby_environment |
| 110 | + <<: *install_ruby_dependencies |
| 111 | + |
| 112 | + install-ruby2.4: |
| 113 | + <<: *defaults |
| 114 | + docker: |
| 115 | + - image: circleci/ruby:2.4-stretch-node |
| 116 | + environment: *ruby_environment |
| 117 | + <<: *install_ruby_dependencies |
| 118 | + |
| 119 | + build: |
| 120 | + <<: *defaults |
| 121 | + steps: |
| 122 | + - *attach_workspace |
| 123 | + - *install_system_dependencies |
| 124 | + - run: ./bin/rails assets:precompile |
| 125 | + - persist_to_workspace: |
| 126 | + root: ~/projects/ |
| 127 | + paths: |
| 128 | + - ./mastodon/public/assets |
| 129 | + - ./mastodon/public/packs-test/ |
| 130 | + |
| 131 | + test-ruby2.6: |
| 132 | + <<: *defaults |
| 133 | + docker: |
| 134 | + - image: circleci/ruby:2.6-stretch-node |
| 135 | + environment: *ruby_environment |
| 136 | + - image: circleci/postgres:10.6-alpine |
| 137 | + environment: |
| 138 | + POSTGRES_USER: root |
| 139 | + - image: circleci/redis:5-alpine |
| 140 | + <<: *test_steps |
| 141 | + |
| 142 | + test-ruby2.5: |
| 143 | + <<: *defaults |
| 144 | + docker: |
| 145 | + - image: circleci/ruby:2.5-stretch-node |
| 146 | + environment: *ruby_environment |
| 147 | + - image: circleci/postgres:10.6-alpine |
| 148 | + environment: |
| 149 | + POSTGRES_USER: root |
| 150 | + - image: circleci/redis:5-alpine |
| 151 | + <<: *test_steps |
| 152 | + |
| 153 | + test-ruby2.4: |
| 154 | + <<: *defaults |
| 155 | + docker: |
| 156 | + - image: circleci/ruby:2.4-stretch-node |
| 157 | + environment: *ruby_environment |
| 158 | + - image: circleci/postgres:10.6-alpine |
| 159 | + environment: |
| 160 | + POSTGRES_USER: root |
| 161 | + - image: circleci/redis:5-alpine |
| 162 | + <<: *test_steps |
| 163 | + |
| 164 | + test-webui: |
| 165 | + <<: *defaults |
| 166 | + docker: |
| 167 | + - image: circleci/node:12.9-stretch |
| 168 | + steps: |
| 169 | + - *attach_workspace |
| 170 | + - run: ./bin/retry yarn test:jest |
| 171 | + |
| 172 | + check-i18n: |
| 173 | + <<: *defaults |
| 174 | + steps: |
| 175 | + - *attach_workspace |
| 176 | + - *install_system_dependencies |
| 177 | + - run: bundle exec i18n-tasks check-normalized |
| 178 | + - run: bundle exec i18n-tasks unused -l en |
| 179 | + - run: bundle exec i18n-tasks check-consistent-interpolations |
| 180 | + - run: bundle exec rake repo:check_locales_files |
| 181 | + |
| 182 | +workflows: |
| 183 | + version: 2 |
| 184 | + build-and-test: |
| 185 | + jobs: |
| 186 | + - install |
| 187 | + - install-ruby2.6: |
| 188 | + requires: |
| 189 | + - install |
| 190 | + - install-ruby2.5: |
| 191 | + requires: |
| 192 | + - install |
| 193 | + - install-ruby2.6 |
| 194 | + - install-ruby2.4: |
| 195 | + requires: |
| 196 | + - install |
| 197 | + - install-ruby2.6 |
| 198 | + - build: |
| 199 | + requires: |
| 200 | + - install-ruby2.6 |
| 201 | + - test-ruby2.6: |
| 202 | + requires: |
| 203 | + - install-ruby2.6 |
| 204 | + - build |
| 205 | + - test-ruby2.5: |
| 206 | + requires: |
| 207 | + - install-ruby2.5 |
| 208 | + - build |
| 209 | + - test-ruby2.4: |
| 210 | + requires: |
| 211 | + - install-ruby2.4 |
| 212 | + - build |
| 213 | + - test-webui: |
| 214 | + requires: |
| 215 | + - install |
| 216 | + - check-i18n: |
| 217 | + requires: |
| 218 | + - install-ruby2.6 |
0 commit comments