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

Only test ruby 2.5 and 2.6 #268

Merged
merged 5 commits into from
Jan 24, 2024
Merged
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
33 changes: 7 additions & 26 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
name: CI
on: [push, pull_request, workflow_dispatch]
jobs:
puppet-3-8-7:
env:
PUPPET_VERSIONS: "3.8.7"
PUPPET_VERSION: "3.8.7"
RUBOCOP_TEST: false
RSPEC_TEST: true
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-version: ["2.0", "2.1"]
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Build container
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}
- name: Tests
run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild

puppet-4-10-10:
env:
PUPPET_VERSIONS: "4.10.10"
Expand All @@ -30,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: ["2.1", "2.2", "2.3"]
ruby-version: ["2.5", "2.6"]
steps:
- name: Checkout code
uses: actions/checkout@v1
Expand All @@ -39,22 +20,22 @@ jobs:
- name: Tests
run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild

puppet-5-5-8:
puppet-5-5-22:
env:
PUPPET_VERSIONS: "5.5.8"
PUPPET_VERSION: "5.5.8"
PUPPET_VERSIONS: "5.5.22"
PUPPET_VERSION: "5.5.22"
RUBOCOP_TEST: false
RSPEC_TEST: true
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-version: ["2.4", "2.5", "2.6"]
ruby-version: ["2.5", "2.6"]
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Build container
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}-stretch
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}-buster
- name: Tests
run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild

Expand All @@ -73,7 +54,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v1
- name: Build container
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}-stretch
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}-buster
- name: Tests
run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild
- name: Rubocop and Coverage
Expand Down
12 changes: 10 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Style/Documentation:
Enabled: false

# To fix later
Style/FormatStringToken:
Enabled: false
Style/PercentLiteralDelimiters:
Enabled: false
Style/VariableNumber:
Expand All @@ -73,7 +75,13 @@ Style/EmptyMethod:
Enabled: false
Style/SymbolArray:
Enabled: false
Style/IndentHeredoc:
Style/YodaCondition:
Enabled: false
Layout/HeredocIndentation:
Enabled: false
Layout/ExtraSpacing:
Enabled: false
Performance/Caller:
Enabled: false
Style/ExtraSpacing:
Style/WordArray:
Enabled: false
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ source 'https://rubygems.org'

gem 'rake', '12.3.3'
gem 'httparty', '0.16.3'
gem 'rubocop', '0.49.0'

gemspec
2 changes: 1 addition & 1 deletion lib/octocatalog-diff/api/v1/override.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def convert_to_data_type(datatype, value)
return value if datatype == 'string'
return parse_json(value) if datatype == 'json'
return nil if datatype == 'nil'
if datatype == 'fixnum' || datatype == 'integer'
if ['fixnum', 'integer'].include? datatype
return Regexp.last_match(1).to_i if value =~ /^(-?\d+)$/
raise ArgumentError, "Illegal integer '#{value}'"
end
Expand Down
6 changes: 3 additions & 3 deletions lib/octocatalog-diff/catalog-diff/differ.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def filter_and_cleanup(catalog_resources)
# Process each attribute in the resource
resource.each do |k, v|
# Title was pre-processed
next if k == 'title' || k == 'type'
next if ['title', 'type'].include? k

# Handle parameters
if k == 'parameters'
Expand All @@ -272,7 +272,7 @@ def filter_and_cleanup(catalog_resources)
# The order of tags is unimportant. Sort this array to avoid false diffs if order changes.
# Also if tags is empty, don't add.
hsh[k] = v.sort if v.is_a?(Array) && v.any?
elsif k == 'file' || k == 'line'
elsif ['file', 'line'].include? k
# We don't care, for the purposes of catalog-diff, from which manifest and line this resource originated.
# However, we may report this to the user, so we will keep it in here for now.
hsh[k] = v
Expand Down Expand Up @@ -354,7 +354,7 @@ def attr_match_rule?(rule, attrib, old_val, new_val)
elsif operator == '=->'
# String equality test only of the old value
matcher = ->(x, _y) { x == value }
elsif operator == '=~>' || operator == '=&>'
elsif ['=~>', '=&>'].include? operator
begin
my_regex = Regexp.new(value, Regexp::IGNORECASE)
rescue RegexpError => exc
Expand Down
2 changes: 1 addition & 1 deletion lib/octocatalog-diff/cli/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def self.option_classes
# option will populate any of the 'to' and 'from' variants that are missing.
# @param :datatype [?] Expected data type
def self.option_globally_or_per_branch(opts = {})
opts[:filename] = caller[0].split(':').first
opts[:filename] = opts[:filename] = caller[0].split(':').first
datatype = opts.fetch(:datatype, '')
return option_globally_or_per_branch_string(opts) if datatype.is_a?(String)
return option_globally_or_per_branch_array(opts) if datatype.is_a?(Array)
Expand Down
2 changes: 1 addition & 1 deletion lib/octocatalog-diff/cli/options/compare_file_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def parse(parser, options)
parser.on('--[no-]compare-file-text[=force]', 'Compare text, not source location, of file resources') do |x|
if x == 'force'
options[:compare_file_text] = :force
elsif x == true || x == false
elsif [true, false].include? x
options[:compare_file_text] = x
else
raise OptionParser::NeedlessArgument("needless argument: --compare-file-text=#{x}")
Expand Down
12 changes: 6 additions & 6 deletions octocatalog-diff.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ Gem::Specification.new do |s|
s.homepage = 'https://github.com/github/octocatalog-diff'
s.summary = 'Compile Puppet catalogs from 2 branches, versions, etc., and compare them.'
s.description = <<-EOF
Octocatalog-Diff assists with Puppet development and testing by enabling the user to
compile 2 Puppet catalogs and compare them. It is possible to compare different
branches, different versions, and different fact values. This is intended to be run
from a local development environment or in CI.
Octocatalog-Diff assists with Puppet development and testing by enabling the user to
compile 2 Puppet catalogs and compare them. It is possible to compare different
branches, different versions, and different fact values. This is intended to be run
from a local development environment or in CI.
EOF

s.add_runtime_dependency 'diffy', '>= 3.1.0'
Expand All @@ -31,11 +31,11 @@ EOF
s.add_runtime_dependency 'rugged', '>= 0.25.0b2'

s.add_development_dependency 'rspec', '~> 3.4.0'
s.add_development_dependency 'rake', '12.3.1'
s.add_development_dependency 'rake', '12.3.3'
s.add_development_dependency 'parallel_tests', '2.7.1'
s.add_development_dependency 'rspec-retry', '0.5.0'

s.add_development_dependency 'rubocop', '= 0.48.1'
s.add_development_dependency 'rubocop', '= 0.49.0'

s.add_development_dependency 'simplecov', '~> 0.14.1'
s.add_development_dependency 'simplecov-erb', '~> 0.1.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ def catalog_from_fixture(path)
it 'should expand globs in modulepath, if present' do
allow(File).to receive(:file?).with('/a/environment.conf').and_return(true)
allow(File).to receive(:read).with('/a/environment.conf')
.and_return('modulepath=modules:extra_mods/*/modules:$basemoduledir')
.and_return('modulepath=modules:extra_mods/*/modules:$basemoduledir')
allow(Dir).to receive(:glob).with('/a/modules').and_return(['/a/modules'])
allow(Dir).to receive(:glob).with('/a/extra_mods/*/modules')
.and_return(['/a/extra_mods/a/modules', '/a/extra_mods/b/modules'])
.and_return(['/a/extra_mods/a/modules', '/a/extra_mods/b/modules'])
result = OctocatalogDiff::CatalogUtil::FileResources.module_path('/a')
expect(result).to eq(['/a/modules', '/a/extra_mods/a/modules', '/a/extra_mods/b/modules'])
end
Expand Down
4 changes: 3 additions & 1 deletion spec/octocatalog-diff/tests/catalog-util/git_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@
it 'should return the sha from rugged' do
opts = { branch: 'foo', basedir: '/tmp/bar' }
expect(Rugged::Repository).to receive(:new).with('/tmp/bar')
.and_return(OpenStruct.new(branches: { 'foo' => OpenStruct.new(target_id: 'abcdef012345') }))
.and_return(OpenStruct.new(branches: {
'foo' => OpenStruct.new(target_id: 'abcdef012345')
}))
result = described_class.branch_sha(opts)
expect(result).to eq('abcdef012345')
end
Expand Down
Binary file added vendor/cache/mime-types-3.5.2.gem
Binary file not shown.
Binary file added vendor/cache/mime-types-data-3.2023.1205.gem
Binary file not shown.
Binary file added vendor/cache/rubocop-0.49.0.gem
Binary file not shown.