diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0335036..aab2a85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,9 +19,12 @@ jobs: matrix: ruby_version: - "3.2" + - "4.0" include: - ruby_version: '3.2' puppet_gem_version: '~> 8.0' # puppet8' + - ruby_version: '4.0' + puppet_gem_version: '~> 9.0' runs_on: - "ubuntu-latest" - "windows-latest" @@ -40,9 +43,12 @@ jobs: matrix: ruby_version: - "3.2" + - "4.0" include: - ruby_version: '3.2' puppet_gem_version: 'https://github.com/puppetlabs/puppet' # puppet8' + - ruby_version: '4.0' + puppet_gem_version: '~> 9.0' runs_on: - "ubuntu-latest" - "windows-latest" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index e59dc41..46e29eb 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -12,9 +12,12 @@ jobs: matrix: ruby_version: - "3.2" + - "4.0" include: - ruby_version: '3.2' puppet_gem_version: 'https://github.com/puppetlabs/puppet' # puppet8' + - ruby_version: '4.0' + puppet_gem_version: '~> 9.0' runs_on: - "ubuntu-latest" - "windows-latest" @@ -32,9 +35,12 @@ jobs: matrix: ruby_version: - "3.2" + - "4.0" include: - ruby_version: '3.2' puppet_gem_version: 'https://github.com/puppetlabs/puppet' # puppet8' + - ruby_version: '4.0' + puppet_gem_version: '~> 9.0' runs_on: - "ubuntu-latest" - "windows-latest" diff --git a/Gemfile b/Gemfile index f507871..6b4d713 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,18 @@ # frozen_string_literal: true -source 'https://rubygems.org' +# For puppetcore, set GEM_SOURCE_PUPPETCORE = 'https://rubygems-puppetcore.puppet.com' +gemsource_default = ENV['GEM_SOURCE'] || 'https://rubygems.org' +gemsource_puppetcore = if ENV['PUPPET_FORGE_TOKEN'].to_s.empty? + ENV['GEM_SOURCE_PUPPETCORE'] || gemsource_default + else + 'https://rubygems-puppetcore.puppet.com' + end +source gemsource_default # Specify your gem's dependencies in puppet-modulebuilder.gemspec gemspec -def location_for(place_or_version, fake_version = nil) +def location_for(place_or_version, fake_version = nil, opts = {}) git_url_regex = /\A(?(https?|git)[:@][^#]*)(#(?.*))?/ file_url_regex = %r{\Afile://(?.*)} @@ -14,12 +21,12 @@ def location_for(place_or_version, fake_version = nil) elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] else - [place_or_version, { require: false }] + [place_or_version, { require: false }.merge(opts)] end end group :development do - gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION']) + gem 'puppet', *location_for(ENV.fetch('PUPPET_GEM_VERSION', nil), nil, { source: gemsource_puppetcore }) gem 'rake' gem 'rspec', '~> 3.1' @@ -29,6 +36,9 @@ group :development do # Required for testing on Windows gem 'ffi', platforms: [:x64_mingw] + # Ruby 4.0 unbundled win32ole from the standard library; puppet's Windows code still + # expects it to just be there. + gem 'win32ole', platforms: [:x64_mingw] # puppet-modulebuilder supports minitar 0.x and 1.x # puppet 8.10.0 can use `tar` (the linux CLI tool) *or* minitar 0.x # on windows, puppet 8.10 defaults to minitar