Skip to content

Commit

Permalink
Merge pull request #43 from puppetlabs/CONT-704-Implement_reusable_wo…
Browse files Browse the repository at this point in the history
…rkflows

(CONT-704) - Implement reusable workflows
  • Loading branch information
chelnak authored Mar 14, 2023
2 parents 9f93612 + b8a108b commit 612d8af
Show file tree
Hide file tree
Showing 12 changed files with 142 additions and 49 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "ci"

on:
pull_request:
branches:
- "main"
workflow_dispatch:

jobs:
spec:
strategy:
fail-fast: false
matrix:
ruby_version:
- "2.5"
- "2.7"
puppet_gem_version:
- '~> 6.0'
- '~> 7.0'
runs_on:
- "ubuntu-latest"
- "windows-latest"
name: "spec (${{ matrix.runs_on }} ruby ${{ matrix.ruby_version }} | puppet ${{matrix.puppet_gem_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_gem_version }}
runs_on: ${{ matrix.runs_on }}
22 changes: 22 additions & 0 deletions .github/workflows/labeller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: community-labeller

on:
issues:
types:
- "opened"
pull_request_target:
types:
- "opened"

jobs:
label:
runs-on: "ubuntu-latest"
steps:

- uses: "puppetlabs/community-labeller@v0"
name: "Label issues or pull requests"
with:
label_name: "community"
label_color: '5319e7'
org_membership: "puppetlabs"
token: ${{ secrets.IAC_COMMUNITY_LABELER }}
37 changes: 0 additions & 37 deletions .github/workflows/main.yml

This file was deleted.

28 changes: 28 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: "nightly"

on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
spec:
strategy:
fail-fast: false
matrix:
ruby_version:
- "2.5"
- "2.7"
puppet_gem_version:
- '~> 6.0'
- '~> 7.0'
runs_on:
- "ubuntu-latest"
- "windows-latest"
name: "spec (${{ matrix.runs_on }} ruby ${{ matrix.ruby_version }} | puppet ${{matrix.puppet_gem_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_gem_version }}
runs_on: ${{ matrix.runs_on }}
16 changes: 16 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "release"

on:
workflow_dispatch:
inputs:
target:
description: "The target for the release. This can be a commit sha or a branch."
required: false
default: "main"

jobs:
release:
uses: "puppetlabs/cat-github-actions/.github/workflows/gem_release.yml@main"
with:
target: "${{ github.event.inputs.target }}"
secrets: "inherit"
20 changes: 20 additions & 0 deletions .github/workflows/release_prep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: "release prep"

on:
workflow_dispatch:
inputs:
target:
description: "The target for the release. This can be a commit sha or a branch."
required: false
default: "main"
version:
description: "Version of gem to be released."
required: true

jobs:
release_prep:
uses: "puppetlabs/cat-github-actions/.github/workflows/gem_release_prep.yml@main"
with:
target: "${{ github.event.inputs.target }}"
version: "${{ github.events.inputs.version }}"
secrets: "inherit"
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Silencing rubocop warnings until https://tickets.puppetlabs.com/browse/CONT-725
# is completed
AllCops:
DisabledByDefault: true
11 changes: 6 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ if RUBY_VERSION =~ /^1\.?9/
gem 'ffi', '<= 1.9.14'
end

gem 'rspec', *location_for(ENV['RSPEC_GEM_VERSION'] || '~> 3.0')
gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION'] || '~> 7.0')
gem 'facter', *location_for(ENV['FACTER_GEM_VERSION'] || '~> 4.0')
gem 'rspec', *location_for(!ENV['RSPEC_GEM_VERSION']&.empty? ? ENV['RSPEC_GEM_VERSION'] : '~> 3.0')
gem 'puppet', *location_for(!ENV['PUPPET_GEM_VERSION']&.empty? ? ENV['PUPPET_GEM_VERSION'] : '~> 7.0')
gem 'facter', *location_for(!ENV['FACTER_GEM_VERSION']&.empty? ? ENV['FACTER_GEM_VERSION'] : '~> 4.0')
gem 'pry', :group => :development

if RUBY_VERSION =~ /^1\.?/
Expand All @@ -38,8 +38,9 @@ if RUBY_VERSION =~ /^1\.?9/
elsif RUBY_VERSION =~ /^1\.?8/
gem 'json_pure', '< 2.0.0'
else
gem 'rubocop'
gem 'rubocop-rspec', '~> 1.6' if (RUBY_VERSION >= '2.3.0' || RUBY_VERSION >= '23')
gem "rubocop", '= 1.6.1', require: false
gem "rubocop-performance", '= 1.9.1', require: false
gem "rubocop-rspec", '= 2.0.1', require: false
gem 'sync' if (RUBY_VERSION >= '2.7.0')
end

Expand Down
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'rake'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'bundler/gem_tasks'
require 'fileutils'
require 'puppet'
Expand Down Expand Up @@ -89,3 +90,7 @@ task :test do
Rake::Task['test:teardown'].invoke
end
end

RuboCop::RakeTask.new(:rubocop) do |task|
task.options = %w[-D -S -E]
end
5 changes: 5 additions & 0 deletions lib/rspec-puppet/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#frozen_string_literal: true

module RSpecPuppet
VERSION ||= '2.12.0'
end
6 changes: 5 additions & 1 deletion rspec-puppet.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'rspec-puppet/version'

Gem::Specification.new do |s|
s.name = 'rspec-puppet'
s.version = '2.12.0'
s.version = RSpecPuppet::VERSION
s.homepage = 'https://github.com/puppetlabs/rspec-puppet/'
s.summary = 'RSpec tests for your Puppet manifests'
s.description = 'RSpec tests for your Puppet manifests'
Expand Down
8 changes: 2 additions & 6 deletions spec/classes/test_registry_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
require 'spec_helper'

describe 'test::registry', :if => Puppet.version.to_f >= 4.0 do
let(:facts) do
{
:operatingsystem => 'windows',
}
end

let(:facts) { {:os => { :name => 'windows' } } }

it { should compile.with_all_deps }
end

0 comments on commit 612d8af

Please sign in to comment.