diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c0f7d70 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: "ci" + +on: + pull_request: + branches: + - "main" + workflow_dispatch: + +jobs: + + spec: + strategy: + fail-fast: false + matrix: + ruby_version: + - '2.5' + - '2.7' + puppet_gem_version: + - '~> 6.0' + - '~> 7.0' + name: "spec (ruby ${{ matrix.ruby_version }} | ${{ matrix.puppet_gem_version }})" + uses: "puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main" + secrets: "inherit" + with: + ruby_version: ${{ matrix.ruby_version }} + + acceptance: + needs: "spec" + strategy: + fail-fast: false + matrix: + os: + - "ubuntu-latest" + - "windows-latest" + ruby_version: + - "2.5" + - "2.7" + puppet_gem_version: + - '~> 6.0' + - '~> 7.0' + name: "acceptance (${{ matrix.os }} ruby ${{ matrix.ruby_version }} |${{ matrix.puppet_gem_version }})" + uses: "puppetlabs/cat-github-actions/.github/workflows/gem_acceptance.yml@main" + secrets: "inherit" + with: + ruby_version: ${{ matrix.ruby_version }} + rake_task: 'acceptance' + puppet_version: ${{ matrix.puppet_gem_version }} + runs_on: ${{ matrix.os }} diff --git a/.github/workflows/labeller.yml b/.github/workflows/labeller.yml new file mode 100644 index 0000000..5434d3f --- /dev/null +++ b/.github/workflows/labeller.yml @@ -0,0 +1,22 @@ +name: community-labeller + +on: + issues: + types: + - opened + pull_request_target: + types: + - opened + +jobs: + label: + runs-on: ubuntu-latest + steps: + + - uses: puppetlabs/community-labeller@v0 + name: Label issues or pull requests + with: + label_name: community + label_color: '5319e7' + org_membership: puppetlabs + token: ${{ secrets.IAC_COMMUNITY_LABELER }} diff --git a/.github/workflows/mend.yml b/.github/workflows/mend.yml new file mode 100644 index 0000000..b4100a5 --- /dev/null +++ b/.github/workflows/mend.yml @@ -0,0 +1,15 @@ +name: "mend" + +on: + pull_request: + branches: + - "main" + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + +jobs: + + mend: + uses: "puppetlabs/cat-github-actions/.github/workflows/mend_ruby.yml@main" + secrets: "inherit" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..dcef4ef --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,47 @@ +name: "nightly" + +on: + schedule: + - cron: "0 0 * * *" + workflow_dispatch: + +jobs: + + spec: + strategy: + fail-fast: false + matrix: + ruby_version: + - '2.5' + - '2.7' + puppet_gem_version: + - '~> 6.0' + - '~> 7.0' + name: "spec (ruby ${{ matrix.ruby_version }} | ${{ matrix.puppet_gem_version }})" + uses: "puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main" + secrets: "inherit" + with: + ruby_version: ${{ matrix.ruby_version }} + + acceptance: + needs: "spec" + strategy: + fail-fast: false + matrix: + os: + - "ubuntu-latest" + - "windows-latest" + ruby_version: + - "2.5" + - "2.7" + puppet_gem_version: + - '~> 6.0' + - '~> 7.0' + name: "acceptance (${{ matrix.os }} ruby ${{ matrix.ruby_version }} |${{ matrix.puppet_gem_version }})" + uses: "puppetlabs/cat-github-actions/.github/workflows/gem_acceptance.yml@main" + secrets: "inherit" + with: + ruby_version: ${{ matrix.ruby_version }} + rake_task: 'acceptance' + puppet_version: ${{ matrix.puppet_gem_version }} + runs_on: ${{ matrix.os }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7fcfd4b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,16 @@ +name: "Release" + +on: + workflow_dispatch: + inputs: + target: + description: "The target for the release. This can be a commit sha or a branch." + required: false + default: "main" + +jobs: + release: + uses: "puppetlabs/cat-github-actions/.github/workflows/gem_release.yml@main" + with: + target: "${{ github.event.inputs.target }}" + secrets: "inherit" diff --git a/.github/workflows/release_prep.yml b/.github/workflows/release_prep.yml new file mode 100644 index 0000000..4ee2053 --- /dev/null +++ b/.github/workflows/release_prep.yml @@ -0,0 +1,20 @@ +name: "Release Prep" + +on: + workflow_dispatch: + inputs: + target: + description: "The target for the release. This can be a commit sha or a branch." + required: false + default: "main" + version: + description: "Version of gem to be released." + required: true + +jobs: + release_prep: + uses: "puppetlabs/cat-github-actions/.github/workflows/gem_release_prep.yml@main" + with: + target: "${{ github.event.inputs.target }}" + version: "${{ github.event.inputs.version }}" + secrets: "inherit" diff --git a/.rubocop.yml b/.rubocop.yml index 2a75713..a63a887 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ require: rubocop-rspec AllCops: - TargetRubyVersion: 2.3 + TargetRubyVersion: 2.5 Exclude: # binstubs, and other utilities - bin/**/* @@ -178,3 +178,6 @@ Lint/RaiseException: Lint/StructNewOverride: Enabled: true + +RSpec/MultipleMemoizedHelpers: + Max: 14 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 026b0ec..0000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -os: linux -language: ruby -cache: bundler -env: -- SIMPLECOV=yes -jobs: - include: - - rvm: 2.7 - - rvm: 2.5 - - rvm: 2.4 diff --git a/Gemfile b/Gemfile index 96e9c79..c9985da 100644 --- a/Gemfile +++ b/Gemfile @@ -11,8 +11,9 @@ group :development do gem 'rake', '~> 12.0' gem 'rspec', '~> 3.0' - gem 'rubocop', ['~> 0.68', '< 0.82.0'] - gem 'rubocop-rspec', '~> 1.38' + gem 'rubocop', '= 1.6.1', require: false + gem 'rubocop-performance', '= 1.9.1', require: false + gem 'rubocop-rspec', '= 2.0.1', require: false gem 'codecov', '~> 0.1' gem 'github_changelog_generator', '~> 1.15', require: false diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index b9c3d47..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,30 +0,0 @@ ---- -environment: - matrix: - - RUBY_VERSION: 25-x64 - - RUBY_VERSION: 24-x64 - -install: - - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH% - - set SIMPLECOV=yes - - gem install bundler -v 2.1.4 - - bundle -v - - bundle install --retry 2 - -build: off - -branches: - only: - - main - -before_test: - - bundle env - - type Gemfile.lock - -test_script: - - bundle exec rake - -# Uncomment this block to enable RDP access to the AppVeyor test instance for -# debugging purposes. -# on_finish: -# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/lib/puppet/modulebuilder/builder.rb b/lib/puppet/modulebuilder/builder.rb index 0b111f5..93bfe1f 100644 --- a/lib/puppet/modulebuilder/builder.rb +++ b/lib/puppet/modulebuilder/builder.rb @@ -16,9 +16,7 @@ class Builder '/vendor/', ].freeze - attr_reader :destination - - attr_reader :logger + attr_reader :destination, :logger def initialize(source, destination = nil, logger = nil) raise ArgumentError, 'logger is expected to be nil or a Logger. Got %{klass}' % { klass: logger.class } unless logger.nil? || logger.is_a?(Logger) @@ -143,7 +141,7 @@ def copy_mtime(path) # # @return [Boolean] true if the path matches and should be ignored. def ignored_path?(path) - path = path.to_s + '/' if File.directory?(path) + path = "#{path}/" if File.directory?(path) ignored_files.match_path(path, source) end diff --git a/puppet-modulebuilder.gemspec b/puppet-modulebuilder.gemspec index a43be41..bce8c22 100644 --- a/puppet-modulebuilder.gemspec +++ b/puppet-modulebuilder.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |spec| spec.email = ['sheena@puppet.com', 'https://puppetlabs.github.io/iac/'] spec.summary = 'A gem to set up puppet-modulebuilder' spec.homepage = 'https://github.com/puppetlabs/puppet-modulebuilder' - spec.required_ruby_version = Gem::Requirement.new('>= 2.1.0') + spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0') spec.license = 'Apache-2.0' spec.metadata['homepage_uri'] = spec.homepage