Skip to content

Commit 7d99f84

Browse files
authored
Merge pull request #36 from lelutin/github_ci
Setup github CI
2 parents 505887e + f039fc4 commit 7d99f84

File tree

9 files changed

+78
-32
lines changed

9 files changed

+78
-32
lines changed

.github/workflows/ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
setup_matrix:
7+
name: 'Setup Test Matrix'
8+
runs-on: ubuntu-latest
9+
outputs:
10+
puppet_major_versions: ${{ steps.get-outputs.outputs.puppet_major_versions }}
11+
puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }}
12+
env:
13+
BUNDLE_WITHOUT: development:release
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Setup ruby
17+
uses: ruby/setup-ruby@v1
18+
with:
19+
ruby-version: '2.7'
20+
bundler-cache: true
21+
- name: Validate syntax of all puppet files
22+
run: bundle exec rake validate
23+
- name: Validate ruby syntax and codestyle
24+
run: bundle exec rake rubocop
25+
- name: Check puppet code style
26+
run: bundle exec rake lint
27+
- name: Setup Test Matrix
28+
id: get-outputs
29+
run: bundle exec metadata2gha --pidfile-workaround false
30+
31+
unit:
32+
needs: setup_matrix
33+
runs-on: ubuntu-latest
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
include: ${{fromJson(needs.setup_matrix.outputs.puppet_unit_test_matrix)}}
38+
env:
39+
BUNDLE_WITHOUT: docs
40+
PUPPET_VERSION: "~> ${{ matrix.puppet }}.0"
41+
name: Puppet ${{ matrix.puppet }} (Ruby ${{ matrix.ruby }})
42+
steps:
43+
- uses: actions/checkout@v4
44+
- name: Setup ruby
45+
uses: ruby/setup-ruby@v1
46+
with:
47+
ruby-version: ${{ matrix.ruby }}
48+
bundler-cache: true
49+
- name: Run tests
50+
run: bundle exec rake spec

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ spec/fixtures
44
.tmp
55
*.lock
66
pkg/
7+
vendor

.rubocop.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
require: rubocop-rspec
3+
AllCops:
4+
NewCops: enable
5+
SuggestExtensions: false

.travis.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

Gemfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ else
66
puppetversion = ['>= 7.1.0']
77
end
88

9-
gem 'librarian-puppet'
10-
gem 'puppetlabs_spec_helper'
119
gem 'rake'
12-
10+
gem 'puppet', puppetversion
1311
gem 'trocla'
1412

15-
gem 'puppet', puppetversion
16-
gem 'puppet-lint'
13+
group :tests do
14+
gem 'metadata-json-lint'
15+
gem 'puppetlabs_spec_helper'
16+
gem 'puppet-lint'
17+
gem 'puppet_metadata'
18+
gem 'puppet-syntax'
19+
# This draws in rubocop and other useful gems for puppet tests
20+
gem 'voxpupuli-test'
21+
end

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# trocla
22

3-
[![Build Status](https://travis-ci.org/duritong/puppet-trocla.png)](https://travis-ci.org/duritong/puppet-trocla)
4-
53
This is the puppet module to manage a trocla installation on the puppet
64
master. It also, provides the necessary function to query trocla from puppet.
75

Rakefile

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,5 @@ require 'bundler'
22
Bundler.require(:rake)
33

44
require 'puppetlabs_spec_helper/rake_tasks'
5-
require 'puppet-lint/tasks/puppet-lint'
5+
require 'puppet-syntax/tasks/puppet-syntax'
66

7-
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"]
8-
PuppetLint.configuration.log_format = '%{path}:%{line}:%{KIND}: %{message}'
9-
PuppetLint.configuration.send("disable_class_inherits_from_params_class")
10-
11-
# use librarian-puppet to manage fixtures instead of .fixtures.yml
12-
# offers more possibilities like explicit version management, forge downloads,...
13-
task :librarian_spec_prep do
14-
sh "librarian-puppet install --path=spec/fixtures/modules/"
15-
pwd = `pwd`.strip
16-
unless File.directory?("#{pwd}/spec/fixtures/modules/trocla")
17-
sh "ln -s #{pwd} #{pwd}/spec/fixtures/modules/trocla"
18-
end
19-
end
20-
task :spec_prep => :librarian_spec_prep
21-
22-
23-
task :default => [:spec, :lint]

metadata.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@
33
"version": "1.0.1",
44
"author": "duritong",
55
"summary": "This modules allows you to use trocla (https://github.com/duritong/trocla) from puppet.",
6-
"license": "GPLv2",
6+
"license": "GPL-2.0-only",
77
"source": "https://github.com/duritong/puppet-trocla",
88
"project_page": "https://github.com/duritong/puppet-trocla",
99
"issues_url": "https://github.com/duritong/puppet-trocla/issues",
1010
"description": "This modules allows you use trocla lookups as puppet functions.",
1111
"dependencies": [
12-
{"name":"puppetlabs/stdlib","version_requirement":">= 3.2.0"}
12+
{
13+
"name": "puppetlabs/stdlib",
14+
"version_requirement": ">= 3.2.0"
15+
}
16+
],
17+
"requirements": [
18+
{
19+
"name": "puppet",
20+
"version_requirement": ">= 6.0 < 9.0.0"
21+
}
1322
]
1423
}

0 commit comments

Comments
 (0)