Skip to content

Commit d9771bd

Browse files
Merge pull request #268 from puppetlabs/pdksync_simplecov
(MODULES-10120) enable simplecov; update to PDK 1.14.1; minor cleanups
2 parents d15af63 + 125ac5a commit d9771bd

File tree

9 files changed

+65
-65
lines changed

9 files changed

+65
-65
lines changed

.rubocop.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ Bundler/DuplicatedGem:
2323
Enabled: false
2424
Bundler/OrderedGems:
2525
Enabled: false
26+
GetText/DecorateFunctionMessage:
27+
Enabled: false
28+
GetText/DecorateString:
29+
Enabled: false
30+
GetText/DecorateStringFormattingUsingInterpolation:
31+
Enabled: false
32+
GetText/DecorateStringFormattingUsingPercent:
33+
Enabled: false
2634
Layout/AccessModifierIndentation:
2735
Enabled: false
2836
Layout/AlignArray:

.sync.yml

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,16 @@
11
---
2-
Gemfile:
3-
optional:
4-
':development':
5-
- gem: 'ruby-pwsh'
6-
required:
7-
':system_tests':
8-
- gem: 'puppet-module-posix-system-r#{minor_version}'
9-
platforms: ruby
10-
- gem: 'puppet-module-win-system-r#{minor_version}'
11-
platforms:
12-
- mswin
13-
- mingw
14-
- x64_mingw
15-
- gem: beaker-testmode_switcher
16-
version: '~> 0.4'
17-
- gem: master_manipulator
18-
- gem: puppet-blacksmith
19-
version: '~> 3.4'
20-
21-
# For the moment don't do any rubocop checks.
22-
.rubocop.yml:
2+
".gitlab-ci.yml":
3+
delete: true
4+
".rubocop.yml":
235
include_todos: true
24-
selected_profile: off
25-
26-
spec/default_facts.yml:
27-
unmanaged: true
28-
29-
# Due to https://github.com/puppetlabs/pdk-templates/issues/133 we can't manage Travis CI yet.
30-
.travis.yml:
6+
selected_profile: false
7+
".travis.yml":
318
unmanaged: true
32-
33-
# Due to https://github.com/puppetlabs/pdk-templates/issues/229 we can't manage Appveyor yet.
349
appveyor.yml:
3510
unmanaged: true
36-
37-
.gitlab-ci.yml:
38-
delete: true
11+
Gemfile:
12+
optional:
13+
":development":
14+
- gem: ruby-pwsh
15+
spec/spec_helper.rb:
16+
coverage_report: true

.travis.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,37 @@ before_install:
2323
- gem --version
2424
- bundle -v
2525
script:
26-
- 'bundle exec rake $CHECK'
26+
- 'SIMPLECOV=yes bundle exec rake $CHECK'
2727
bundler_args: --without system_tests
2828
rvm:
29-
- 2.5.1
30-
env:
31-
global:
32-
- BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
33-
- CHECK=parallel_spec
29+
- 2.5.3
30+
stages:
31+
- static
32+
- spec
33+
- acceptance
34+
-
35+
if: tag =~ ^v\d
36+
name: deploy
3437
matrix:
3538
fast_finish: true
3639
include:
3740
-
38-
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
41+
env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
42+
stage: static
3943
-
40-
env: PUPPET_GEM_VERSION="~> 5.0"
41-
rvm: 2.4.4
44+
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
45+
rvm: 2.4.5
46+
stage: spec
47+
-
48+
env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
49+
rvm: 2.5.3
50+
stage: spec
51+
-
52+
env: DEPLOY_TO_FORGE=yes
53+
stage: deploy
4254
branches:
4355
only:
4456
- master
4557
- /^v\d/
4658
notifications:
4759
email: false
48-
deploy:
49-
provider: puppetforge
50-
user: puppet
51-
password:
52-
secure: ""
53-
on:
54-
tags: true
55-
all_branches: true
56-
condition: "$DEPLOY_TO_FORGE = yes"

Gemfile

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2-
gem 'pdk', git: 'https://github.com/puppetlabs/pdk.git', branch: 'master'
32

43
def location_for(place_or_version, fake_version = nil)
54
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
@@ -24,19 +23,13 @@ group :development do
2423
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
2524
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2625
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
26+
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
2727
gem "puppet-module-posix-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
2828
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
2929
gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
3030
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
3131
gem "ruby-pwsh", require: false
3232
end
33-
group :system_tests do
34-
gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby]
35-
gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
36-
gem "beaker-testmode_switcher", '~> 0.4', require: false
37-
gem "master_manipulator", require: false
38-
gem "puppet-blacksmith", '~> 3.4', require: false
39-
end
4033

4134
puppet_version = ENV['PUPPET_GEM_VERSION']
4235
facter_version = ENV['FACTER_GEM_VERSION']
@@ -77,4 +70,4 @@ extra_gemfiles.each do |gemfile|
7770
eval(File.read(gemfile), binding)
7871
end
7972
end
80-
# vim: syntax=ruby
73+
# vim: syntax=ruby

Rakefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,17 @@ end
1515

1616
def changelog_project
1717
return unless Rake.application.top_level_tasks.include? "changelog"
18-
returnVal = nil || JSON.load(File.read('metadata.json'))['source'].match(%r{.*/([^/]*)})[1]
19-
raise "unable to find the changelog_project in .sync.yml or the name in metadata.json" if returnVal.nil?
18+
19+
returnVal = nil
20+
returnVal ||= begin
21+
metadata_source = JSON.load(File.read('metadata.json'))['source']
22+
metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z})
23+
24+
metadata_source_match && metadata_source_match[1]
25+
end
26+
27+
raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil?
28+
2029
puts "GitHubChangelogGenerator project:#{returnVal}"
2130
returnVal
2231
end

appveyor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ version: 1.1.x.{build}
33
branches:
44
only:
55
- master
6+
- release
67
skip_commits:
78
message: /^\(?doc\)?.*/
89
clone_depth: 10
@@ -13,6 +14,7 @@ init:
1314
- 'mkdir C:\ProgramData\PuppetLabs\hiera && exit 0'
1415
- 'mkdir C:\ProgramData\PuppetLabs\puppet\var && exit 0'
1516
environment:
17+
SIMPLECOV: yes
1618
matrix:
1719
-
1820
RUBY_VERSION: 24-x64

metadata.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"version_requirement": ">= 4.7.0 < 7.0.0"
7878
}
7979
],
80-
"pdk-version": "1.14.0",
81-
"template-url": "https://github.com/puppetlabs/pdk-templates#1.11.1",
82-
"template-ref": "1.11.1-0-g2ff8c24"
80+
"pdk-version": "1.14.1",
81+
"template-url": "https://github.com/puppetlabs/pdk-templates#master",
82+
"template-ref": "heads/master-0-gfaf9e8b"
8383
}

spec/default_facts.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
# Facts specified here will override the values provided by rspec-puppet-facts.
44
---
55
ipaddress: "172.16.254.254"
6+
ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA"
67
is_pe: false
78
macaddress: "AA:AA:AA:AA:AA:AA"

spec/spec_helper.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525
end
2626
end
2727

28+
# read default_facts and merge them over what is provided by facterdb
29+
default_facts.each do |fact, value|
30+
add_custom_fact fact, value
31+
end
32+
2833
RSpec.configure do |c|
2934
c.default_facts = default_facts
3035
c.before :each do
@@ -34,6 +39,7 @@
3439
end
3540
c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT']
3641
c.after(:suite) do
42+
RSpec::Puppet::Coverage.report!(0)
3743
end
3844
end
3945

0 commit comments

Comments
 (0)