1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00
mastodon/.circleci/config.yml

251 lines
6.9 KiB
YAML
Raw Normal View History

2018-04-20 04:46:08 -07:00
version: 2
aliases:
- &defaults
docker:
- image: circleci/ruby:2.7-buster-node
2018-04-20 04:46:08 -07:00
environment: &ruby_environment
BUNDLE_APP_CONFIG: ./.bundle/
2020-03-08 07:45:19 -07:00
BUNDLE_PATH: ./vendor/bundle/
2018-04-20 04:46:08 -07:00
DB_HOST: localhost
DB_USER: root
2018-04-21 12:36:22 -07:00
RAILS_ENV: test
PARALLEL_TEST_PROCESSORS: 4
2018-04-20 04:46:08 -07:00
ALLOW_NOPAM: true
CONTINUOUS_INTEGRATION: true
DISABLE_SIMPLECOV: true
PAM_ENABLED: true
PAM_DEFAULT_SERVICE: pam_test
PAM_CONTROLLED_SERVICE: pam_test_controlled
2018-04-20 04:46:08 -07:00
working_directory: ~/projects/mastodon/
- &attach_workspace
attach_workspace:
at: ~/projects/
- &persist_to_workspace
persist_to_workspace:
root: ~/projects/
paths:
- ./mastodon/
- &restore_ruby_dependencies
restore_cache:
keys:
- v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
- v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-
- v2-ruby-dependencies-
2018-04-20 04:46:08 -07:00
- &install_steps
steps:
- checkout
- *attach_workspace
- restore_cache:
keys:
- v1-node-dependencies-{{ checksum "yarn.lock" }}
- v1-node-dependencies-
- run: yarn install --frozen-lockfile
- save_cache:
key: v1-node-dependencies-{{ checksum "yarn.lock" }}
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
## TODO: FIX THESE BUSTER DEPENDANCES
sudo wget http://ftp.au.debian.org/debian/pool/main/i/icu/libicu57_57.1-6+deb9u3_amd64.deb
sudo dpkg -i libicu57_57.1-6+deb9u3_amd64.deb
sudo wget http://ftp.au.debian.org/debian/pool/main/p/protobuf/libprotobuf10_3.0.0-9_amd64.deb
sudo dpkg -i libprotobuf10_3.0.0-9_amd64.deb
2018-04-20 04:46:08 -07:00
- &install_ruby_dependencies
steps:
- *attach_workspace
- *install_system_dependencies
- run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
- *restore_ruby_dependencies
- run: bundle config set clean 'true'
- run: bundle config set deployment 'true'
- run: bundle config set with 'pam_authentication'
- run: bundle config set without 'development production'
- run: bundle config set frozen 'true'
- run: bundle install --jobs 16 --retry 3 && bundle clean
2018-04-20 04:46:08 -07:00
- save_cache:
key: v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
2018-04-20 04:46:08 -07:00
paths:
- ./.bundle/
2018-04-20 04:46:08 -07:00
- ./vendor/bundle/
- persist_to_workspace:
root: ~/projects/
paths:
- ./mastodon/.bundle/
- ./mastodon/vendor/bundle/
2018-04-20 04:46:08 -07:00
- &test_steps
steps:
- *attach_workspace
- *install_system_dependencies
- run: sudo apt-get install -y ffmpeg
- run:
name: Prepare Tests
command: ./bin/rails parallel:create parallel:load_schema parallel:prepare
- run:
name: Run Tests
command: ./bin/retry bundle exec parallel_test ./spec/ --group-by filesize --type rspec
2018-04-20 04:46:08 -07:00
jobs:
install:
<<: *defaults
<<: *install_steps
install-ruby2.7:
<<: *defaults
<<: *install_ruby_dependencies
install-ruby2.6:
2018-04-20 04:46:08 -07:00
<<: *defaults
docker:
- image: circleci/ruby:2.6-buster-node
environment: *ruby_environment
2018-04-20 04:46:08 -07:00
<<: *install_ruby_dependencies
install-ruby2.5:
2018-04-20 04:46:08 -07:00
<<: *defaults
docker:
- image: circleci/ruby:2.5-buster-node
2018-04-20 04:46:08 -07:00
environment: *ruby_environment
<<: *install_ruby_dependencies
build:
<<: *defaults
steps:
- *attach_workspace
- *install_system_dependencies
- run: ./bin/rails assets:precompile
- persist_to_workspace:
root: ~/projects/
paths:
- ./mastodon/public/assets
- ./mastodon/public/packs-test/
test-migrations:
<<: *defaults
docker:
- image: circleci/ruby:2.7-buster-node
environment: *ruby_environment
2020-04-04 06:52:42 -07:00
- image: circleci/postgres:12.2
environment:
POSTGRES_USER: root
2020-04-04 06:52:42 -07:00
POSTGRES_HOST_AUTH_METHOD: trust
- image: circleci/redis:5-alpine
steps:
- *attach_workspace
- *install_system_dependencies
- run:
name: Create database
command: ./bin/rails parallel:create
- run:
name: Run migrations
command: ./bin/rails parallel:migrate
test-ruby2.7:
<<: *defaults
docker:
- image: circleci/ruby:2.7-buster-node
environment: *ruby_environment
2020-04-04 06:52:42 -07:00
- image: circleci/postgres:12.2
environment:
POSTGRES_USER: root
2020-04-04 06:52:42 -07:00
POSTGRES_HOST_AUTH_METHOD: trust
- image: circleci/redis:5-alpine
<<: *test_steps
test-ruby2.6:
2018-04-20 04:46:08 -07:00
<<: *defaults
docker:
- image: circleci/ruby:2.6-buster-node
2018-04-20 04:46:08 -07:00
environment: *ruby_environment
2020-04-04 06:52:42 -07:00
- image: circleci/postgres:12.2
2018-04-20 04:46:08 -07:00
environment:
POSTGRES_USER: root
2020-04-04 06:52:42 -07:00
POSTGRES_HOST_AUTH_METHOD: trust
- image: circleci/redis:5-alpine
2018-04-20 04:46:08 -07:00
<<: *test_steps
test-ruby2.5:
2018-04-20 04:46:08 -07:00
<<: *defaults
docker:
- image: circleci/ruby:2.5-buster-node
2018-04-20 04:46:08 -07:00
environment: *ruby_environment
2020-04-04 06:52:42 -07:00
- image: circleci/postgres:12.2
2018-04-20 04:46:08 -07:00
environment:
POSTGRES_USER: root
2020-04-04 06:52:42 -07:00
POSTGRES_HOST_AUTH_METHOD: trust
- image: circleci/redis:5-alpine
2018-04-20 04:46:08 -07:00
<<: *test_steps
test-webui:
<<: *defaults
docker:
- image: circleci/node:12-buster
2018-04-20 04:46:08 -07:00
steps:
- *attach_workspace
- run: ./bin/retry yarn test:jest
2018-04-20 04:46:08 -07:00
check-i18n:
<<: *defaults
steps:
- *attach_workspace
- *install_system_dependencies
2018-04-20 04:46:08 -07:00
- run: bundle exec i18n-tasks check-normalized
- run: bundle exec i18n-tasks unused -l en
- run: bundle exec i18n-tasks check-consistent-interpolations
- run: bundle exec rake repo:check_locales_files
2018-04-20 04:46:08 -07:00
workflows:
version: 2
build-and-test:
jobs:
- install
- install-ruby2.7:
requires:
- install
- install-ruby2.6:
2018-04-20 04:46:08 -07:00
requires:
- install
- install-ruby2.7
- install-ruby2.5:
requires:
- install
- install-ruby2.7
- build:
2018-04-20 04:46:08 -07:00
requires:
- install-ruby2.7
- test-migrations:
requires:
- install-ruby2.7
- test-ruby2.7:
requires:
- install-ruby2.7
- build
- test-ruby2.6:
requires:
- install-ruby2.6
- build
2018-04-20 04:46:08 -07:00
- test-ruby2.5:
requires:
- install-ruby2.5
- build
2018-04-20 04:46:08 -07:00
- test-webui:
requires:
- install
- check-i18n:
requires:
- install-ruby2.7