Skip to content

Commit a0f15a1

Browse files
committed
[GR-19220] Run jt lint in TravisCI for Pull Requests.
PullRequest: truffleruby/1166
2 parents 4bf3272 + c89a9db commit a0f15a1

File tree

3 files changed

+35
-17
lines changed

3 files changed

+35
-17
lines changed

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: ruby
2+
rvm: 2.6.2
3+
install:
4+
- tool/jt.rb install jvmci
5+
- tool/jt.rb mx sforceimports
6+
- tool/jt.rb build
7+
- gem install rubocop:0.66.0
8+
script:
9+
- tool/jt.rb lint
10+
cache:
11+
directories:
12+
- $HOME/.mx/cache

test/truffle/ecosystem/blog-shared.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ alias truffleruby="jt ruby -S"
2222

2323
set -xe
2424

25-
if [ "$2" != "--no-gem-test-pack" ]; then
26-
gem_test_pack_path="$(jt gem-test-pack)"
27-
fi
25+
gem_test_pack_path="$2"
2826

2927
cd "test/truffle/ecosystem/$1"
3028

tool/jt.rb

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,6 @@ def help
579579
jt test bundle [--jdebug] tests using bundler
580580
jt test gems [TESTS] tests using gems
581581
jt test ecosystem [TESTS] [options] tests using the wider ecosystem such as bundler, Rails, etc
582-
--no-gem-test-pack run without gem test pack
583582
jt test cexts [--no-openssl] [--no-gems] [test_names...]
584583
run C extension tests (set GEM_HOME)
585584
jt test unit run Java unittests
@@ -1210,8 +1209,7 @@ def retag(*args)
12101209
end
12111210

12121211
private def test_ecosystem(*args)
1213-
use_gem_test_pack = !args.delete('--no-gem-test-pack')
1214-
gem_test_pack if use_gem_test_pack
1212+
gem_test_pack if gem_test_pack?
12151213

12161214
tests_path = "#{TRUFFLERUBY_DIR}/test/truffle/ecosystem"
12171215
single_test = !args.empty?
@@ -1233,7 +1231,7 @@ def retag(*args)
12331231

12341232
success = candidates.all? do |test_script|
12351233
next true if test_script.end_with? 'shared.sh'
1236-
sh test_script, *('--no-gem-test-pack' unless use_gem_test_pack), continue_on_failure: true
1234+
sh test_script, *(gem_test_pack if gem_test_pack?), continue_on_failure: true
12371235
end
12381236
exit success
12391237
end
@@ -1354,14 +1352,19 @@ def mspec(*args)
13541352
run_mspec env_vars, command, *options, *prefixed_ruby_args, *args
13551353
end
13561354

1355+
def gem_test_pack?
1356+
return true if ci?
1357+
Dir.exist?(File.expand_path('truffleruby-gem-test-pack', TRUFFLERUBY_DIR))
1358+
end
1359+
13571360
def gem_test_pack
13581361
name = 'truffleruby-gem-test-pack'
13591362
gem_test_pack = File.expand_path(name, TRUFFLERUBY_DIR)
13601363

13611364
unless Dir.exist?(gem_test_pack)
13621365
$stderr.puts 'Cloning the truffleruby-gem-test-pack repository'
13631366
unless Remotes.bitbucket
1364-
abort 'Need a git remote in truffleruby with the internal repository URL or use --no-gem-test-pack option'
1367+
abort 'Need a git remote in truffleruby with the internal repository URL'
13651368
end
13661369
url = Remotes.url(Remotes.bitbucket).sub('truffleruby', name)
13671370
sh 'git', 'clone', url
@@ -1951,16 +1954,21 @@ def native_launcher
19511954
alias :'native-launcher' :native_launcher
19521955

19531956
def rubocop(*args)
1954-
gem_home = "#{gem_test_pack}/rubocop-gems"
1955-
env = {
1956-
'GEM_HOME' => gem_home,
1957-
'GEM_PATH' => gem_home,
1958-
'PATH' => "#{gem_home}/bin:#{ENV['PATH']}"
1959-
}
19601957
if args.empty? or args.all? { |arg| arg.start_with?('-') }
19611958
args += RUBOCOP_INCLUDE_LIST
19621959
end
1963-
sh env, 'ruby', "#{gem_home}/bin/rubocop", *args
1960+
1961+
if gem_test_pack?
1962+
gem_home = "#{gem_test_pack}/rubocop-gems"
1963+
env = {
1964+
'GEM_HOME' => gem_home,
1965+
'GEM_PATH' => gem_home,
1966+
'PATH' => "#{gem_home}/bin:#{ENV['PATH']}"
1967+
}
1968+
sh env, 'ruby', "#{gem_home}/bin/rubocop", *args
1969+
else
1970+
sh 'rubocop', '_0.66.0_', *args
1971+
end
19641972
end
19651973

19661974
def command_format(*args)
@@ -2065,7 +2073,7 @@ def make_specializations_protected
20652073
new_content << line
20662074
end
20672075
else
2068-
looking = line.match?(/^ *@(Specialization|Fallback|CreateCast)/)
2076+
looking = /^ *@(Specialization|Fallback|CreateCast)/ =~ line
20692077
new_content << line
20702078
if looking
20712079
braces = count_braces.(line)
@@ -2082,7 +2090,7 @@ def make_specializations_protected
20822090
changed
20832091
end
20842092

2085-
def lint(*args)
2093+
def lint
20862094
check_filename_length
20872095
rubocop
20882096
sh 'tool/lint.sh'

0 commit comments

Comments
 (0)