Skip to content

Commit 8abad34

Browse files
authored
Merge pull request #268 from cjmartian/clean-ci
Only test ruby 2.5 and 2.6
2 parents 43e806e + 777e1df commit 8abad34

File tree

13 files changed

+35
-43
lines changed

13 files changed

+35
-43
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
11
name: CI
22
on: [push, pull_request, workflow_dispatch]
33
jobs:
4-
puppet-3-8-7:
5-
env:
6-
PUPPET_VERSIONS: "3.8.7"
7-
PUPPET_VERSION: "3.8.7"
8-
RUBOCOP_TEST: false
9-
RSPEC_TEST: true
10-
runs-on: ubuntu-latest
11-
strategy:
12-
fail-fast: false
13-
matrix:
14-
ruby-version: ["2.0", "2.1"]
15-
steps:
16-
- name: Checkout code
17-
uses: actions/checkout@v1
18-
- name: Build container
19-
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}
20-
- name: Tests
21-
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
22-
234
puppet-4-10-10:
245
env:
256
PUPPET_VERSIONS: "4.10.10"
@@ -30,7 +11,7 @@ jobs:
3011
strategy:
3112
fail-fast: false
3213
matrix:
33-
ruby-version: ["2.1", "2.2", "2.3"]
14+
ruby-version: ["2.5", "2.6"]
3415
steps:
3516
- name: Checkout code
3617
uses: actions/checkout@v1
@@ -39,22 +20,22 @@ jobs:
3920
- name: Tests
4021
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
4122

42-
puppet-5-5-8:
23+
puppet-5-5-22:
4324
env:
44-
PUPPET_VERSIONS: "5.5.8"
45-
PUPPET_VERSION: "5.5.8"
25+
PUPPET_VERSIONS: "5.5.22"
26+
PUPPET_VERSION: "5.5.22"
4627
RUBOCOP_TEST: false
4728
RSPEC_TEST: true
4829
runs-on: ubuntu-latest
4930
strategy:
5031
fail-fast: false
5132
matrix:
52-
ruby-version: ["2.4", "2.5", "2.6"]
33+
ruby-version: ["2.5", "2.6"]
5334
steps:
5435
- name: Checkout code
5536
uses: actions/checkout@v1
5637
- name: Build container
57-
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}-stretch
38+
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}-buster
5839
- name: Tests
5940
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
6041

@@ -73,7 +54,7 @@ jobs:
7354
- name: Checkout code
7455
uses: actions/checkout@v1
7556
- name: Build container
76-
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}-stretch
57+
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}}-buster
7758
- name: Tests
7859
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
7960
- name: Rubocop and Coverage

.rubocop.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Style/Documentation:
5757
Enabled: false
5858

5959
# To fix later
60+
Style/FormatStringToken:
61+
Enabled: false
6062
Style/PercentLiteralDelimiters:
6163
Enabled: false
6264
Style/VariableNumber:
@@ -73,7 +75,13 @@ Style/EmptyMethod:
7375
Enabled: false
7476
Style/SymbolArray:
7577
Enabled: false
76-
Style/IndentHeredoc:
78+
Style/YodaCondition:
79+
Enabled: false
80+
Layout/HeredocIndentation:
81+
Enabled: false
82+
Layout/ExtraSpacing:
83+
Enabled: false
84+
Performance/Caller:
7785
Enabled: false
78-
Style/ExtraSpacing:
86+
Style/WordArray:
7987
Enabled: false

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ source 'https://rubygems.org'
22

33
gem 'rake', '12.3.3'
44
gem 'httparty', '0.16.3'
5+
gem 'rubocop', '0.49.0'
56

67
gemspec

lib/octocatalog-diff/api/v1/override.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def convert_to_data_type(datatype, value)
7474
return value if datatype == 'string'
7575
return parse_json(value) if datatype == 'json'
7676
return nil if datatype == 'nil'
77-
if datatype == 'fixnum' || datatype == 'integer'
77+
if ['fixnum', 'integer'].include? datatype
7878
return Regexp.last_match(1).to_i if value =~ /^(-?\d+)$/
7979
raise ArgumentError, "Illegal integer '#{value}'"
8080
end

lib/octocatalog-diff/catalog-diff/differ.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def filter_and_cleanup(catalog_resources)
262262
# Process each attribute in the resource
263263
resource.each do |k, v|
264264
# Title was pre-processed
265-
next if k == 'title' || k == 'type'
265+
next if ['title', 'type'].include? k
266266

267267
# Handle parameters
268268
if k == 'parameters'
@@ -272,7 +272,7 @@ def filter_and_cleanup(catalog_resources)
272272
# The order of tags is unimportant. Sort this array to avoid false diffs if order changes.
273273
# Also if tags is empty, don't add.
274274
hsh[k] = v.sort if v.is_a?(Array) && v.any?
275-
elsif k == 'file' || k == 'line'
275+
elsif ['file', 'line'].include? k
276276
# We don't care, for the purposes of catalog-diff, from which manifest and line this resource originated.
277277
# However, we may report this to the user, so we will keep it in here for now.
278278
hsh[k] = v
@@ -354,7 +354,7 @@ def attr_match_rule?(rule, attrib, old_val, new_val)
354354
elsif operator == '=->'
355355
# String equality test only of the old value
356356
matcher = ->(x, _y) { x == value }
357-
elsif operator == '=~>' || operator == '=&>'
357+
elsif ['=~>', '=&>'].include? operator
358358
begin
359359
my_regex = Regexp.new(value, Regexp::IGNORECASE)
360360
rescue RegexpError => exc

lib/octocatalog-diff/cli/options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def self.option_classes
9999
# option will populate any of the 'to' and 'from' variants that are missing.
100100
# @param :datatype [?] Expected data type
101101
def self.option_globally_or_per_branch(opts = {})
102-
opts[:filename] = caller[0].split(':').first
102+
opts[:filename] = opts[:filename] = caller[0].split(':').first
103103
datatype = opts.fetch(:datatype, '')
104104
return option_globally_or_per_branch_string(opts) if datatype.is_a?(String)
105105
return option_globally_or_per_branch_array(opts) if datatype.is_a?(Array)

lib/octocatalog-diff/cli/options/compare_file_text.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def parse(parser, options)
2323
parser.on('--[no-]compare-file-text[=force]', 'Compare text, not source location, of file resources') do |x|
2424
if x == 'force'
2525
options[:compare_file_text] = :force
26-
elsif x == true || x == false
26+
elsif [true, false].include? x
2727
options[:compare_file_text] = x
2828
else
2929
raise OptionParser::NeedlessArgument("needless argument: --compare-file-text=#{x}")

octocatalog-diff.gemspec

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ Gem::Specification.new do |s|
1818
s.homepage = 'https://github.com/github/octocatalog-diff'
1919
s.summary = 'Compile Puppet catalogs from 2 branches, versions, etc., and compare them.'
2020
s.description = <<-EOF
21-
Octocatalog-Diff assists with Puppet development and testing by enabling the user to
22-
compile 2 Puppet catalogs and compare them. It is possible to compare different
23-
branches, different versions, and different fact values. This is intended to be run
24-
from a local development environment or in CI.
21+
Octocatalog-Diff assists with Puppet development and testing by enabling the user to
22+
compile 2 Puppet catalogs and compare them. It is possible to compare different
23+
branches, different versions, and different fact values. This is intended to be run
24+
from a local development environment or in CI.
2525
EOF
2626

2727
s.add_runtime_dependency 'diffy', '>= 3.1.0'
@@ -31,11 +31,11 @@ EOF
3131
s.add_runtime_dependency 'rugged', '>= 0.25.0b2'
3232

3333
s.add_development_dependency 'rspec', '~> 3.4.0'
34-
s.add_development_dependency 'rake', '12.3.1'
34+
s.add_development_dependency 'rake', '12.3.3'
3535
s.add_development_dependency 'parallel_tests', '2.7.1'
3636
s.add_development_dependency 'rspec-retry', '0.5.0'
3737

38-
s.add_development_dependency 'rubocop', '= 0.48.1'
38+
s.add_development_dependency 'rubocop', '= 0.49.0'
3939

4040
s.add_development_dependency 'simplecov', '~> 0.14.1'
4141
s.add_development_dependency 'simplecov-erb', '~> 0.1.1'

spec/octocatalog-diff/tests/catalog-util/fileresources_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ def catalog_from_fixture(path)
9292
it 'should expand globs in modulepath, if present' do
9393
allow(File).to receive(:file?).with('/a/environment.conf').and_return(true)
9494
allow(File).to receive(:read).with('/a/environment.conf')
95-
.and_return('modulepath=modules:extra_mods/*/modules:$basemoduledir')
95+
.and_return('modulepath=modules:extra_mods/*/modules:$basemoduledir')
9696
allow(Dir).to receive(:glob).with('/a/modules').and_return(['/a/modules'])
9797
allow(Dir).to receive(:glob).with('/a/extra_mods/*/modules')
98-
.and_return(['/a/extra_mods/a/modules', '/a/extra_mods/b/modules'])
98+
.and_return(['/a/extra_mods/a/modules', '/a/extra_mods/b/modules'])
9999
result = OctocatalogDiff::CatalogUtil::FileResources.module_path('/a')
100100
expect(result).to eq(['/a/modules', '/a/extra_mods/a/modules', '/a/extra_mods/b/modules'])
101101
end

spec/octocatalog-diff/tests/catalog-util/git_spec.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@
9696
it 'should return the sha from rugged' do
9797
opts = { branch: 'foo', basedir: '/tmp/bar' }
9898
expect(Rugged::Repository).to receive(:new).with('/tmp/bar')
99-
.and_return(OpenStruct.new(branches: { 'foo' => OpenStruct.new(target_id: 'abcdef012345') }))
99+
.and_return(OpenStruct.new(branches: {
100+
'foo' => OpenStruct.new(target_id: 'abcdef012345')
101+
}))
100102
result = described_class.branch_sha(opts)
101103
expect(result).to eq('abcdef012345')
102104
end

0 commit comments

Comments
 (0)