diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b0b8fde..ad71b08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,10 +3,10 @@ name: "ci" on: push: branches: - - "main" + - "master" pull_request: branches: - - "main" + - "master" workflow_dispatch: env: @@ -32,7 +32,7 @@ jobs: uses: "puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main" secrets: "inherit" with: - rake_task: "spec:coverage" + rake_task: "spec" ruby_version: ${{ matrix.ruby_version }} puppet_gem_version: ${{ matrix.puppet_gem_version }} runs_on: ${{ matrix.runs_on }} diff --git a/.github/workflows/mend.yml b/.github/workflows/mend.yml index 095e9e5..33a8e28 100644 --- a/.github/workflows/mend.yml +++ b/.github/workflows/mend.yml @@ -3,7 +3,7 @@ name: "mend" on: pull_request: branches: - - "main" + - "master" schedule: - cron: "0 0 * * *" workflow_dispatch: diff --git a/Gemfile b/Gemfile index 7ae6873..10570a5 100644 --- a/Gemfile +++ b/Gemfile @@ -1,30 +1,54 @@ # frozen_string_literal: true -source 'https://rubygems.org' - -# Find a location or specific version for a gem. place_or_version can be a -# version, which is most often used. It can also be git, which is specified as -# `git://somewhere.git#branch`. You can also use a file source location, which -# is specified as `file://some/location/on/disk`. -def location_for(place_or_version, fake_version = nil) - if place_or_version =~ /^(https[:@][^#]*)#(.*)/ - [fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact - elsif place_or_version =~ %r{^file://(.*)} - ['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }] +# For puppetcore, set GEM_SOURCE_PUPPETCORE = 'https://rubygems-puppetcore.puppet.com' +gemsource_default = ENV['GEM_SOURCE'] || 'https://rubygems.org' +gemsource_puppetcore = if ENV['GEM_SOURCE'] + gemsource_default + elsif ENV['PUPPET_FORGE_TOKEN'] + 'https://rubygems-puppetcore.puppet.com' + else + ENV['GEM_SOURCE_PUPPETCORE'] || gemsource_default + end +source gemsource_default + +gemspec + +def location_for(place_or_version, fake_version = nil, opts = {}) + git_url_regex = /\A(?(?:https?|git)[:@][^#]*)(?:#(?.*))?/ + file_url_regex = %r{\Afile://(?.*)} + + if place_or_version && (git_url = place_or_version.match(git_url_regex)) + [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact + 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 -# Specify your gem's dependencies in puppet-syntax.gemspec -gemspec - # Override gemspec for CI matrix builds. -# But only if the environment variable is set -gem 'openvox', *location_for(ENV['PUPPET_VERSION']) if ENV['PUPPET_VERSION'] +# But only if the environment variable is set. +# Route through gemsource_puppetcore so CI can resolve puppet ~> 9.0 from the +# private Puppetcore registry (public rubygems.org tops out at puppet 8.10.0). +# When PUPPET_FORGE_TOKEN is unset (e.g. fork PRs, local dev without a token), +# gemsource_puppetcore falls through to gemsource_default (public rubygems.org) +# and no auth is attempted against Puppetcore. +gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'], nil, { source: gemsource_puppetcore }) if ENV['PUPPET_GEM_VERSION'] # Puppet on Ruby 3.3 / 3.4 has some missing dependencies gem 'syslog', '~> 0.3' if RUBY_VERSION >= '3.4' +# Windows platform runtime deps. The published puppet/openvox rubygems.org +# artefacts are built on Linux and guard `ffi` / `win32ole` with build-host +# platform checks, so those deps never make it into the Linux-published +# artefact. Ruby 3.4+ removed win32ole from default gems, making the missing +# declaration fatal at require-time on Windows. Declaring them here in the +# Gemfile is evaluated on the install host at bundle time, so bundler pulls +# them on Windows only. +platforms :mingw, :x64_mingw, :mswin do + gem 'ffi', '>= 1.15.5', '< 1.17.0', '!= 1.16.0', '!= 1.16.1', '!= 1.16.2' + gem 'win32ole', '>= 1.8', '< 2.0' +end + group :test do gem 'rspec' end diff --git a/puppet-syntax.gemspec b/puppet-syntax.gemspec index 5101001..7533a6e 100644 --- a/puppet-syntax.gemspec +++ b/puppet-syntax.gemspec @@ -7,20 +7,21 @@ require 'puppet-syntax/version' Gem::Specification.new do |spec| spec.name = 'puppet-syntax' spec.version = PuppetSyntax::VERSION - spec.authors = ['Vox Pupuli'] - spec.email = ['voxpupuli@groups.io'] - spec.description = 'Syntax checks for Puppet manifests and templates' + spec.email = ['modules-team@puppet.com'] + spec.authors = ['Puppet, Inc.'] spec.summary = 'Syntax checks for Puppet manifests, templates, and Hiera YAML' - spec.homepage = 'https://github.com/voxpupuli/puppet-syntax' + spec.homepage = 'https://github.com/puppetlabs/puppetlabs-syntax/' spec.license = 'MIT' - + spec.description = <<-DESC + Syntax checks for Puppet manifests and templates. + DESC spec.files = `git ls-files`.split($/) spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ['lib'] spec.required_ruby_version = '>= 3.2' - spec.add_dependency 'openvox', '>= 8', '< 9' + spec.add_dependency 'puppet', '>= 8', '< 10' spec.add_dependency 'rake', '~> 13.1' spec.add_development_dependency 'voxpupuli-rubocop', '~> 5.2.0'