Replace Travis to CircleCI (#7196)

This commit is contained in:
Yamagishi Kazutoshi 2018-04-20 20:46:08 +09:00 committed by Eugen Rochko
parent 084cf0babf
commit 6f63cbb53c
2 changed files with 169 additions and 60 deletions

169
.circleci/config.yml Normal file
View File

@ -0,0 +1,169 @@
version: 2
aliases:
- &defaults
docker:
- image: circleci/ruby:2.5.1-stretch-node
environment: &ruby_environment
BUNDLE_APP_CONFIG: ./.bundle/
RAILS_ENV: test
NODE_ENV: test
DB_HOST: localhost
DB_USER: root
LOCAL_DOMAIN: cb6e6126.ngrok.io
LOCAL_HTTPS: true
PARALLEL_TEST_PROCESSORS: 2
ALLOW_NOPAM: true
working_directory: ~/projects/mastodon/
- &attach_workspace
attach_workspace:
at: ~/projects/
- &persist_to_workspace
persist_to_workspace:
root: ~/projects/
paths:
- ./mastodon/
- &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
- &install_ruby_dependencies
steps:
- *attach_workspace
- *install_system_dependencies
- run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
- restore_cache:
keys:
- v1-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
- v1-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-
- v1-ruby-dependencies--
- run: bundle install --clean --jobs 16 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without development production
- save_cache:
key: v1-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
paths:
- ./vendor/bundle/
- run:
name: Precompile Assets
command: |
if [ ! -d ./public/assets/ -o ! -d ./public/packs-test/ ]; then
./bin/rails assets:precompile
fi
- *persist_to_workspace
- &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: bundle exec parallel_test ./spec/ --group-by filesize --type rspec
jobs:
install:
<<: *defaults
<<: *install_steps
install-ruby2.5:
<<: *defaults
<<: *install_ruby_dependencies
install-ruby2.4:
<<: *defaults
docker:
- image: circleci/ruby:2.4.4-stretch-node
environment: *ruby_environment
<<: *install_ruby_dependencies
test-ruby2.5:
<<: *defaults
docker:
- image: circleci/ruby:2.5.1-stretch-node
environment: *ruby_environment
- image: circleci/postgres:10.3-alpine
environment:
POSTGRES_USER: root
- image: circleci/redis:4.0.9-alpine
<<: *test_steps
test-ruby2.4:
<<: *defaults
docker:
- image: circleci/ruby:2.4.4-stretch-node
environment: *ruby_environment
- image: circleci/postgres:10.3-alpine
environment:
POSTGRES_USER: root
- image: circleci/redis:4.0.9-alpine
<<: *test_steps
test-webui:
<<: *defaults
docker:
- image: circleci/node:8.11.1-stretch
steps:
- *attach_workspace
- run: yarn test:jest
check-i18n:
<<: *defaults
steps:
- *attach_workspace
- run: bundle exec i18n-tasks check-normalized
- run: bundle exec i18n-tasks unused
workflows:
version: 2
build-and-test:
jobs:
- install
- install-ruby2.5:
requires:
- install
- install-ruby2.4:
requires:
- install-ruby2.5
- test-ruby2.5:
requires:
- install-ruby2.5
- test-ruby2.4:
requires:
- install-ruby2.4
- test-webui:
requires:
- install
- check-i18n:
requires:
- install-ruby2.5

View File

@ -1,60 +0,0 @@
language: ruby
cache:
bundler: true
yarn: true
directories:
- node_modules
- public/assets
- public/packs-test
- tmp/cache/babel-loader
dist: trusty
sudo: false
branches:
only:
- master
notifications:
email: false
env:
global:
- LOCAL_DOMAIN=cb6e6126.ngrok.io
- LOCAL_HTTPS=true
- RAILS_ENV=test
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
- PARALLEL_TEST_PROCESSORS=2
- ALLOW_NOPAM=true
addons:
postgresql: 9.4
apt:
sources:
- trusty-media
- sourceline: deb https://dl.yarnpkg.com/debian/ stable main
key_url: https://dl.yarnpkg.com/debian/pubkey.gpg
packages:
- ffmpeg
- libicu-dev
- libprotobuf-dev
- protobuf-compiler
- yarn
rvm:
- 2.4.3
- 2.5.0
services:
- redis-server
install:
- nvm install
- bundle install --path=vendor/bundle --with pam_authentication --without development production --retry=3 --jobs=16
- yarn install
before_script:
- ./bin/rails parallel:create parallel:load_schema parallel:prepare assets:precompile
script:
- travis_retry bundle exec parallel_test spec/ --group-by filesize --type rspec
- yarn run test:jest
- bundle exec i18n-tasks check-normalized && bundle exec i18n-tasks unused