Skip to content

Commit

Permalink
Merge pull request #208 from puppetlabs/CONT-867-ruby_3
Browse files Browse the repository at this point in the history
(CONT-867) Ruby 3 / Puppet 8 Support
  • Loading branch information
GSPatton authored Apr 14, 2023
2 parents 93b5bf3 + 2578395 commit 45a2959
Show file tree
Hide file tree
Showing 23 changed files with 1,128 additions and 564 deletions.
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

72 changes: 24 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,38 @@ jobs:
fail-fast: false
matrix:
ruby_version:
- '2.5'
- '2.7'
name: "spec (ruby ${{ matrix.ruby_version }})"
- '3.2'
include:
- ruby_version: '2.7'
puppet_version: '~> 7.0'
- ruby_version: '3.2'
puppet_version: 'https://github.com/puppetlabs/puppet'
name: "spec (ruby ${{ matrix.ruby_version }} | puppet ${{ matrix.puppet_version }})"
uses: "puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main"
secrets: "inherit"
with:
ruby_version: ${{ matrix.ruby_version }}
puppet_gem_version: ${{ matrix.puppet_version }}

acceptance:
needs: "spec"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- "windows-latest"
- "windows-2019"
puppet:
- '~> 6'
- '~> 7'
ruby_version:
- "2.7"
- "3.2"
include:
- puppet: '~> 6'
ruby: 2.5
- puppet: '~> 7'
ruby: 2.7
env:
PUPPET_GEM_VERSION: ${{ matrix.puppet }}

steps:
- name: "checkout"
uses: "actions/checkout@v3"

- name: "setup ruby"
uses: "ruby/setup-ruby@v1"
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: "bundle environment"
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::
- name: "setup winrm"
shell: "powershell"
run: |
Get-ChildItem WSMan:\localhost\Listener\ -OutVariable Listeners | Format-List * -Force
$HTTPListener = $Listeners | Where-Object -FilterScript { $_.Keys.Contains('Transport=HTTP') }
If ($HTTPListener.Count -eq 0) {
winrm create winrm/config/Listener?Address=*+Transport=HTTP
winrm e winrm/config/listener
}
- name: "acceptance"
shell: "powershell"
run: |
bundle exec rake dsc:acceptance:spec_prep
bundle exec rake dsc:acceptance:spec
- ruby-version: '2.7'
puppet_version: '~> 7.0'
- ruby_version: '3.2'
puppet_version: 'https://github.com/puppetlabs/puppet' # puppet8'
runs_on:
- "windows-latest"
name: "spec (${{ matrix.runs_on}} ruby ${{ matrix.ruby_version }} | puppet ${{ matrix.puppet_version }})"
uses: "./.github/workflows/custom_acceptance.yml"
secrets: "inherit"
with:
ruby_version: ${{ matrix.ruby_version }}
puppet_version: ${{ matrix.puppet_version }}
runs_on: ${{ matrix.runs_on }}
68 changes: 68 additions & 0 deletions .github/workflows/custom_acceptance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This exists so we can force the acceptance tests to run under
# powershell.exe.
#
# For such a small edge case it does not seem sensible adding extra
# complication in to the shared actions at this point.
#
# Hopefully this is only a temporary work-around.
name: "Gem Acceptance"

on:
workflow_call:
inputs:
ruby_version:
description: "The target Ruby version."
required: false
default: "2.7"
type: "string"
puppet_version:
description: "The target Puppet version."
required: false
default: "puppet7-nightly"
type: "string"
rake_task:
description: "The name of the rake task that executes acceptance tests"
required: false
default: "acceptance"
type: "string"
runs_on:
description: "The operating system used for the runner."
required: false
default: "ubuntu-latest"
type: "string"

jobs:
acceptance:
name: "acceptance"
runs-on: ${{ inputs.runs_on }}

env:
PUPPET_GEM_VERSION: ${{ inputs.puppet_version }}

steps:

- name: "checkout"
uses: "actions/checkout@v3"

- name: "export environment"
run: |
echo "PUPPET_GEM_VERSION=${{ inputs.puppet_gem_version }} >> $GITHUB_ENV"
- name: "setup ruby"
uses: "ruby/setup-ruby@v1"
with:
ruby-version: ${{ inputs.ruby_version }}
bundler-cache: true

- name: "bundle environment"
run: |
echo ::group::bundler environment
bundle env
echo ::endgroup::
- name: "execute acceptance tests"
shell: powershell
run: |
# This generic task to run acceptance tests.
# It should be overridden in the Rakefile.
bundle exec rake ${{ inputs.rake_task }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ Gemfile.lock
/spec/fixtures/modules/
/spec/fixtures/test.pp
/spec/fixtures/website/

# Acceptance Testing files
*.tar.gz
21 changes: 0 additions & 21 deletions .pmtignore

This file was deleted.

54 changes: 16 additions & 38 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,19 @@
Gemspec/RequiredRubyVersion:
Enabled: false
Layout/EndOfLine:
Description: Don't enforce CRLF on Windows.
Enabled: false
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 200
Metrics/BlockLength:
Enabled: false
Metrics/MethodLength:
Enabled: false
Metrics/ClassLength:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/AbcSize:
Enabled: false
inherit_from: .rubocop_todo.yml

# requires 2.3's squiggly HEREDOC support, which we can't use, yet
# see http://www.virtuouscode.com/2016/01/06/about-the-ruby-squiggly-heredoc-syntax/
Layout/HeredocIndentation:
Enabled: false
# Need to ignore rubocop complaining about the name of the library.
Naming/FileName:
require:
- rubocop-performance
- rubocop-rspec

AllCops:
Exclude:
- lib/ruby-pwsh.rb
Style/RescueStandardError:
Enabled: false
Style/ExpandPathArguments:
Enabled: false
Style/Documentation:
Enabled: false
- Gemfile
- Rakefile
- spec/fixtures/**/*
- vendor/bundle/**/*
NewCops: enable
SuggestExtensions: false
TargetRubyVersion: '2.7'

# Disabled
Style/ClassAndModuleChildren:
Exclude:
- lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb
Style/ClassVars:
Exclude:
- lib/puppet/provider/dsc_base_provider/dsc_base_provider.rb
Enabled: false
Loading

0 comments on commit 45a2959

Please sign in to comment.