Skip to content

Commit 6cba136

Browse files
committed
Add CloudCI publish and PR testing workflows
1 parent c8444df commit 6cba136

File tree

8 files changed

+50
-86
lines changed

8 files changed

+50
-86
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: "Publish module"
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
release:
8+
uses: "puppetlabs/cat-github-actions/.github/workflows/module_release.yml@main"
9+
secrets: "inherit"

.github/workflows/release_prep.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: "Release Prep"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Module version to be released. Must be a valid semver string. (1.2.3)"
8+
required: true
9+
10+
jobs:
11+
release_prep:
12+
uses: "puppetlabs/cat-github-actions/.github/workflows/module_release_prep.yml@main"
13+
with:
14+
version: "${{ github.event.inputs.version }}"
15+
secrets: "inherit"

.pdkignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
/.fixtures.yml
3030
/Gemfile
3131
/.gitattributes
32+
/.github/
3233
/.gitignore
3334
/.pdkignore
3435
/.puppet-lint.rc

.sync.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
---
22
appveyor.yml:
33
delete: true
4+
5+
.github/workflows/release_prep.yml:
6+
unmanaged: false
7+
.github/workflows/release.yml:
8+
unmanaged: false
9+
10+
Gemfile:
11+
optional:
12+
':development':
13+
- gem: 'github_changelog_generator'

Gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ group :development do
1919
gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2020
gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2121
gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
22+
gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2223
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
2324
gem "facterdb", '~> 1.18', require: false
2425
gem "metadata-json-lint", '~> 3.0', require: false
@@ -33,12 +34,18 @@ group :development do
3334
gem "rubocop", '= 1.48.1', require: false
3435
gem "rubocop-performance", '= 1.16.0', require: false
3536
gem "rubocop-rspec", '= 2.19.0', require: false
37+
gem "puppet-strings", '~> 4.0', require: false
3638
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
39+
gem "github_changelog_generator", require: false
3740
end
3841
group :system_tests do
3942
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
4043
gem "serverspec", '~> 2.41', require: false
4144
end
45+
group :release_prep do
46+
gem "puppet-strings", '~> 4.0', require: false
47+
gem "puppetlabs_spec_helper", '~> 6.0', require: false
48+
end
4249

4350
puppet_version = ENV['PUPPET_GEM_VERSION']
4451
facter_version = ENV['FACTER_GEM_VERSION']

Rakefile

Lines changed: 2 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,9 @@
11
# frozen_string_literal: true
22

33
require 'bundler'
4-
require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
4+
require 'puppet_litmus/rake_tasks' if Gem.loaded_specs.key? 'puppet_litmus'
55
require 'puppetlabs_spec_helper/rake_tasks'
66
require 'puppet-syntax/tasks/puppet-syntax'
7-
require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any?
8-
require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any?
9-
10-
def changelog_user
11-
return unless Rake.application.top_level_tasks.include? "changelog"
12-
returnVal = nil || JSON.load(File.read('metadata.json'))['author']
13-
raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil?
14-
puts "GitHubChangelogGenerator user:#{returnVal}"
15-
returnVal
16-
end
17-
18-
def changelog_project
19-
return unless Rake.application.top_level_tasks.include? "changelog"
20-
21-
returnVal = nil
22-
returnVal ||= begin
23-
metadata_source = JSON.load(File.read('metadata.json'))['source']
24-
metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z})
25-
26-
metadata_source_match && metadata_source_match[1]
27-
end
28-
29-
raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil?
30-
31-
puts "GitHubChangelogGenerator project:#{returnVal}"
32-
returnVal
33-
end
34-
35-
def changelog_future_release
36-
return unless Rake.application.top_level_tasks.include? "changelog"
37-
returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version']
38-
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
39-
puts "GitHubChangelogGenerator future_release:#{returnVal}"
40-
returnVal
41-
end
7+
require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings'
428

439
PuppetLint.configuration.send('disable_relative')
44-
45-
46-
if Bundler.rubygems.find_name('github_changelog_generator').any?
47-
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
48-
raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil?
49-
config.user = "#{changelog_user}"
50-
config.project = "#{changelog_project}"
51-
config.future_release = "#{changelog_future_release}"
52-
config.exclude_labels = ['maintenance']
53-
config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)."
54-
config.add_pr_wo_labels = true
55-
config.issues = false
56-
config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB"
57-
config.configure_sections = {
58-
"Changed" => {
59-
"prefix" => "### Changed",
60-
"labels" => ["backwards-incompatible"],
61-
},
62-
"Added" => {
63-
"prefix" => "### Added",
64-
"labels" => ["enhancement", "feature"],
65-
},
66-
"Fixed" => {
67-
"prefix" => "### Fixed",
68-
"labels" => ["bug", "documentation", "bugfix"],
69-
},
70-
}
71-
end
72-
else
73-
desc 'Generate a Changelog from GitHub'
74-
task :changelog do
75-
raise <<EOM
76-
The changelog tasks depends on recent features of the github_changelog_generator gem.
77-
Please manually add it to your .sync.yml for now, and run `pdk update`:
78-
---
79-
Gemfile:
80-
optional:
81-
':development':
82-
- gem: 'github_changelog_generator'
83-
version: '~> 1.15'
84-
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')"
85-
EOM
86-
end
87-
end
88-

metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"version_requirement": ">= 6.0.0 < 8.0.0"
6767
}
6868
],
69-
"pdk-version": "2.7.1",
69+
"pdk-version": "3.0.1",
7070
"template-url": "https://github.com/puppetlabs/pdk-templates#main",
71-
"template-ref": "heads/main-0-g9675180"
71+
"template-ref": "heads/main-0-g909fd77"
7272
}

spec/default_facts.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
#
33
# Facts specified here will override the values provided by rspec-puppet-facts.
44
---
5-
ipaddress: "172.16.254.254"
6-
ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA"
5+
networking:
6+
ip: "172.16.254.254"
7+
ip6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA"
8+
mac: "AA:AA:AA:AA:AA:AA"
79
is_pe: false
8-
macaddress: "AA:AA:AA:AA:AA:AA"

0 commit comments

Comments
 (0)