diff --git a/.travis.yml b/.travis.yml index f97fbd1..6c984d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,61 @@ +--- +os: linux language: ruby -script: "bundle exec rspec spec" +cache: bundler + +stages: + - smoke + - test + +rvm: + - 2.7 + - 2.5 + - 2.4 + - 2.3 + - 2.1 + +env: + - SET=dev + - SET=system + +script: | + # test installing the gems from $SET on this ruby version + set -e + + echo create gems + bundle exec ./exe/build-gems.rb + + mkdir test + cd test + export BUNDLE_GEMFILE=./Gemfile + + cat <Gemfile + source 'https://rubygems.org' + ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments + minor_version = ruby_version_segments[0..1].join('.') + gem "puppet-module-posix-default-r#{minor_version}", :path => '../pkg' + gem "puppet-module-posix-dev-r#{minor_version}", :path => '../pkg' + gem "puppet-module-posix-system-r#{minor_version}", :path => '../pkg' if ENV['SET'] == 'system' + EOF + + echo setting up gem path for caching + bundle config path ../vendor/bundle + + cat Gemfile + + echo testing installability of the puppet-module-gems + bundle install + + cat Gemfile.lock + +jobs: + include: + - stage: smoke + name: "Make sure that gems build" + script: bundle exec ./exe/build-gems.rb + - stage: smoke + name: "Unit Tests" + script: bundle exec rspec spec + notifications: email: false -rvm: - - 2.3.1 diff --git a/README.md b/README.md index c343147..52476e8 100644 --- a/README.md +++ b/README.md @@ -67,9 +67,9 @@ group :development do end group :system_tests do - gem 'beaker-puppet_install_helper', :require => false - gem 'beaker-module_install_helper', :require => false - gem 'master_manipulator', :require => false + gem 'beaker-puppet_install_helper', :require => false + gem 'beaker-module_install_helper', :require => false + gem 'master_manipulator', :require => false end ``` @@ -178,41 +178,47 @@ And for example, the gemspec for `test-gem-first-a-1.0.0.gem` will include depen ## Testing Changes - Check out a clean copy from master. +- Clean out the contents of the `pkg` directory. - Run `bundle exec exe/build-gems.rb` to build the gems into the `pkg` directory. - Confirm `pkg` directory contains a variety of `.gem` and .`gemspec` files. - Locate a module that is making use of puppet-module-gems. -- Edit the Gemfile and point the gems to the local copy of your gems. +- Edit the Gemfile and point the gems to the local copy of your gems, using the `:path` directive. **Example** ```ruby group :development do - gem "puppet-module-posix-default-r#{minor_version}", :require => false, :platforms => "ruby", :path => '/Users/paula/workspace/puppet-module-gems/pkg/' - gem "puppet-module-win-default-r#{minor_version}", :require => false, :platforms => ["mswin", "mingw", "x64_mingw"], :path => '/Users/paula/workspace/puppet-module-gems/pkg/' - gem "puppet-module-posix-dev-r#{minor_version}", :require => false, :platforms => "ruby", :path => '/Users/paula/workspace/puppet-module-gems/pkg/' - gem "puppet-module-win-dev-r#{minor_version}", '0.0.7', :require => false, :platforms => ["mswin", "mingw", "x64_mingw"], :path => '/Users/paula/workspace/puppet-module-gems/pkg/' - gem "json_pure", '<= 2.0.1', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') - gem "fast_gettext", '1.1.0', :require => false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') - gem "fast_gettext", :require => false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') + gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: "ruby", path: '/Users/paula/workspace/puppet-module-gems/pkg/' + gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: ["mswin", "mingw", "x64_mingw"], path: '/Users/paula/workspace/puppet-module-gems/pkg/' + gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: "ruby", :path => '/Users/paula/workspace/puppet-module-gems/pkg/' + gem "puppet-module-win-dev-r#{minor_version}", '0.0.7', require: false, platforms: ["mswin", "mingw", "x64_mingw"], :path => '/Users/paula/workspace/puppet-module-gems/pkg/' + gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') + gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') + gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') end ``` -- Ensure the Gemfile is generated as expected by running `bundle install --path .bundle/gems/` +- Ensure the `Gemfile.lock` is generated as expected by running `bundle install`. +- Compare the installed gems vs earlier versions by saving and comparing `Gemfile.lock` files from different incantations. ## Testing changes on a bigger scale -To test potentially harmful changes with a module on travis / appveyor / another build system. You can use a third party gem repository. +To test potentially harmful changes with modules on travis, appveyor, or another build systems. You can use a third party gem repository. We recommend using the [cloudsmith](https://cloudsmith.com/) offering, as it provides native integration into the ruby tool set. Sign up there with your github account and create a open source repository pointing back to this github repo. -- bump your version of config.info to something higher than the current release +- copy your API key (from Account -> Settings -> API Settings -> API key) into `~/.gem/credentials` as `:cloudsmith: "Token _the_api_key_here_"` +- bump your version of config.info to something higher than the current release (e.g. '0.4.4' -> '0.4.5'; note that bundler doesn't deal with pre-release versions) - make your changes in puppet-module-gems -- build your packages -- open your gemfury account and upload the gems ie https://manage.fury.io/dashboard/ -- Update the module and edit its gemfile to point at gemfury +- build your packages as described above +- Upload all the gems by running + ``` + for i in pkg/puppet-module-*.gem; do gem push $i --host https://ruby.cloudsmith.io/david-schmitt/pmg-test --key cloudsmith & done; wait + ``` + or similar in your shell +- Update the module and edit its Gemfile to retrieve the puppet-module-gems from `source: 'https://dl.cloudsmith.io/public/david-schmitt/pmg-test/ruby/'`: ``` -source 'https://@gem.fury.io//' -gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby], :source => "https://@gem.fury.io//" +gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby], source: 'https://dl.cloudsmith.io/public/david-schmitt/pmg-test/ruby/' ``` -NB remember to use your actual token. -- test locally, then create your pr for the module. -- check travis / appveyor / build system for your pass / fails. +NB remember to use your actual token and repo URL and unset the +- test locally, then create your pr for the module. +- check travis / appveyor / build system for your pass / fails. ## Limitations @@ -221,4 +227,4 @@ Use of this utility has only been tested on Linux and OS-X platforms. ## Support -This utility is maintained and developed by the Puppet SDK and Puppet Modules team. Please file an [issue](https://github.com/puppetlabs/puppet-module-gems/issues) for support. [Contributions](https://github.com/puppetlabs/puppet-module-gems/blob/master/CONTRIBUTING.md) are also welcomed! +These scripts and gems are maintained by the [IAC team](https://puppetlabs.github.io/iac/). Please file an [issue](https://github.com/puppetlabs/puppet-module-gems/issues) for support. [Contributions](https://github.com/puppetlabs/puppet-module-gems/blob/master/CONTRIBUTING.md) are also welcomed! diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..a9eab12 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,66 @@ +--- +version: 1.1.x.{build} + +cache: + - vendor/bundle + +environment: + matrix: + - RUBY_VERSION: 21-x64 + SET: dev + - RUBY_VERSION: 21-x64 + SET: system + - RUBY_VERSION: 23-x64 + SET: dev + - RUBY_VERSION: 23-x64 + SET: system + - RUBY_VERSION: 24-x64 + SET: dev + - RUBY_VERSION: 24-x64 + SET: system + - RUBY_VERSION: 25-x64 + SET: dev + - RUBY_VERSION: 25-x64 + SET: system + +install: + - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH% + - bundle install --jobs 4 --retry 2 + - bundle exec rspec spec + - bundle exec ruby ./exe/build-gems.rb + +build: off + +test_script: + - ps: | + New-Item test -ItemType Directory + + Set-Location test + + Set-Content Gemfile -Value @' + source 'https://rubygems.org' + ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments + minor_version = ruby_version_segments[0..1].join('.') + gem "puppet-module-posix-default-r#{minor_version}", :path => '../pkg' + gem "puppet-module-posix-dev-r#{minor_version}", :path => '../pkg' + gem "puppet-module-posix-system-r#{minor_version}", :path => '../pkg' if ENV['SET'] == 'system' + '@ + + Write-Host "setting up gem path for caching" + & bundle config path ../vendor/bundle + if ($LastExitCode -ne 0) { exit $LastExitCode } + + Get-Content ./Gemfile | Write-Host + Write-Host "testing installability of the puppet-module-gems" + & bundle install + if ($LastExitCode -ne 0) { exit $LastExitCode } + + Get-Content ./Gemfile.lock | Write-Host + +notifications: + - provider: Email + to: + - nobody@example.com + on_build_success: false + on_build_failure: false + on_build_status_changed: false diff --git a/config/dependencies.yml b/config/dependencies.yml index 77bc40a..5b90840 100644 --- a/config/dependencies.yml +++ b/config/dependencies.yml @@ -7,78 +7,128 @@ dependencies: r2.4: r2.5: r2.6: + r2.7: dev: shared: - - gem: activesupport - version: ['>=5.0.0', '< 6.0.0'] - gem: codecov version: '~> 0.1.10' + reason: 'part of the default toolset install; 0.1.10 stopped failing the build on upload failures' - gem: 'concurrent-ruby' version: '!= 1.1.6' - reason: 'https://github.com/ruby-concurrency/concurrent-ruby/issues/849' + reason: 'used by puppet and many others; skip 1.1.6 because of this issue: https://github.com/ruby-concurrency/concurrent-ruby/issues/849' - gem: dependency_checker version: '~> 0.2' + reason: 'part of the default toolset install' - gem: facterdb version: ['>= 0.8.1', '< 2.0.0'] + reason: 'part of the default toolset install' - gem: gettext-setup version: '~> 0.26' + reason: 'part of the default toolset install' - gem: metadata-json-lint version: ['>= 2.0.2', '< 3.0.0'] + reason: 'part of the default toolset install' - gem: mocha version: ['>= 1.0.0', '< 1.2.0'] + reason: 'part of the legacy toolset install; some breakage with 1.2.0 made us stop updating' - gem: parallel_tests version: ['>= 2.14.1', '< 2.14.3'] - - gem: parser - version: '~> 2.5.1.2' + reason: 'part of the default toolset install' - gem: pry version: '~> 0.10.4' + reason: 'part of the default toolset install' - gem: puppet-debugger version: '~> 0.18' + reason: 'part of the default toolset install' - gem: puppet-lint version: ['>= 2.3.0', '< 3.0.0'] + reason: 'part of the default toolset install' - gem: puppet_pot_generator version: '~> 1.0' + reason: 'part of the default toolset install' - gem: puppet-strings version: '~> 2.0' + reason: 'part of the default toolset install' - gem: puppet-resource_api - version: '~> 1.6' # 1.6 is still supported for puppet6/johnson/2019.0 until August 2019 + version: '~> 1.8' + reason: 'part of the default toolset install' - gem: puppet-syntax version: ['>= 2.4.1', '< 3.0.0'] + reason: 'part of the default toolset install' - gem: puppetlabs_spec_helper version: ['>= 2.9.0', '< 3.0.0'] + reason: 'part of the default toolset install' - gem: rainbow version: '~> 2.0' - gem: rspec-puppet version: ['>= 2.3.2', '< 3.0.0'] + reason: 'part of the default toolset install' - gem: rspec-puppet-facts version: '~> 1.10.0' + reason: 'part of the default toolset install' - gem: rubocop version: '~> 0.49.0' + reason: 'part of the default toolset install; pinned to this specific version as this is what the pdk-templates are using' - gem: rubocop-i18n version: '~> 1.2.0' + reason: 'part of the default toolset install; pinned to this specific version as this is what the pdk-templates are using' - gem: rubocop-rspec version: '~> 1.16.0' + reason: 'part of the default toolset install; pinned to this specific version as this is what the pdk-templates are using' - gem: rspec_junit_formatter version: '~> 0.2' - gem: serverspec version: '~> 2.41' + reason: 'part of the default toolset install' - gem: simplecov-console version: '~> 0.4.2' + reason: 'part of the default toolset install' - gem: specinfra version: '2.82.2' + reason: 'part of the default toolset install' r2.1: + - gem: net-ssh + version: '~> 4.2.0' + reason: "older version required for Ruby 2.1" - gem: net-telnet version: '~> 0.1.1' - gem: i18n version: ['>= 1.0.0', '< 1.5.2'] + - gem: simplecov + version: '< 0.18.0' + reason: "part of the default toolset install; v0.18 requires ruby 2.4 or later" r2.3: + - gem: activesupport + version: ['>=5.0.0', '< 6.0.0'] + reason: "required by github_changelog_generator; v6 requires ruby 2.5 or later" + - gem: simplecov + version: '< 0.18.0' + reason: "part of the default toolset install; v0.18 requires ruby 2.4 or later" r2.4: + - gem: activesupport + version: ['>=5.0.0', '< 6.0.0'] + reason: "required by github_changelog_generator; v6 requires ruby 2.5 or later" r2.5: + - gem: activesupport + version: ['>=5.0.0', '< 6.0.0'] + reason: "required by github_changelog_generator; v6 requires ruby 2.5 or later" - gem: puppet_litmus version: ['>= 0.4.0', '< 1.0.0'] + reason: 'part of the default toolset install; requires ruby 2.5 or later (for bolt)' r2.6: + - gem: activesupport + version: '~> 6.0' + reason: "required by github_changelog_generator; v6 requires ruby 2.5 or later" - gem: puppet_litmus version: ['>= 0.4.0', '< 1.0.0'] + reason: 'part of the default toolset install; requires ruby 2.5 or later (for bolt)' + r2.7: + - gem: activesupport + version: '~> 6.0' + reason: "required by github_changelog_generator; v6 requires ruby 2.5 or later" + - gem: puppet_litmus + version: ['>= 0.4.0', '< 1.0.0'] + reason: 'part of the default toolset install; requires ruby 2.5 or later (for bolt)' system: shared: - gem: beaker-i18n_helper @@ -123,11 +173,16 @@ dependencies: - gem: fog-openstack version: '0.1.25' - gem: net-ssh - version: '~> 4.2.0' # Required for older Ruby version + version: '~> 4.2.0' + reason: "Required for Ruby 2.1" + - gem: nokogiri + version: '< 1.10.0' + reason: "Ruby 2.1 support was dropped in 1.10.0" r2.3: r2.4: r2.5: r2.6: + r2.7: posix: default: r2.1: @@ -135,23 +190,46 @@ dependencies: r2.4: r2.5: r2.6: + r2.7: dev: shared: - - gem: simplecov - version: ['>= 0.14.1', '< 1.0.0'] - - gem: puppet-blacksmith - version: '>= 3.4.0' + - gem: ed25519 + version: '~> 1.2' + reason: 'required for ed25519 keys when using bolt, but fails building on windows in bolt and pdk native packaging; see https://tickets.puppetlabs.com/browse/BOLT-1296 and puppetlabs/bolt#1337 for details.' + - gem: bcrypt_pbkdf + version: '~> 1.0' + reason: 'required for ed25519 keys when using bolt, but fails building on windows in bolt and pdk native packaging; see https://tickets.puppetlabs.com/browse/BOLT-1296 and puppetlabs/bolt#1337 for details.' r2.1: + - gem: puppet-blacksmith + version: '< 5.0' + reason: 'part of the default toolset install; 5.0 dropped ruby <2.4 support' r2.3: + - gem: puppet-blacksmith + version: '< 5.0' + reason: 'part of the default toolset install; 5.0 dropped ruby <2.4 support' r2.4: + - gem: puppet-blacksmith + version: '~> 6.0' + reason: 'part of the default toolset install; 5.0 dropped ruby <2.4 support' r2.5: + - gem: puppet-blacksmith + version: '~> 6.0' + reason: 'part of the default toolset install; 5.0 dropped ruby <2.4 support' r2.6: + - gem: puppet-blacksmith + version: '~> 6.0' + reason: 'part of the default toolset install; 5.0 dropped ruby <2.4 support' + r2.7: + - gem: puppet-blacksmith + version: '~> 6.0' + reason: 'part of the default toolset install; 5.0 dropped ruby <2.4 support' system: r2.1: r2.3: r2.4: r2.5: r2.6: + r2.7: win: default: shared: @@ -162,15 +240,18 @@ dependencies: r2.4: r2.5: r2.6: + r2.7: dev: r2.1: r2.3: r2.4: r2.5: r2.6: + r2.7: system: r2.1: r2.3: r2.4: r2.5: r2.6: + r2.7: