Skip to content

Commit 8b9ae94

Browse files
committed
Update metadata and switch to GitHub Actions
We have not updated this module for a long while now and while it should still function, puppet versions have improved, GitHub actions came, ruby syntax has changed a bit, etc. This commit brings in some changed from newer pdk templates (e.g. rubocop and new rake targets) and also switches from TravisCI to GitHub actions. The deployment of the package is now also automated. This should make it easier in the future to release new versions.
1 parent 188522f commit 8b9ae94

File tree

14 files changed

+1145
-71
lines changed

14 files changed

+1145
-71
lines changed

.github/workflows/ci.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: "ci"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "main"
7+
workflow_dispatch:
8+
9+
jobs:
10+
spec:
11+
name: "Spec tests (Puppet: ${{matrix.puppet_version}}, Ruby Ver: ${{matrix.ruby_version}})"
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- puppet_version: "~> 7.24"
18+
ruby_version: "2.7"
19+
- puppet_version: "~> 8.0"
20+
ruby_version: "3.2"
21+
22+
env:
23+
BUNDLE_WITHOUT: release_prep
24+
PUPPET_GEM_VERSION: ${{ matrix.puppet_version }}
25+
26+
steps:
27+
- name: "Checkout"
28+
uses: "actions/checkout@v4"
29+
30+
- name: "Setup ruby"
31+
uses: "ruby/setup-ruby@v1"
32+
with:
33+
ruby-version: ${{matrix.ruby_version}}
34+
bundler-cache: true
35+
36+
- name: "Bundle environment"
37+
run: |
38+
echo ::group::bundler environment
39+
bundle env
40+
echo ::endgroup::
41+
42+
- name: "Run Static & Syntax Tests"
43+
run: |
44+
bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
45+
bundle exec dependency-checker metadata.json
46+
47+
- name: "Run tests"
48+
run: |
49+
bundle exec rake spec
50+
51+
- name: Coveralls Parallel
52+
uses: coverallsapp/github-action@v2
53+
with:
54+
flag-name: run-puppet-${{matrix.puppet_version}}-ruby-${{matrix.ruby_version}}
55+
parallel: true
56+
57+
finish:
58+
needs: spec
59+
if: ${{ always() }}
60+
runs-on: ubuntu-latest
61+
steps:
62+
- name: Coveralls Finished
63+
uses: coverallsapp/github-action@v2
64+
with:
65+
parallel-finished: true

.github/workflows/main.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: "main"
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
workflow_dispatch:
7+
8+
jobs:
9+
spec:
10+
name: "Spec tests (Puppet: ${{matrix.puppet_version}}, Ruby Ver: ${{matrix.ruby_version}})"
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- puppet_version: "~> 7.24"
17+
ruby_version: "2.7"
18+
- puppet_version: "~> 8.0"
19+
ruby_version: "3.2"
20+
21+
env:
22+
BUNDLE_WITHOUT: release_prep
23+
PUPPET_GEM_VERSION: ${{ matrix.puppet_version }}
24+
25+
steps:
26+
- name: "Checkout"
27+
uses: "actions/checkout@v4"
28+
29+
- name: "Setup ruby"
30+
uses: "ruby/setup-ruby@v1"
31+
with:
32+
ruby-version: ${{matrix.ruby_version}}
33+
bundler-cache: true
34+
35+
- name: "Bundle environment"
36+
run: |
37+
echo ::group::bundler environment
38+
bundle env
39+
echo ::endgroup::
40+
41+
- name: "Run Static & Syntax Tests"
42+
run: |
43+
bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
44+
bundle exec dependency-checker metadata.json
45+
46+
- name: "Run tests"
47+
run: |
48+
bundle exec rake spec
49+
50+
- name: Coveralls Parallel
51+
uses: coverallsapp/github-action@v2
52+
with:
53+
flag-name: run-puppet-${{matrix.puppet_version}}-ruby-${{matrix.ruby_version}}
54+
parallel: true
55+
56+
finish:
57+
needs: spec
58+
if: ${{ always() }}
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Coveralls Finished
62+
uses: coverallsapp/github-action@v2
63+
with:
64+
parallel-finished: true

.github/workflows/publish.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "Publish Module"
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
FORGE_API_KEY: ${{ secrets.FORGE_API_KEY }}
8+
9+
jobs:
10+
release:
11+
name: Release Module
12+
runs-on: "ubuntu-latest"
13+
14+
steps:
15+
- name: "Checkout"
16+
uses: "actions/checkout@v4"
17+
with:
18+
ref: "${{ github.ref }}"
19+
clean: true
20+
fetch-depth: 0
21+
fetch-tags: true
22+
23+
- name: "Get metadata"
24+
id: metadata
25+
run: |
26+
metadata_version=$(jq --raw-output .version metadata.json)
27+
tag="v${metadata_version}"
28+
echo "tag=${tag}" >> $GITHUB_OUTPUT
29+
echo "version=${metadata_version}" >> $GITHUB_OUTPUT
30+
31+
- name: "PDK build ${{ steps.metadata.outputs.version }}"
32+
uses: "docker://puppet/pdk:3.0.0.0"
33+
with:
34+
args: "build"
35+
36+
- name: "Publish module"
37+
uses: "docker://puppet/pdk:3.0.0.0"
38+
with:
39+
args: "release publish --forge-token ${{ env.FORGE_API_KEY }} --force"

.gitignore

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
1+
.git/
12
.*.sw[op]
2-
.bundle/
3-
pkg/
4-
coverage/
5-
Gemfile.lock
6-
Gemfile.local
3+
.metadata
4+
.yardoc
5+
.yardwarns
6+
*.iml
7+
/.bundle/
8+
/.idea/
9+
/.vagrant/
10+
/coverage/
11+
/bin/
12+
/doc/
13+
/Gemfile.local
14+
/Gemfile.lock
15+
/junit/
16+
/log/
17+
/pkg/
18+
/tmp/
19+
/vendor/
20+
/convert_report.txt
21+
/update_report.txt
22+
.DS_Store
23+
.project
24+
.envrc
25+
/inventory.yaml
26+
/spec/fixtures/litmus_inventory.yaml

.pdkignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.git/
2+
.*.sw[op]
3+
.metadata
4+
.yardoc
5+
.yardwarns
6+
*.iml
7+
/.bundle/
8+
/.idea/
9+
/.vagrant/
10+
/coverage/
11+
/bin/
12+
/doc/
13+
/Gemfile.local
14+
/Gemfile.lock
15+
/junit/
16+
/log/
17+
/pkg/
18+
/spec/fixtures/manifests/
19+
/spec/fixtures/modules/*
20+
/tmp/
21+
/vendor/
22+
/convert_report.txt
23+
/update_report.txt
24+
.DS_Store
25+
.project
26+
.envrc
27+
/inventory.yaml
28+
/spec/fixtures/litmus_inventory.yaml
29+
/.fixtures.yml
30+
/Gemfile
31+
/.gitattributes
32+
/.github/
33+
/.gitignore
34+
/.pdkignore
35+
/.puppet-lint.rc
36+
/Rakefile
37+
/rakelib/
38+
/.rspec
39+
/..yml
40+
/.yardopts
41+
/spec/
42+
/.vscode/
43+
/.sync.yml
44+
/.devcontainer/

.puppet-lint.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--relative

.rspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--color
2+
--format documentation

0 commit comments

Comments
 (0)