File: .travis.rb

package info (click to toggle)
rubocop 0.52.1+dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,472 kB
  • sloc: ruby: 113,281; makefile: 9
file content (45 lines) | stat: -rw-r--r-- 1,042 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# frozen_string_literal: true

require 'English'
require 'benchmark'

def jruby?
  RUBY_ENGINE == 'jruby'
end

def master?
  ENV['TRAVIS_BRANCH'] == 'master' && ENV['TRAVIS_PULL_REQUEST'] == 'false'
end

def test?
  ENV['TASK'] != 'internal_investigation'
end

def sh!(command)
  puts "$ #{command}"
  time = Benchmark.realtime do
    system(command)
  end
  puts "#{time} seconds"
  puts
  raise "`#{command}` is failed" unless $CHILD_STATUS.success?
end

# Run main task(RSpec or RuboCop).
if master? || !test? || jruby?
  sh!("bundle exec rake #{ENV['TASK']}")
else
  sh!("bundle exec rake parallel:#{ENV['TASK']}")
end

# Report test coverage
sh!('bundle exec codeclimate-test-reporter') if master? && test?

# Running YARD under jruby crashes so skip checking manual under jruby
unless jruby?
  sh!('bundle exec rake documentation_syntax_check generate_cops_documentation')
end

# Check requiring libraries successfully.
# See https://github.com/bbatsov/rubocop/pull/4523#issuecomment-309136113
sh!("ruby -I lib -r rubocop -e 'exit 0'")