Skip to content

Commit efe9d33

Browse files
authored
Merge pull request #127 from rock-core/run_workflows_on_ruby3
run github workflows on ruby 3.0
2 parents dd2d426 + 8e16f35 commit efe9d33

File tree

6 files changed

+55
-29
lines changed

6 files changed

+55
-29
lines changed

.github/workflows/lint.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ jobs:
88

99
strategy:
1010
matrix:
11-
ruby-version: ["2.7", "2.6", "2.5"]
11+
ruby-version:
12+
- "3.0"
13+
- "2.7"
1214

1315
steps:
1416
- uses: actions/checkout@v2

.github/workflows/test.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ jobs:
88

99
strategy:
1010
matrix:
11-
ruby-version: ["2.7", "2.6", "2.5"]
11+
ruby-version:
12+
- "3.0"
13+
- "2.7"
14+
- "2.5"
1215

1316
steps:
1417
- uses: actions/checkout@v2

autobuild.gemspec

+3-7
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,17 @@ Gem::Specification.new do |s|
2424
.reject { |f| f.match(%r{^(test|spec|features)/}) }
2525

2626
s.add_runtime_dependency "concurrent-ruby", "~> 1.1"
27-
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.1.0")
28-
s.add_runtime_dependency "net-smtp"
29-
end
27+
s.add_runtime_dependency "net-smtp"
3028
s.add_runtime_dependency "pastel", "~> 0.7.0"
3129
s.add_runtime_dependency "rake", "~> 13.0"
3230
s.add_runtime_dependency 'tty-cursor', '~> 0.7.0'
3331
s.add_runtime_dependency 'tty-prompt', '~> 0.21.0'
3432
s.add_runtime_dependency 'tty-screen', '~> 0.8.0'
3533
s.add_runtime_dependency "utilrb", "~> 3.0", ">= 3.0"
3634
s.add_development_dependency "fakefs"
37-
s.add_development_dependency "flexmock", '~> 2.0', ">= 2.0.0"
35+
s.add_development_dependency "flexmock", ">= 2.4.0"
3836
s.add_development_dependency "minitest", "~> 5.0", ">= 5.0"
3937
s.add_development_dependency "simplecov"
4038
s.add_development_dependency "timecop"
41-
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0.0")
42-
s.add_development_dependency "webrick"
43-
end
39+
s.add_development_dependency "webrick"
4440
end

test/import/test_git.rb

+27-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@
44
attr_reader :pkg, :importer, :gitrepo
55

66
before do
7+
xdg_config_home = make_tmpdir
8+
git_config = File.join(xdg_config_home, "git", "config")
9+
FileUtils.mkdir_p File.dirname(git_config)
10+
@current_xdg_config_home = ENV["XDG_CONFIG_HOME"]
11+
ENV["XDG_CONFIG_HOME"] = xdg_config_home
12+
13+
File.write(git_config, <<~GIT_CONFIG)
14+
[user]
15+
16+
name = Someone
17+
18+
[protocol "file"]
19+
allow = always
20+
GIT_CONFIG
21+
22+
unless system("git", "config", "--global", "protocol.file.allow", "always")
23+
raise "could not set up temporary global git configuration"
24+
end
25+
726
tempdir = untar('gitrepo.tar')
827
@gitrepo = File.join(tempdir, 'gitrepo.git')
928
@pkg = Autobuild::Package.new 'test'
@@ -12,6 +31,10 @@
1231
pkg.importer = importer
1332
end
1433

34+
after do
35+
ENV["XDG_CONFIG_HOME"] = @current_xdg_config_home
36+
end
37+
1538
describe "#initialize" do
1639
it "allows passing the branch as second argument for backward-compatibility way" do
1740
Autobuild.silent = true
@@ -275,7 +298,7 @@
275298
any, :import, 'git', 'clone', '-o', 'autobuild',
276299
File.join(tempdir, 'gitrepo.git'),
277300
File.join(tempdir, 'git'), any
278-
)
301+
).with_any_kw_args
279302

280303
flexmock(Autobuild::Subprocess).should_receive(:run).pass_thru
281304

@@ -297,7 +320,7 @@ def assert_clone(*args)
297320
any, :import, 'git', 'clone', '-o', 'autobuild', *args,
298321
File.join(tempdir, 'gitrepo.git'),
299322
File.join(tempdir, 'git'), any
300-
).once.pass_thru
323+
).with_any_kw_args.once.pass_thru
301324

302325
flexmock(Autobuild::Subprocess).should_receive(:run).pass_thru
303326
end
@@ -992,6 +1015,7 @@ def pin_importer(id, options = Hash.new)
9921015
.should_receive(:run)
9931016
.with(any, :import, 'git', '--git-dir', File.join(pkg.srcdir, ".git"),
9941017
'symbolic-ref', "refs/remotes/autobuild/HEAD", any)
1018+
.with_any_kw_args
9951019
.once
9961020
.and_return(['refs/remotes/autobuild/temp/branch', 'bla'])
9971021
flexmock(Autobuild::Subprocess).should_receive(:run).pass_thru
@@ -1027,6 +1051,7 @@ def pin_importer(id, options = Hash.new)
10271051
any, :import, 'git', 'ls-remote', '--symref',
10281052
File.join(tempdir, 'gitrepo-nomaster.git'), any
10291053
)
1054+
.with_any_kw_args
10301055
.once
10311056
.and_return(['ref: refs/heads/temp/branch HEAD', 'bla'])
10321057
flexmock(Autobuild::Subprocess).should_receive(:run).pass_thru

test/packages/test_autotools.rb

+16-16
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ def touch_in_srcdir(*dirs, file)
231231
working_directory: @package.srcdir).once.globally.ordered
232232
@package.should_receive(:run).with(any, "/my/autogen/script",
233233
working_directory: @package.srcdir).once.globally.ordered
234-
@package.should_receive(:run).with(any, /configure/, any, any).
235-
once.globally.ordered
234+
@package.should_receive(:run).with(any, /configure/, any,
235+
working_directory: @package.builddir).once.globally.ordered
236236
conffile = @package.prepare
237237
Rake::Task[conffile].invoke
238238
end
@@ -247,8 +247,8 @@ def touch_in_srcdir(*dirs, file)
247247
working_directory: @package.srcdir).once.globally.ordered
248248
@package.should_receive(:run).with(any, "/my/autogen/script",
249249
working_directory: @package.srcdir).once.globally.ordered
250-
@package.should_receive(:run).with(any, /configure/, any, any).
251-
once.globally.ordered
250+
@package.should_receive(:run).with(any, /configure/, any,
251+
working_directory: @package.builddir).once.globally.ordered
252252
conffile = @package.prepare
253253
Rake::Task[conffile].invoke
254254
end
@@ -269,8 +269,8 @@ def touch_in_srcdir(*dirs, file)
269269
working_directory: @package.srcdir).once.globally.ordered
270270
@package.should_receive(:run).with(any, /automake/,
271271
working_directory: @package.srcdir).once.globally.ordered
272-
@package.should_receive(:run).with(any, /configure/, any, any).
273-
once.globally.ordered
272+
@package.should_receive(:run).with(any, /configure/, any,
273+
working_directory: @package.builddir).once.globally.ordered
274274
conffile = @package.prepare
275275
Rake::Task[conffile].invoke
276276
end
@@ -315,8 +315,8 @@ def touch_in_srcdir(*dirs, file)
315315
working_directory: @package.srcdir).once.globally.ordered
316316
@package.should_receive(:run).with(any, /automake/,
317317
working_directory: @package.srcdir).once.globally.ordered
318-
@package.should_receive(:run).with(any, /configure/, any, any).
319-
once.globally.ordered
318+
@package.should_receive(:run).with(any, /configure/, any,
319+
working_directory: @package.builddir).once.globally.ordered
320320
conffile = @package.prepare
321321
Rake::Task[conffile].invoke
322322
end
@@ -335,8 +335,8 @@ def touch_in_srcdir(*dirs, file)
335335
working_directory: @package.srcdir).once.globally.ordered
336336
@package.should_receive(:run).with(any, /automake/,
337337
working_directory: @package.srcdir).once.globally.ordered
338-
@package.should_receive(:run).with(any, /configure/, any, any).
339-
once.globally.ordered
338+
@package.should_receive(:run).with(any, /configure/, any,
339+
working_directory: @package.builddir).once.globally.ordered
340340
conffile = @package.prepare
341341
Rake::Task[conffile].invoke
342342
end
@@ -355,8 +355,8 @@ def touch_in_srcdir(*dirs, file)
355355
working_directory: @package.srcdir).once.globally.ordered
356356
@package.should_receive(:run).with(any, /automake/,
357357
working_directory: @package.srcdir).once.globally.ordered
358-
@package.should_receive(:run).with(any, /configure/, any, any).
359-
once.globally.ordered
358+
@package.should_receive(:run).with(any, /configure/, any,
359+
working_directory: @package.builddir).once.globally.ordered
360360
conffile = @package.prepare
361361
Rake::Task[conffile].invoke
362362
end
@@ -375,8 +375,8 @@ def touch_in_srcdir(*dirs, file)
375375
working_directory: @package.srcdir).once.globally.ordered
376376
@package.should_receive(:run).with(any, /automake/,
377377
working_directory: @package.srcdir).once.globally.ordered
378-
@package.should_receive(:run).with(any, /configure/, any, any).
379-
once.globally.ordered
378+
@package.should_receive(:run).with(any, /configure/, any,
379+
working_directory: @package.builddir).once.globally.ordered
380380
conffile = @package.prepare
381381
Rake::Task[conffile].invoke
382382
end
@@ -395,8 +395,8 @@ def touch_in_srcdir(*dirs, file)
395395
working_directory: @package.srcdir).once.globally.ordered
396396
@package.should_receive(:run).with(any, /autoheader/,
397397
working_directory: @package.srcdir).once.globally.ordered
398-
@package.should_receive(:run).with(any, /configure/, any, any).
399-
once.globally.ordered
398+
@package.should_receive(:run).with(any, /configure/, any,
399+
working_directory: @package.builddir).once.globally.ordered
400400
conffile = @package.prepare
401401
Rake::Task[conffile].invoke
402402
end

test/packages/test_cmake.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def make_cmake_lists(contents)
3131
flexmock(package).should_receive(:configure).
3232
once.pass_thru
3333
flexmock(Autobuild).should_receive(:make_subcommand).
34-
with(package, 'build', Proc).once.pass_thru
34+
with(package, 'build').with_block.once.pass_thru
3535
# prepare is for the gnumake detection, which is cached
3636
flexmock(package).should_receive(:run).
3737
with('prepare', any, any).
@@ -43,7 +43,7 @@ def make_cmake_lists(contents)
4343
with('build', 'cmake', '.').
4444
once.pass_thru
4545
flexmock(package).should_receive(:run).
46-
with('build', 'make', any, Proc).
46+
with('build', 'make', any).with_block.
4747
once.pass_thru
4848
flexmock(package).should_receive(:run).
4949
with('install', 'make', any, 'install').

0 commit comments

Comments
 (0)