Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run github workflows on ruby 3.0 #127

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ jobs:

strategy:
matrix:
ruby-version: ["2.7", "2.6", "2.5"]
ruby-version:
- "3.0"
- "2.7"

steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ jobs:

strategy:
matrix:
ruby-version: ["2.7", "2.6", "2.5"]
ruby-version:
- "3.0"
- "2.7"
- "2.5"

steps:
- uses: actions/checkout@v2
Expand Down
10 changes: 3 additions & 7 deletions autobuild.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,17 @@ Gem::Specification.new do |s|
.reject { |f| f.match(%r{^(test|spec|features)/}) }

s.add_runtime_dependency "concurrent-ruby", "~> 1.1"
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.1.0")
s.add_runtime_dependency "net-smtp"
end
s.add_runtime_dependency "net-smtp"
s.add_runtime_dependency "pastel", "~> 0.7.0"
s.add_runtime_dependency "rake", "~> 13.0"
s.add_runtime_dependency 'tty-cursor', '~> 0.7.0'
s.add_runtime_dependency 'tty-prompt', '~> 0.21.0'
s.add_runtime_dependency 'tty-screen', '~> 0.8.0'
s.add_runtime_dependency "utilrb", "~> 3.0", ">= 3.0"
s.add_development_dependency "fakefs"
s.add_development_dependency "flexmock", '~> 2.0', ">= 2.0.0"
s.add_development_dependency "flexmock", ">= 2.4.0"
s.add_development_dependency "minitest", "~> 5.0", ">= 5.0"
s.add_development_dependency "simplecov"
s.add_development_dependency "timecop"
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0.0")
s.add_development_dependency "webrick"
end
s.add_development_dependency "webrick"
end
29 changes: 27 additions & 2 deletions test/import/test_git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
attr_reader :pkg, :importer, :gitrepo

before do
xdg_config_home = make_tmpdir
git_config = File.join(xdg_config_home, "git", "config")
FileUtils.mkdir_p File.dirname(git_config)
@current_xdg_config_home = ENV["XDG_CONFIG_HOME"]
ENV["XDG_CONFIG_HOME"] = xdg_config_home

File.write(git_config, <<~GIT_CONFIG)
[user]
email = [email protected]
name = Someone

[protocol "file"]
allow = always
GIT_CONFIG

unless system("git", "config", "--global", "protocol.file.allow", "always")
raise "could not set up temporary global git configuration"
end

tempdir = untar('gitrepo.tar')
@gitrepo = File.join(tempdir, 'gitrepo.git')
@pkg = Autobuild::Package.new 'test'
Expand All @@ -12,6 +31,10 @@
pkg.importer = importer
end

after do
ENV["XDG_CONFIG_HOME"] = @current_xdg_config_home
end

describe "#initialize" do
it "allows passing the branch as second argument for backward-compatibility way" do
Autobuild.silent = true
Expand Down Expand Up @@ -275,7 +298,7 @@
any, :import, 'git', 'clone', '-o', 'autobuild',
File.join(tempdir, 'gitrepo.git'),
File.join(tempdir, 'git'), any
)
).with_any_kw_args

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

Expand All @@ -297,7 +320,7 @@ def assert_clone(*args)
any, :import, 'git', 'clone', '-o', 'autobuild', *args,
File.join(tempdir, 'gitrepo.git'),
File.join(tempdir, 'git'), any
).once.pass_thru
).with_any_kw_args.once.pass_thru

flexmock(Autobuild::Subprocess).should_receive(:run).pass_thru
end
Expand Down Expand Up @@ -992,6 +1015,7 @@ def pin_importer(id, options = Hash.new)
.should_receive(:run)
.with(any, :import, 'git', '--git-dir', File.join(pkg.srcdir, ".git"),
'symbolic-ref', "refs/remotes/autobuild/HEAD", any)
.with_any_kw_args
.once
.and_return(['refs/remotes/autobuild/temp/branch', 'bla'])
flexmock(Autobuild::Subprocess).should_receive(:run).pass_thru
Expand Down Expand Up @@ -1027,6 +1051,7 @@ def pin_importer(id, options = Hash.new)
any, :import, 'git', 'ls-remote', '--symref',
File.join(tempdir, 'gitrepo-nomaster.git'), any
)
.with_any_kw_args
.once
.and_return(['ref: refs/heads/temp/branch HEAD', 'bla'])
flexmock(Autobuild::Subprocess).should_receive(:run).pass_thru
Expand Down
32 changes: 16 additions & 16 deletions test/packages/test_autotools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ def touch_in_srcdir(*dirs, file)
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, "/my/autogen/script",
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any, any).
once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any,
working_directory: @package.builddir).once.globally.ordered
conffile = @package.prepare
Rake::Task[conffile].invoke
end
Expand All @@ -247,8 +247,8 @@ def touch_in_srcdir(*dirs, file)
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, "/my/autogen/script",
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any, any).
once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any,
working_directory: @package.builddir).once.globally.ordered
conffile = @package.prepare
Rake::Task[conffile].invoke
end
Expand All @@ -269,8 +269,8 @@ def touch_in_srcdir(*dirs, file)
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, /automake/,
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any, any).
once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any,
working_directory: @package.builddir).once.globally.ordered
conffile = @package.prepare
Rake::Task[conffile].invoke
end
Expand Down Expand Up @@ -315,8 +315,8 @@ def touch_in_srcdir(*dirs, file)
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, /automake/,
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any, any).
once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any,
working_directory: @package.builddir).once.globally.ordered
conffile = @package.prepare
Rake::Task[conffile].invoke
end
Expand All @@ -335,8 +335,8 @@ def touch_in_srcdir(*dirs, file)
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, /automake/,
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any, any).
once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any,
working_directory: @package.builddir).once.globally.ordered
conffile = @package.prepare
Rake::Task[conffile].invoke
end
Expand All @@ -355,8 +355,8 @@ def touch_in_srcdir(*dirs, file)
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, /automake/,
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any, any).
once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any,
working_directory: @package.builddir).once.globally.ordered
conffile = @package.prepare
Rake::Task[conffile].invoke
end
Expand All @@ -375,8 +375,8 @@ def touch_in_srcdir(*dirs, file)
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, /automake/,
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any, any).
once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any,
working_directory: @package.builddir).once.globally.ordered
conffile = @package.prepare
Rake::Task[conffile].invoke
end
Expand All @@ -395,8 +395,8 @@ def touch_in_srcdir(*dirs, file)
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, /autoheader/,
working_directory: @package.srcdir).once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any, any).
once.globally.ordered
@package.should_receive(:run).with(any, /configure/, any,
working_directory: @package.builddir).once.globally.ordered
conffile = @package.prepare
Rake::Task[conffile].invoke
end
Expand Down
4 changes: 2 additions & 2 deletions test/packages/test_cmake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def make_cmake_lists(contents)
flexmock(package).should_receive(:configure).
once.pass_thru
flexmock(Autobuild).should_receive(:make_subcommand).
with(package, 'build', Proc).once.pass_thru
with(package, 'build').with_block.once.pass_thru
# prepare is for the gnumake detection, which is cached
flexmock(package).should_receive(:run).
with('prepare', any, any).
Expand All @@ -43,7 +43,7 @@ def make_cmake_lists(contents)
with('build', 'cmake', '.').
once.pass_thru
flexmock(package).should_receive(:run).
with('build', 'make', any, Proc).
with('build', 'make', any).with_block.
once.pass_thru
flexmock(package).should_receive(:run).
with('install', 'make', any, 'install').
Expand Down
Loading