Skip to content

Commit

Permalink
chore: fix github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
g-arjones committed Jul 10, 2024
1 parent cb217a0 commit 190b9b6
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Remove vscode gems
run: bundle config set --local without vscode
- name: Install dependencies
run: bundle install
- name: Run rubocop
run: bundle exec rubocop
run: bundle exec rubocop
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ jobs:
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Remove vscode gems
run: bundle config set --local without vscode
- name: Install dependencies
run: bundle install
- name: Enable file transport in git
run: git config --global protocol.file.allow always
- name: Run tests
run: bundle exec rake test
env:
Expand Down
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
inherit_from: .rubocop_todo.yml

inherit_gem:
rubocop-rock: defaults.yml

Expand Down
22 changes: 22 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-07-10 17:48:07 UTC using RuboCop version 1.65.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 2
# Configuration parameters: Severity, Include.
# Include: **/*.gemspec
Gemspec/RubyVersionGlobalsUsage:
Exclude:
- 'autobuild.gemspec'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedReceivers.
# AllowedReceivers: Thread.current
Style/HashEachMethods:
Exclude:
- 'lib/autobuild/reporting.rb'
7 changes: 5 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ source 'https://rubygems.org'

gemspec

group :lint do
gem 'rubocop', '~> 1.65.0'
gem 'rubocop-rock'
end

group :vscode do
gem 'debase', '>= 0.2.2.beta10'
gem 'pry'
gem 'pry-byebug'
gem 'rubocop', '>= 0.6.0'
gem 'rubocop-rock'
gem 'ruby-debug-ide', '>= 0.6.0'
gem 'solargraph'
end
8 changes: 6 additions & 2 deletions autobuild.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ Gem::Specification.new do |s|
.reject { |f| f.match(%r{^(test|spec|features)/}) }

s.add_runtime_dependency "concurrent-ruby", "~> 1.1"
s.add_runtime_dependency "net-smtp" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.1.0")
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.1.0")
s.add_runtime_dependency "net-smtp"
end
s.add_runtime_dependency "pastel", "~> 0.7.0"
s.add_runtime_dependency "rake", "~> 13.0"
s.add_runtime_dependency 'tty-cursor', '~> 0.7.0'
Expand All @@ -36,5 +38,7 @@ Gem::Specification.new do |s|
s.add_development_dependency "minitest", "~> 5.0", ">= 5.0"
s.add_development_dependency "simplecov"
s.add_development_dependency "timecop"
s.add_development_dependency "webrick" if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0.0")
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.0.0")
s.add_development_dependency "webrick"
end
end
2 changes: 1 addition & 1 deletion lib/autobuild/import/archive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ def checkout(package, options = Hash.new) # :nodoc:
cmd = ['-o', cachefile, '-d', main_dir]
package.run(:import, Autobuild.tool('unzip'), *cmd)

archive_dir = (self.archive_dir || File.basename(package.name))
archive_dir = self.archive_dir || File.basename(package.name)
if archive_dir != File.basename(package.srcdir)
FileUtils.rm_rf File.join(package.srcdir)
FileUtils.mv File.join(base_dir, archive_dir), package.srcdir
Expand Down
2 changes: 1 addition & 1 deletion lib/autobuild/import/git-lfs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def self.lfs_setup(importer, package)
end

Git.add_post_hook(always: true) do |importer, package|
wants_lfs = (importer.options[:lfs] != false && importer.uses_lfs?(package))
wants_lfs = importer.options[:lfs] != false && importer.uses_lfs?(package)
if wants_lfs && !Git.lfs_installed?
Autobuild.warn "#{package.name} uses git LFS but it is not installed, "\
"files may be missing from checkout"
Expand Down
6 changes: 3 additions & 3 deletions lib/autobuild/importer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ def patches
[[@options[:patches], 0]]
end

single_patch = (patches.size == 2 &&
patches[0].respond_to?(:to_str) &&
patches[1].respond_to?(:to_int))
single_patch = patches.size == 2 &&
patches[0].respond_to?(:to_str) &&
patches[1].respond_to?(:to_int)

patches = [patches] if single_patch
patches.map do |obj|
Expand Down
6 changes: 3 additions & 3 deletions lib/autobuild/mail_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ def default_mail
def initialize(config)
super()

@from_email = (config[:from] || default_mail)
@to_email = (config[:to] || default_mail)
@from_email = config[:from] || default_mail
@to_email = config[:to] || default_mail
@subject =
config[:subject] ||
"Build %result% on #{Socket.gethostname} at %time%"
@only_errors = config[:only_errors]
@smtp_hostname = (config[:smtp] || "localhost")
@smtp_hostname = config[:smtp] || "localhost"
@smtp_port = Integer(config[:port] || Socket.getservbyname('smtp'))
end

Expand Down
10 changes: 5 additions & 5 deletions lib/autobuild/packages/cmake.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ def define(name, value)
end

DOXYGEN_ACCEPTED_VARIABLES = {
'@CMAKE_SOURCE_DIR@' => ->(pkg) { pkg.srcdir },
'@PROJECT_SOURCE_DIR@' => ->(pkg) { pkg.srcdir },
'@CMAKE_BINARY_DIR@' => ->(pkg) { pkg.builddir },
'@PROJECT_BINARY_DIR@' => ->(pkg) { pkg.builddir },
'@PROJECT_NAME@' => ->(pkg) { pkg.name }
'@CMAKE_SOURCE_DIR@' => lambda(&:srcdir),
'@PROJECT_SOURCE_DIR@' => lambda(&:srcdir),
'@CMAKE_BINARY_DIR@' => lambda(&:builddir),
'@PROJECT_BINARY_DIR@' => lambda(&:builddir),
'@PROJECT_NAME@' => lambda(&:name)
}.freeze

class << self
Expand Down

0 comments on commit 190b9b6

Please sign in to comment.