Merge pull request #5059 from tgxworld/run_lint_in_another_job

Run lint in a parallel job on Travis.
This commit is contained in:
Guo Xiang Tan 2017-08-18 15:44:17 +09:00 committed by GitHub
commit f99c00a0ef
2 changed files with 25 additions and 16 deletions

View File

@ -5,8 +5,9 @@ env:
- DISCOURSE_HOSTNAME=www.example.com - DISCOURSE_HOSTNAME=www.example.com
- RUBY_GC_MALLOC_LIMIT=50000000 - RUBY_GC_MALLOC_LIMIT=50000000
matrix: matrix:
- "RAILS_MASTER=0 QUNIT_RUN=0" - "RAILS_MASTER=0 QUNIT_RUN=0 RUN_LINT=0"
- "RAILS_MASTER=0 QUNIT_RUN=1" - "RAILS_MASTER=0 QUNIT_RUN=1 RUN_LINT=0"
- "RAILS_MASTER=0 QUNIT_RUN=0 RUN_LINT=1"
addons: addons:
postgresql: 9.5 postgresql: 9.5
@ -36,27 +37,35 @@ cache:
- vendor/bundle - vendor/bundle
before_install: before_install:
- gem install bundler rubocop - gem install bundler
- git clone --depth=1 https://github.com/discourse/discourse-backup-uploads-to-s3.git plugins/discourse-backup-uploads-to-s3 - git clone --depth=1 https://github.com/discourse/discourse-backup-uploads-to-s3.git plugins/discourse-backup-uploads-to-s3
- git clone --depth=1 https://github.com/discourse/discourse-spoiler-alert.git plugins/discourse-spoiler-alert - git clone --depth=1 https://github.com/discourse/discourse-spoiler-alert.git plugins/discourse-spoiler-alert
- git clone --depth=1 https://github.com/discourse/discourse-cakeday.git plugins/discourse-cakeday - git clone --depth=1 https://github.com/discourse/discourse-cakeday.git plugins/discourse-cakeday
- git clone --depth=1 https://github.com/discourse/discourse-canned-replies.git plugins/discourse-canned-replies - git clone --depth=1 https://github.com/discourse/discourse-canned-replies.git plugins/discourse-canned-replies
- git clone --depth=1 https://github.com/discourse/discourse-slack-official.git plugins/discourse-slack-official - git clone --depth=1 https://github.com/discourse/discourse-slack-official.git plugins/discourse-slack-official
- yarn global add eslint babel-eslint
- eslint app/assets/javascripts
- eslint --ext .es6 app/assets/javascripts
- eslint --ext .es6 test/javascripts
- eslint --ext .es6 plugins/**/assets/javascripts
- eslint --ext .es6 plugins/**/test/javascripts
- eslint test/javascripts
- rubocop --parallel
before_script:
- bundle exec rake db:create db:migrate
install: install:
- bash -c "if [ '$RAILS_MASTER' == '1' ]; then bundle update --retry=3 --jobs=3 arel rails seed-fu; fi" - bash -c "if [ '$RAILS_MASTER' == '1' ]; then bundle update --retry=3 --jobs=3 arel rails seed-fu; fi"
- bash -c "if [ '$RAILS_MASTER' == '0' ]; then bundle install --without development --deployment --retry=3 --jobs=3; fi" - bash -c "if [ '$RAILS_MASTER' == '0' ]; then bundle install --without development --deployment --retry=3 --jobs=3; fi"
- bash -c "if [ '$RUN_LINT' == '1' ]; then yarn global add eslint babel-eslint; fi"
script: script:
- bash -c "if [ '$QUNIT_RUN' == '0' ]; then bundle exec rspec && bundle exec rake plugin:spec; else LOAD_PLUGINS=1 bundle exec rake qunit:test['300000']; fi" - |
bash -c "
if [ '$RUN_LINT' == '1' ]; then
bundle exec rubocop --parallel && \
eslint --ext .es6 app/assets/javascripts && \
eslint --ext .es6 test/javascripts && \
eslint --ext .es6 plugins/**/assets/javascripts && \
eslint --ext .es6 plugins/**/test/javascripts && \
eslint app/assets/javascripts test/javascripts
else
bundle exec rake db:create db:migrate
if [ '$QUNIT_RUN' == '1' ]; then
LOAD_PLUGINS=1 bundle exec rake qunit:test['300000']
else
bundle exec rspec && bundle exec rake plugin:spec
fi
fi
"

View File

@ -140,6 +140,7 @@ group :test, :development do
gem 'rspec-html-matchers' gem 'rspec-html-matchers'
gem 'pry-nav' gem 'pry-nav'
gem 'byebug', require: ENV['RM_INFO'].nil? gem 'byebug', require: ENV['RM_INFO'].nil?
gem 'rubocop', require: false
end end
group :development do group :development do
@ -148,7 +149,6 @@ group :development do
gem 'binding_of_caller' gem 'binding_of_caller'
gem 'annotate' gem 'annotate'
gem 'foreman', require: false gem 'foreman', require: false
gem 'rubocop', require: false
end end
# this is an optional gem, it provides a high performance replacement # this is an optional gem, it provides a high performance replacement