From 9022983dbf2f33e1cf15035f9f4c4717960810a1 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 25 Nov 2020 17:37:20 +0100 Subject: [PATCH] modulesync 4.0.0 --- .github/CONTRIBUTING.md | 5 +- .github/workflows/ci.yml | 75 ++++++++++++++++++++++++ .github/workflows/release.yml | 29 ++++++++++ .msync.yml | 2 +- .pmtignore | 17 +++++- .sync.yml | 12 +--- .travis.yml | 105 ---------------------------------- Gemfile | 27 ++------- Rakefile | 9 ++- 9 files changed, 138 insertions(+), 143 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index cace33e6..f1f88ccf 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -232,14 +232,14 @@ simple tests against it after applying the module. You can run this with: ```sh -bundle exec rake acceptance +bundle exec rake beaker ``` This will run the tests on the module's default nodeset. You can override the nodeset used, e.g., ```sh -BEAKER_set=centos-7-x64 bundle exec rake acceptance +BEAKER_set=centos-7-x64 bundle exec rake beaker ``` There are default rake tasks for the various acceptance test modules, e.g., @@ -269,7 +269,6 @@ The following strings are known to work: * ubuntu2004 * debian9 * debian10 -* centos6 * centos7 * centos8 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..1ea40adc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,75 @@ +name: CI + +on: pull_request + +jobs: + setup_matrix: + name: 'Setup Test Matrix' + runs-on: ubuntu-latest + 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 }} + env: + BUNDLE_WITHOUT: development:test:release + steps: + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Run rake validate + run: bundle exec rake validate + - name: Setup Test Matrix + id: get-outputs + run: bundle exec metadata2gha --use-fqdn --pidfile-workaround CentOS + + unit: + needs: setup_matrix + runs-on: ubuntu-latest + 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 + + acceptance: + needs: setup_matrix + runs-on: ubuntu-latest + env: + BUNDLE_WITHOUT: development:test:release + strategy: + fail-fast: false + matrix: + setfile: ${{fromJson(needs.setup_matrix.outputs.beaker_setfiles)}} + puppet: ${{fromJson(needs.setup_matrix.outputs.puppet_major_versions)}} + name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }} + steps: + - name: Enable IPv6 on docker + run: | + echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json + sudo service docker restart + - uses: actions/checkout@v2 + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7' + bundler-cache: true + - name: Run tests + run: bundle exec rake beaker + env: + BEAKER_PUPPET_COLLECTION: ${{ matrix.puppet.collection }} + BEAKER_setfile: ${{ matrix.setfile.value }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..68b85284 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: Release + +on: + push: + tags: + - '*' + +env: + BUNDLE_WITHOUT: development:test:system_tests + +jobs: + deploy: + name: 'deploy to forge' + runs-on: ubuntu-latest + 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/.msync.yml b/.msync.yml index 5758aced..a0770a83 100644 --- a/.msync.yml +++ b/.msync.yml @@ -1,2 +1,2 @@ --- -modulesync_config_version: '3.1.0' +modulesync_config_version: '4.0.0' diff --git a/.pmtignore b/.pmtignore index 4e6d54b8..33a8c65d 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,11 +1,12 @@ docs/ pkg/ +Gemfile Gemfile.lock Gemfile.local vendor/ .vendor/ -spec/fixtures/manifests/ -spec/fixtures/modules/ +spec/ +Rakefile .vagrant/ .bundle/ .ruby-version @@ -13,9 +14,21 @@ 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/.sync.yml b/.sync.yml index bb66f7cd..a7598685 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,14 +1,6 @@ --- -.travis.yml: - secure: "LlUcdbmw7l791vD0samUkh2cuyUF49JTjlb9jIoVUYH7ZIJywSl5hZGVLmUhr4aKhPIWhLG1psAeRtjzi3xtgxP+C78RtjIZ1TE/Jglloe0heKz8E3yUfXbl/GX1B5uQhIoIZaqPZd2OuINSC4P9NvsTfai3i85JNXYs5w5QTaLToS6fU+Gb9iut8KCSPeFdA7EEDDcNJUyMVUTuc5w7/rIcPIy7AXXDDkJNdPM8m70b8Skm18afkZZ1LmwpNnsf+l1vQqtId2QyetyFOW566chSgEbswfWFxJL7g37d4l5rVBwkV/vN8iNc5NIc6oih2IqpX8fcEmx1lQ4P8mfvIm32FJ9pI1Utg80vlhzzOFrENyHyTbQ6d0fNdGo85q2ZBdXVuv+/Bq4xsXHkqke/JXMzDtGpCfLKBaY97Jlo56T313DY8NQTbO3svaazJn2EZTC0qIZ0TBBdr3qAbuF5myanxlhBcH/cpMr6rJ/7KS4XNcQPbzvompWeNoFgn0Lp49/HfX2hhGKOyRplCpO7zXzwe1WvVOh3mk5fPmHrYYffzXME0Mx0REuJGCxavsAIf26PS0+/8EMGTHemkeuRj1ISwBHkBdiiJtjIv40gcwoiTqxZsUa+aNqFb6ACN8c3jJa7slbBemUFODVc8zklYw6Dd+ojIAzIaH/eY4co3IY=" - docker_sets: - - set: ubuntu1604-64 - - set: ubuntu1804-64 - - set: centos6-64 - - set: 'centos7-64{image=centos:7.6.1810}' - - set: debian8-64 - - set: debian9-64 - - set: debian10-64 +.github/workflows/ci.yml: + pidfile_workaround: CentOS Gemfile: optional: ':test': diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3edec8c0..00000000 --- a/.travis.yml +++ /dev/null @@ -1,105 +0,0 @@ ---- -# yamllint disable rule:line-length rule:truthy -os: linux -dist: focal -language: ruby -cache: bundler -before_install: - - yes | gem update --system - - bundle --version -script: - - 'bundle exec rake $CHECK' -jobs: - fast_finish: true - include: - - rvm: 2.4.4 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=test - - rvm: 2.5.3 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 6.0" CHECK=test_with_coveralls - - rvm: 2.5.3 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 6.0" CHECK=rubocop - - rvm: 2.4.4 - bundler_args: --without system_tests development release - env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1604-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1604-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=ubuntu1804-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=ubuntu1804-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos6-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos6-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=centos7-64{image=centos:7.6.1810} CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=centos7-64{image=centos:7.6.1810} CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian8-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian8-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian9-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian9-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_setfile=debian10-64 CHECK=beaker - services: docker - - rvm: 2.5.3 - bundler_args: --without development release - env: BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_setfile=debian10-64 CHECK=beaker - services: docker -branches: - only: - - master - - /^v\d/ -notifications: - email: false - webhooks: https://voxpupu.li/incoming/travis - irc: - on_success: always - on_failure: always - channels: - - "chat.freenode.org#voxpupuli-notifications" -deploy: - provider: puppetforge - username: puppet - password: - secure: "LlUcdbmw7l791vD0samUkh2cuyUF49JTjlb9jIoVUYH7ZIJywSl5hZGVLmUhr4aKhPIWhLG1psAeRtjzi3xtgxP+C78RtjIZ1TE/Jglloe0heKz8E3yUfXbl/GX1B5uQhIoIZaqPZd2OuINSC4P9NvsTfai3i85JNXYs5w5QTaLToS6fU+Gb9iut8KCSPeFdA7EEDDcNJUyMVUTuc5w7/rIcPIy7AXXDDkJNdPM8m70b8Skm18afkZZ1LmwpNnsf+l1vQqtId2QyetyFOW566chSgEbswfWFxJL7g37d4l5rVBwkV/vN8iNc5NIc6oih2IqpX8fcEmx1lQ4P8mfvIm32FJ9pI1Utg80vlhzzOFrENyHyTbQ6d0fNdGo85q2ZBdXVuv+/Bq4xsXHkqke/JXMzDtGpCfLKBaY97Jlo56T313DY8NQTbO3svaazJn2EZTC0qIZ0TBBdr3qAbuF5myanxlhBcH/cpMr6rJ/7KS4XNcQPbzvompWeNoFgn0Lp49/HfX2hhGKOyRplCpO7zXzwe1WvVOh3mk5fPmHrYYffzXME0Mx0REuJGCxavsAIf26PS0+/8EMGTHemkeuRj1ISwBHkBdiiJtjIv40gcwoiTqxZsUa+aNqFb6ACN8c3jJa7slbBemUFODVc8zklYw6Dd+ojIAzIaH/eY4co3IY=" - on: - tags: true - # all_branches is required to use tags - all_branches: true - # Only publish the build marked with "DEPLOY_TO_FORGE" - condition: "$DEPLOY_TO_FORGE = yes" diff --git a/Gemfile b/Gemfile index df44af06..53c14917 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,5 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" -def location_for(place, fake_version = nil) - if place =~ /^(git[:@][^#]*)#(.*)/ - [fake_version, { :git => $1, :branch => $2, :require => false }].compact - elsif place =~ /^file:\/\/(.*)/ - ['>= 0', { :path => File.expand_path($1), :require => false }] - else - [place, { :require => false }] - end -end - group :test do gem 'voxpupuli-test', '~> 2.1', :require => false gem 'coveralls', :require => false @@ -18,14 +8,13 @@ group :test do end group :development do - gem 'travis', :require => false - gem 'travis-lint', :require => false gem 'guard-rake', :require => false gem 'overcommit', '>= 0.39.1', :require => false end group :system_tests do - gem 'voxpupuli-acceptance', :require => false + gem 'puppet_metadata', '~> 0.3.0', :require => false + gem 'voxpupuli-acceptance', :require => false end group :release do @@ -35,15 +24,11 @@ group :release do 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] - -if facterversion = ENV['FACTER_GEM_VERSION'] - gem 'facter', facterversion.to_s, :require => false, :groups => [:test] -else - gem 'facter', :require => false, :groups => [:test] -end - -ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 6.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +puppetversion = ENV['PUPPET_VERSION'] || '~> 6.0' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index b450fe7b..d1bf7491 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,10 @@ -require 'voxpupuli/test/rake' +# 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' +end # load optional tasks for releases # only available if gem group releases is installed @@ -26,6 +32,7 @@ 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+$/