2018-04-20 21:46:08 +10:00
|
|
|
version: 2
|
|
|
|
|
|
|
|
aliases:
|
|
|
|
- &defaults
|
|
|
|
docker:
|
2020-01-10 15:34:25 +11:00
|
|
|
- image: circleci/ruby:2.7-buster-node
|
2018-04-20 21:46:08 +10:00
|
|
|
environment: &ruby_environment
|
2020-05-02 04:19:01 +10:00
|
|
|
BUNDLE_JOBS: 3
|
|
|
|
BUNDLE_RETRY: 3
|
2018-04-20 21:46:08 +10:00
|
|
|
BUNDLE_APP_CONFIG: ./.bundle/
|
2020-03-09 01:45:19 +11:00
|
|
|
BUNDLE_PATH: ./vendor/bundle/
|
2018-04-20 21:46:08 +10:00
|
|
|
DB_HOST: localhost
|
|
|
|
DB_USER: root
|
2018-04-22 05:36:22 +10:00
|
|
|
RAILS_ENV: test
|
2018-04-20 21:46:08 +10:00
|
|
|
ALLOW_NOPAM: true
|
2018-05-11 19:51:07 +10:00
|
|
|
CONTINUOUS_INTEGRATION: true
|
2018-05-10 00:59:58 +10:00
|
|
|
DISABLE_SIMPLECOV: true
|
2018-10-25 10:17:01 +11:00
|
|
|
PAM_ENABLED: true
|
|
|
|
PAM_DEFAULT_SERVICE: pam_test
|
2018-10-21 02:28:04 +11:00
|
|
|
PAM_CONTROLLED_SERVICE: pam_test_controlled
|
2018-04-20 21:46:08 +10:00
|
|
|
working_directory: ~/projects/mastodon/
|
|
|
|
|
|
|
|
- &attach_workspace
|
|
|
|
attach_workspace:
|
|
|
|
at: ~/projects/
|
|
|
|
|
|
|
|
- &persist_to_workspace
|
|
|
|
persist_to_workspace:
|
|
|
|
root: ~/projects/
|
|
|
|
paths:
|
|
|
|
- ./mastodon/
|
|
|
|
|
2018-04-23 17:16:26 +10:00
|
|
|
- &restore_ruby_dependencies
|
|
|
|
restore_cache:
|
|
|
|
keys:
|
2020-05-02 07:45:40 +10:00
|
|
|
- v3-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
|
|
|
|
- v3-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-
|
|
|
|
- v3-ruby-dependencies-
|
2018-04-23 17:16:26 +10:00
|
|
|
|
2018-04-20 21:46:08 +10:00
|
|
|
- &install_steps
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- *attach_workspace
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
2020-05-02 07:45:40 +10:00
|
|
|
- v2-node-dependencies-{{ checksum "yarn.lock" }}
|
|
|
|
- v2-node-dependencies-
|
2020-05-02 04:19:01 +10:00
|
|
|
- run:
|
|
|
|
name: Install yarn dependencies
|
|
|
|
command: yarn install --frozen-lockfile
|
2018-04-20 21:46:08 +10:00
|
|
|
- save_cache:
|
2020-05-02 07:45:40 +10:00
|
|
|
key: v2-node-dependencies-{{ checksum "yarn.lock" }}
|
2018-04-20 21:46:08 +10:00
|
|
|
paths:
|
|
|
|
- ./node_modules/
|
|
|
|
- *persist_to_workspace
|
|
|
|
|
|
|
|
- &install_system_dependencies
|
|
|
|
run:
|
|
|
|
name: Install system dependencies
|
|
|
|
command: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y libicu-dev libidn11-dev libprotobuf-dev protobuf-compiler
|
2020-05-02 04:19:01 +10:00
|
|
|
|
2018-04-20 21:46:08 +10:00
|
|
|
- &install_ruby_dependencies
|
|
|
|
steps:
|
|
|
|
- *attach_workspace
|
|
|
|
- *install_system_dependencies
|
2020-05-02 04:19:01 +10:00
|
|
|
- run:
|
|
|
|
name: Set Ruby version
|
|
|
|
command: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
|
2018-04-23 17:16:26 +10:00
|
|
|
- *restore_ruby_dependencies
|
2020-05-02 04:19:01 +10:00
|
|
|
- run:
|
|
|
|
name: Set bundler settings
|
|
|
|
command: |
|
|
|
|
bundle config clean 'true'
|
|
|
|
bundle config deployment 'true'
|
|
|
|
bundle config with 'pam_authentication'
|
|
|
|
bundle config without 'development production'
|
|
|
|
bundle config frozen 'true'
|
|
|
|
- run:
|
|
|
|
name: Install bundler dependencies
|
|
|
|
command: bundle check || (bundle install && bundle clean)
|
2018-04-20 21:46:08 +10:00
|
|
|
- save_cache:
|
2020-05-02 07:45:40 +10:00
|
|
|
key: v3-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
|
2018-04-20 21:46:08 +10:00
|
|
|
paths:
|
2018-04-23 17:16:26 +10:00
|
|
|
- ./.bundle/
|
2018-04-20 21:46:08 +10:00
|
|
|
- ./vendor/bundle/
|
2018-08-18 12:05:42 +10:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: ~/projects/
|
|
|
|
paths:
|
|
|
|
- ./mastodon/.bundle/
|
|
|
|
- ./mastodon/vendor/bundle/
|
2018-04-20 21:46:08 +10:00
|
|
|
|
|
|
|
- &test_steps
|
2020-05-02 04:19:01 +10:00
|
|
|
parallelism: 4
|
2018-04-20 21:46:08 +10:00
|
|
|
steps:
|
|
|
|
- *attach_workspace
|
|
|
|
- *install_system_dependencies
|
|
|
|
- run:
|
2020-05-02 04:19:01 +10:00
|
|
|
name: Install FFMPEG
|
|
|
|
command: sudo apt-get install -y ffmpeg
|
2018-04-20 21:46:08 +10:00
|
|
|
- run:
|
2020-05-02 04:19:01 +10:00
|
|
|
name: Load database schema
|
|
|
|
command: ./bin/rails db:create db:schema:load db:seed
|
|
|
|
- run:
|
|
|
|
name: Run rspec in parallel
|
|
|
|
command: |
|
|
|
|
bundle exec rspec --profile 10 \
|
|
|
|
--format RspecJunitFormatter \
|
|
|
|
--out test_results/rspec.xml \
|
|
|
|
--format progress \
|
|
|
|
$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
|
|
|
|
- store_test_results:
|
|
|
|
path: test_results
|
2018-04-20 21:46:08 +10:00
|
|
|
jobs:
|
|
|
|
install:
|
|
|
|
<<: *defaults
|
|
|
|
<<: *install_steps
|
|
|
|
|
2020-01-10 15:34:25 +11:00
|
|
|
install-ruby2.7:
|
|
|
|
<<: *defaults
|
|
|
|
<<: *install_ruby_dependencies
|
|
|
|
|
2018-12-29 17:23:07 +11:00
|
|
|
install-ruby2.6:
|
2018-04-20 21:46:08 +10:00
|
|
|
<<: *defaults
|
2020-01-10 15:34:25 +11:00
|
|
|
docker:
|
|
|
|
- image: circleci/ruby:2.6-buster-node
|
|
|
|
environment: *ruby_environment
|
2018-04-20 21:46:08 +10:00
|
|
|
<<: *install_ruby_dependencies
|
|
|
|
|
2018-04-23 17:16:26 +10:00
|
|
|
build:
|
|
|
|
<<: *defaults
|
|
|
|
steps:
|
|
|
|
- *attach_workspace
|
|
|
|
- *install_system_dependencies
|
2020-05-02 04:19:01 +10:00
|
|
|
- run:
|
|
|
|
name: Precompile assets
|
|
|
|
command: ./bin/rails assets:precompile
|
2018-07-31 06:22:55 +10:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: ~/projects/
|
2018-04-23 17:16:26 +10:00
|
|
|
paths:
|
2018-07-31 06:22:55 +10:00
|
|
|
- ./mastodon/public/assets
|
|
|
|
- ./mastodon/public/packs-test/
|
2018-04-23 17:16:26 +10:00
|
|
|
|
2020-01-11 12:04:57 +11:00
|
|
|
test-migrations:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
|
|
|
- image: circleci/ruby:2.7-buster-node
|
|
|
|
environment: *ruby_environment
|
2020-04-05 00:52:42 +11:00
|
|
|
- image: circleci/postgres:12.2
|
2020-01-11 12:04:57 +11:00
|
|
|
environment:
|
|
|
|
POSTGRES_USER: root
|
2020-04-05 00:52:42 +11:00
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
2020-01-11 12:04:57 +11:00
|
|
|
- image: circleci/redis:5-alpine
|
|
|
|
steps:
|
|
|
|
- *attach_workspace
|
|
|
|
- *install_system_dependencies
|
|
|
|
- run:
|
|
|
|
name: Create database
|
2020-05-02 04:19:01 +10:00
|
|
|
command: ./bin/rails db:create
|
2020-01-11 12:04:57 +11:00
|
|
|
- run:
|
|
|
|
name: Run migrations
|
2020-05-02 04:19:01 +10:00
|
|
|
command: ./bin/rails db:migrate
|
2020-01-11 12:04:57 +11:00
|
|
|
|
2020-01-10 15:34:25 +11:00
|
|
|
test-ruby2.7:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
|
|
|
- image: circleci/ruby:2.7-buster-node
|
|
|
|
environment: *ruby_environment
|
2020-04-05 00:52:42 +11:00
|
|
|
- image: circleci/postgres:12.2
|
2020-01-10 15:34:25 +11:00
|
|
|
environment:
|
|
|
|
POSTGRES_USER: root
|
2020-04-05 00:52:42 +11:00
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
2020-01-10 15:34:25 +11:00
|
|
|
- image: circleci/redis:5-alpine
|
|
|
|
<<: *test_steps
|
|
|
|
|
2018-12-29 17:23:07 +11:00
|
|
|
test-ruby2.6:
|
2018-04-20 21:46:08 +10:00
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2019-12-30 03:00:43 +11:00
|
|
|
- image: circleci/ruby:2.6-buster-node
|
2018-04-20 21:46:08 +10:00
|
|
|
environment: *ruby_environment
|
2020-04-05 00:52:42 +11:00
|
|
|
- image: circleci/postgres:12.2
|
2018-04-20 21:46:08 +10:00
|
|
|
environment:
|
|
|
|
POSTGRES_USER: root
|
2020-04-05 00:52:42 +11:00
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
2019-08-31 00:59:11 +10:00
|
|
|
- image: circleci/redis:5-alpine
|
2018-04-20 21:46:08 +10:00
|
|
|
<<: *test_steps
|
|
|
|
|
|
|
|
test-webui:
|
|
|
|
<<: *defaults
|
|
|
|
docker:
|
2019-12-30 03:00:43 +11:00
|
|
|
- image: circleci/node:12-buster
|
2018-04-20 21:46:08 +10:00
|
|
|
steps:
|
|
|
|
- *attach_workspace
|
2020-05-02 04:19:01 +10:00
|
|
|
- run:
|
|
|
|
name: Run jest
|
|
|
|
command: yarn test:jest
|
2018-04-20 21:46:08 +10:00
|
|
|
|
|
|
|
check-i18n:
|
|
|
|
<<: *defaults
|
|
|
|
steps:
|
|
|
|
- *attach_workspace
|
2019-09-12 12:58:33 +10:00
|
|
|
- *install_system_dependencies
|
2020-05-02 04:19:01 +10:00
|
|
|
- run:
|
|
|
|
name: Check locale file normalization
|
|
|
|
command: bundle exec i18n-tasks check-normalized
|
|
|
|
- run:
|
|
|
|
name: Check for unused strings
|
|
|
|
command: bundle exec i18n-tasks unused -l en
|
|
|
|
- run:
|
|
|
|
name: Check for wrong string interpolations
|
|
|
|
command: bundle exec i18n-tasks check-consistent-interpolations
|
|
|
|
- run:
|
|
|
|
name: Check that all required locale files exist
|
|
|
|
command: bundle exec rake repo:check_locales_files
|
2018-04-20 21:46:08 +10:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build-and-test:
|
|
|
|
jobs:
|
|
|
|
- install
|
2020-01-10 15:34:25 +11:00
|
|
|
- install-ruby2.7:
|
|
|
|
requires:
|
|
|
|
- install
|
2018-12-29 17:23:07 +11:00
|
|
|
- install-ruby2.6:
|
2018-04-20 21:46:08 +10:00
|
|
|
requires:
|
|
|
|
- install
|
2020-01-10 15:34:25 +11:00
|
|
|
- install-ruby2.7
|
2018-04-23 17:16:26 +10:00
|
|
|
- build:
|
2018-04-20 21:46:08 +10:00
|
|
|
requires:
|
2020-01-10 15:34:25 +11:00
|
|
|
- install-ruby2.7
|
2020-01-11 12:04:57 +11:00
|
|
|
- test-migrations:
|
|
|
|
requires:
|
|
|
|
- install-ruby2.7
|
2020-01-10 15:34:25 +11:00
|
|
|
- test-ruby2.7:
|
|
|
|
requires:
|
|
|
|
- install-ruby2.7
|
|
|
|
- build
|
2018-12-29 17:23:07 +11:00
|
|
|
- test-ruby2.6:
|
|
|
|
requires:
|
|
|
|
- install-ruby2.6
|
|
|
|
- build
|
2018-04-20 21:46:08 +10:00
|
|
|
- test-webui:
|
|
|
|
requires:
|
|
|
|
- install
|
|
|
|
- check-i18n:
|
|
|
|
requires:
|
2020-01-10 15:34:25 +11:00
|
|
|
- install-ruby2.7
|