Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
fixtures:
repositories:
stdlib:
repo: https://github.com/puppetlabs/puppetlabs-stdlib.git
ref: v9.7.0
concat:
repo: https://github.com/puppetlabs/puppetlabs-concat.git
ref: v9.0.2
symlinks:
sysfs: "#{source_dir}"
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI

on:
pull_request:
branches: [master, main]
push:
branches: [master, main]

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ["3.1", "3.2", "3.3"]
puppet: ["~> 7.0", "~> 8.0"]
exclude:
- ruby: "3.3"
puppet: "~> 7.0"

env:
PUPPET_VERSION: ${{ matrix.puppet }}

steps:
- uses: actions/checkout@v4

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

- name: Run tests
run: bundle exec rake spec

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler-cache: true

- name: Run puppet-lint
run: bundle exec rake lint

- name: Validate metadata.json
run: bundle exec rake metadata_lint

- name: Validate manifests
run: bundle exec rake validate
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
pkg
pkg/
vendor/
.bundle/
Gemfile.lock
spec/fixtures/
.vagrant/
*.swp
*.swo
.idea/
.vscode/
coverage/
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--format documentation
24 changes: 24 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
AllCops:
TargetRubyVersion: 2.6
NewCops: enable
Exclude:
- spec/fixtures/**/*
- pkg/**/*
- vendor/**/*

Style/Documentation:
Enabled: false

Metrics/BlockLength:
Exclude:
- spec/**/*

Layout/LineLength:
Max: 140

Style/HashSyntax:
EnforcedStyle: ruby19

Style/StringLiterals:
EnforcedStyle: single_quotes
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.0
27 changes: 22 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
source 'https://rubygems.org'

puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 3.3']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'puppet-lint', '>= 0.3.2'
gem 'facter', '>= 1.7.0'
puppet_version = ENV['PUPPET_VERSION']
if puppet_version
gem 'puppet', puppet_version
else
gem 'puppet', '>= 7.0'
end
gem 'facter', '>= 2.5'

# Required for newer Ruby versions (removed from stdlib)
gem 'logger'
gem 'ostruct'
gem 'bigdecimal'
gem 'racc'
gem 'base64'

group :development, :test do
gem 'rake'
gem 'rspec-puppet', '~> 2.12'
gem 'puppetlabs_spec_helper', '~> 5.0'
gem 'puppet-lint', '~> 3.0'
gem 'metadata-json-lint'
end
22 changes: 18 additions & 4 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
require 'rubygems'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
require 'metadata-json-lint/rake_task'

# Puppet-lint configuration
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
PuppetLint.configuration.send('disable_140chars')
PuppetLint.configuration.ignore_paths = ['spec/**/*.pp', 'pkg/**/*.pp', 'vendor/**/*.pp']
PuppetLint.configuration.relative = true

desc "Validate manifests, templates, and ruby files"
desc 'Validate manifests, templates, and ruby files'
task :validate do
Dir['manifests/**/*.pp'].each do |manifest|
sh "puppet parser validate --noop #{manifest}"
end
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
Dir['spec/**/*.rb', 'lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ %r{spec/fixtures}
end
Dir['templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
end
end

desc 'Run all linting tasks'
task lint_all: [:lint, :metadata_lint]

desc 'Run all tests'
task test: [:validate, :lint_all, :spec]

# Default task
task default: :test
45 changes: 41 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,50 @@
"version": "0.2.0",
"author": "danfoster",
"summary": "A module for managing sysfs settings",
"license": "Apache 2.0",
"license": "Apache-2.0",
"source": "https://github.com/danfoster/puppet-sysfs",
"project_page": "https://github.com/danfoster/puppet-sysfs",
"issues_url": "https://github.com/danfoster/puppet-sysfs/issues",
"dependencies": [
{"name":"puppetlabs-stdlib","version_requirement":">= 1.0.0"},
{"name":"puppetlabs-concat"}
{
"name": "puppetlabs-stdlib",
"version_requirement": ">= 4.0.0 < 10.0.0"
},
{
"name": "puppetlabs-concat",
"version_requirement": ">= 4.0.0 < 10.0.0"
}
],
"operatingsystem_support": [
{
"operatingsystem": "RedHat",
"operatingsystemrelease": ["7", "8", "9"]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": ["7", "8"]
},
{
"operatingsystem": "AlmaLinux",
"operatingsystemrelease": ["8", "9"]
},
{
"operatingsystem": "Rocky",
"operatingsystemrelease": ["8", "9"]
},
{
"operatingsystem": "Debian",
"operatingsystemrelease": ["10", "11", "12"]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": ["20.04", "22.04", "24.04"]
}
],
"requirements": [
{
"name": "puppet",
"version_requirement": ">= 7.0.0 < 9.0.0"
}
]
}

7 changes: 0 additions & 7 deletions spec/classes/init_spec.rb

This file was deleted.

Loading
Loading