diff --git a/.editorconfig b/.editorconfig index d77700e..ecb10a8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,14 +1,15 @@ # editorconfig.org -# MANAGED BY MODULESYNC +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ root = true [*] charset = utf-8 end_of_line = lf indent_size = 2 tab_width = 2 indent_style = space insert_final_newline = true trim_trailing_whitespace = true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b1904f..086a667 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,53 +1,56 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + name: CI on: - pull_request - push jobs: setup_matrix: name: 'Setup Test Matrix' runs-on: ubuntu-latest timeout-minutes: 40 outputs: - beaker_setfiles: ${{ steps.get-outputs.outputs.beaker_setfiles }} - puppet_major_versions: ${{ steps.get-outputs.outputs.puppet_major_versions }} puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} + github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }} env: - BUNDLE_WITHOUT: development:release + BUNDLE_WITHOUT: development:system_tests:release steps: - uses: actions/checkout@v2 - name: Setup ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '2.7' + ruby-version: '3.0' bundler-cache: true - - name: Run rake validate - run: bundle exec rake validate + - name: Run static validations + run: bundle exec rake validate lint check - name: Run rake rubocop run: bundle exec rake rubocop - name: Setup Test Matrix id: get-outputs run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false unit: needs: setup_matrix runs-on: ubuntu-latest timeout-minutes: 40 strategy: fail-fast: false matrix: include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}} env: BUNDLE_WITHOUT: development:system_tests:release PUPPET_VERSION: "~> ${{ matrix.puppet }}.0" name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }}) steps: - uses: actions/checkout@v2 - name: Setup ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - name: Run tests - run: bundle exec rake + run: bundle exec rake parallel_spec diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68b8528..1e4f916 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,29 +1,34 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + name: Release on: push: tags: - '*' env: BUNDLE_WITHOUT: development:test:system_tests jobs: deploy: name: 'deploy to forge' runs-on: ubuntu-latest + if: github.repository_owner == 'saz' steps: - name: Checkout repository uses: actions/checkout@v2 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: ruby-version: '2.7' bundler-cache: true - name: Build and Deploy env: # Configure secrets here: # https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets BLACKSMITH_FORGE_USERNAME: '${{ secrets.PUPPET_FORGE_USERNAME }}' BLACKSMITH_FORGE_API_KEY: '${{ secrets.PUPPET_FORGE_API_KEY }}' run: bundle exec rake module:push diff --git a/.gitignore b/.gitignore index e9b3cf4..9b95224 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,23 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + pkg/ Gemfile.lock Gemfile.local vendor/ .vendor/ spec/fixtures/manifests/ spec/fixtures/modules/ .vagrant/ .bundle/ .ruby-version coverage/ log/ .idea/ .dependencies/ .librarian/ Puppetfile.lock *.iml .*.sw? .yardoc/ Guardfile diff --git a/.msync.yml b/.msync.yml index 57ff503..9c9f18f 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1,2 +1,5 @@ --- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + modulesync_config_version: '4.1.0' diff --git a/.overcommit.yml b/.overcommit.yml index 0af0fdc..d367ada 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -1,64 +1,65 @@ -# Managed by https://github.com/voxpupuli/modulesync_configs +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ # # Hooks are only enabled if you take action. # # To enable the hooks run: # # ``` # bundle exec overcommit --install # # ensure .overcommit.yml does not harm to you and then # bundle exec overcommit --sign # ``` # # (it will manage the .git/hooks directory): # # Examples howto skip a test for a commit or push: # # ``` # SKIP=RuboCop git commit # SKIP=PuppetLint git commit # SKIP=RakeTask git push # ``` # # Don't invoke overcommit at all: # # ``` # OVERCOMMIT_DISABLE=1 git commit # ``` # # Read more about overcommit: https://github.com/brigade/overcommit # # To manage this config yourself in your module add # # ``` # .overcommit.yml: # unmanaged: true # ``` # # to your modules .sync.yml config --- PreCommit: RuboCop: enabled: true description: 'Runs rubocop on modified files only' command: ['bundle', 'exec', 'rubocop'] PuppetLint: enabled: true description: 'Runs puppet-lint on modified files only' command: ['bundle', 'exec', 'puppet-lint'] YamlSyntax: enabled: true JsonSyntax: enabled: true TrailingWhitespace: enabled: true PrePush: RakeTarget: enabled: true description: 'Run rake targets' targets: - 'validate' - 'test' - 'rubocop' command: ['bundle', 'exec', 'rake'] diff --git a/.pmtignore b/.pmtignore index 33a8c65..65f5051 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,34 +1,37 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + docs/ pkg/ Gemfile Gemfile.lock Gemfile.local vendor/ .vendor/ spec/ Rakefile .vagrant/ .bundle/ .ruby-version coverage/ log/ .idea/ .dependencies/ .github/ .librarian/ Puppetfile.lock *.iml .editorconfig .fixtures.yml .gitignore .msync.yml .overcommit.yml .pmtignore .rspec .rspec_parallel .rubocop.yml .sync.yml .*.sw? .yardoc/ .yardopts Dockerfile diff --git a/.rspec b/.rspec index 8c18f1a..f634583 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1,5 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --format documentation --color diff --git a/.rspec_parallel b/.rspec_parallel index e4d136b..a9a84f8 100644 --- a/.rspec_parallel +++ b/.rspec_parallel @@ -1 +1,4 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --format progress diff --git a/.rubocop.yml b/.rubocop.yml index 198a359..53ac189 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,3 +1,6 @@ --- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + inherit_gem: voxpupuli-test: rubocop.yml diff --git a/.yardopts b/.yardopts deleted file mode 100644 index 3687f51..0000000 --- a/.yardopts +++ /dev/null @@ -1,2 +0,0 @@ ---markup markdown ---output-dir docs/ diff --git a/Dockerfile b/Dockerfile index a51c641..e3cf307 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,24 @@ +# MANAGED BY MODULESYNC +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + FROM ruby:2.7 WORKDIR /opt/puppet # https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 RUN mkdir -p /etc/sv ARG PUPPET_VERSION="~> 6.0" ARG PARALLEL_TEST_PROCESSORS=4 # Cache gems COPY Gemfile . RUN bundle install --without system_tests development release --path=${BUNDLE_PATH:-vendor/bundle} COPY . . RUN bundle install RUN bundle exec rake release_checks # Container should not saved RUN exit 1 diff --git a/Gemfile b/Gemfile index f4855f6..d5753f1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,33 +1,34 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + source ENV['GEM_SOURCE'] || "https://rubygems.org" group :test do - gem 'voxpupuli-test', '~> 2.1', :require => false - gem 'coveralls', :require => false - gem 'simplecov-console', :require => false + gem 'voxpupuli-test', '~> 2.5', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false + gem 'puppet_metadata', '~> 1.0', :require => false end group :development do gem 'guard-rake', :require => false gem 'overcommit', '>= 0.39.1', :require => false end group :system_tests do - gem 'puppet_metadata', '~> 0.3.0', :require => false - gem 'voxpupuli-acceptance', :require => false + gem 'voxpupuli-acceptance', '~> 1.0', :require => false end group :release do gem 'github_changelog_generator', '>= 1.16.1', :require => false - gem 'puppet-blacksmith', :require => false - gem 'voxpupuli-release', :require => false + gem 'voxpupuli-release', '>= 1.0.2', :require => false gem 'puppet-strings', '>= 2.2', :require => false end -gem 'puppetlabs_spec_helper', '~> 2.0', :require => false gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_VERSION'] || '~> 6.0' +puppetversion = ENV['PUPPET_VERSION'] || '>= 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index 1e8a898..5dacb6a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,61 +1,72 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + # Attempt to load voxupuli-test (which pulls in puppetlabs_spec_helper), # otherwise attempt to load it directly. begin require 'voxpupuli/test/rake' rescue LoadError - require 'puppetlabs_spec_helper/rake_tasks' + begin + require 'puppetlabs_spec_helper/rake_tasks' + rescue LoadError + end +end + +# load optional tasks for acceptance +# only available if gem group releases is installed +begin + require 'voxpupuli/acceptance/rake' +rescue LoadError end # load optional tasks for releases # only available if gem group releases is installed begin require 'voxpupuli/release/rake_tasks' rescue LoadError end desc "Run main 'test' task and report merged results to coveralls" task test_with_coveralls: [:test] do if Dir.exist?(File.expand_path('../lib', __FILE__)) require 'coveralls/rake/task' Coveralls::RakeTask.new Rake::Task['coveralls:push'].invoke else puts 'Skipping reporting to coveralls. Module has no lib dir' end end desc 'Generate REFERENCE.md' task :reference, [:debug, :backtrace] do |t, args| patterns = '' Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) end begin require 'github_changelog_generator/task' require 'puppet_blacksmith' GitHubChangelogGenerator::RakeTask.new :changelog do |config| - version = (Blacksmith::Modulefile.new).version - config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/ + metadata = Blacksmith::Modulefile.new + config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/ config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} config.user = 'saz' - metadata_json = File.join(File.dirname(__FILE__), 'metadata.json') - metadata = JSON.load(File.read(metadata_json)) - config.project = metadata['name'] + config.project = metadata.metadata['name'] end # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 require 'rbconfig' if RbConfig::CONFIG['host_os'] =~ /linux/ task :changelog do puts 'Fixing line endings...' changelog_file = File.join(__dir__, 'CHANGELOG.md') changelog_txt = File.read(changelog_file) new_contents = changelog_txt.gsub(%r{\r\n}, "\n") File.open(changelog_file, "w") {|file| file.puts new_contents } end end rescue LoadError end # vim: syntax=ruby diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d266f6b..fb5f0cb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,18 +1,17 @@ -# This file is managed via modulesync -# https://github.com/voxpupuli/modulesync -# https://github.com/voxpupuli/modulesync_config +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ # puppetlabs_spec_helper will set up coverage if the env variable is set. # We want to do this if lib exists and it hasn't been explicitly set. ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../../lib', __FILE__)) require 'voxpupuli/test/spec_helper' if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) if facts facts.each do |name, value| add_custom_fact name.to_sym, value end end end