Skip to content

Commit cf76f0e

Browse files
m0dularMartyEwings
andauthored
CI Initial commit (#55)
* CI Initial commit * fix open ended Puppet version requirement Co-authored-by: MartyEwings <martyewings@gmail.com>
1 parent 406df3c commit cf76f0e

File tree

8 files changed

+288
-56
lines changed

8 files changed

+288
-56
lines changed

.github/workflows/auto_release.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: "Auto release"
2+
3+
on:
4+
schedule:
5+
- cron: '0 3 * * 6'
6+
workflow_dispatch:
7+
8+
env:
9+
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
10+
HONEYCOMB_DATASET: litmus tests
11+
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12+
13+
jobs:
14+
auto_release:
15+
name: "Automatic release prep"
16+
runs-on: ubuntu-20.04
17+
18+
steps:
19+
- name: "Honeycomb: Start recording"
20+
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
21+
with:
22+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
23+
dataset: ${{ env.HONEYCOMB_DATASET }}
24+
job-status: ${{ job.status }}
25+
26+
- name: "Honeycomb: start first step"
27+
run: |
28+
echo STEP_ID="auto-release" >> $GITHUB_ENV
29+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
30+
31+
- name: "Checkout Source"
32+
if: ${{ github.repository_owner == 'puppetlabs' }}
33+
uses: actions/checkout@v2
34+
with:
35+
fetch-depth: 0
36+
persist-credentials: false
37+
38+
- name: "PDK Release prep"
39+
uses: docker://puppet/iac_release:ci
40+
with:
41+
args: 'release prep --force'
42+
env:
43+
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: "Get Version"
46+
if: ${{ github.repository_owner == 'puppetlabs' }}
47+
id: gv
48+
run: |
49+
echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
50+
51+
- name: "Commit changes"
52+
if: ${{ github.repository_owner == 'puppetlabs' }}
53+
run: |
54+
git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com"
55+
git config --local user.name "GitHub Action"
56+
git add .
57+
git commit -m "Release prep v${{ steps.gv.outputs.ver }}"
58+
59+
- name: Create Pull Request
60+
id: cpr
61+
uses: puppetlabs/peter-evans-create-pull-request@v3
62+
if: ${{ github.repository_owner == 'puppetlabs' }}
63+
with:
64+
token: ${{ secrets.GITHUB_TOKEN }}
65+
commit-message: "Release prep v${{ steps.gv.outputs.ver }}"
66+
branch: "release-prep"
67+
delete-branch: true
68+
title: "Release prep v${{ steps.gv.outputs.ver }}"
69+
body: |
70+
Automated release-prep through [pdk-templates](https://github.com/puppetlabs/pdk-templates/blob/main/moduleroot/.github/workflows/auto_release.yml.erb) from commit ${{ github.sha }}.
71+
Please verify before merging:
72+
- [ ] last [nightly](https://github.com/${{ github.repository }}/actions/workflows/nightly.yml) run is green
73+
- [ ] [Changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) is readable and has no unlabeled pull requests
74+
- [ ] Ensure the [changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) version and [metadata](https://github.com/${{ github.repository }}/blob/release-prep/metadata.json) version match
75+
labels: "maintenance"
76+
77+
- name: PR outputs
78+
if: ${{ github.repository_owner == 'puppetlabs' }}
79+
run: |
80+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
81+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
82+
83+
- name: "Honeycomb: Record finish step"
84+
if: ${{ always() }}
85+
run: |
86+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Finished auto release workflow'

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: "Publish module"
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
create-github-release:
8+
name: Deploy GitHub Release
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v2
13+
with:
14+
ref: ${{ github.ref }}
15+
clean: true
16+
fetch-depth: 0
17+
- name: Get Version
18+
id: gv
19+
run: |
20+
echo "::set-output name=ver::$(jq --raw-output .version metadata.json)"
21+
- name: Create Release
22+
uses: actions/create-release@v1
23+
id: create_release
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
with:
27+
tag_name: "v${{ steps.gv.outputs.ver }}"
28+
draft: false
29+
prerelease: false
30+
31+
deploy-forge:
32+
name: Deploy to Forge
33+
runs-on: ubuntu-20.04
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v2
37+
with:
38+
ref: ${{ github.ref }}
39+
clean: true
40+
- name: "PDK Build"
41+
uses: docker://puppet/pdk:2.1.0.0
42+
with:
43+
args: 'build'
44+
- name: "Push to Forge"
45+
uses: docker://puppet/pdk:2.1.0.0
46+
with:
47+
args: 'release publish --forge-token ${{ secrets.FORGE_API_KEY }} --force'

.github/workflows/spec.yml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: "Spec Tests"
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
env:
8+
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
9+
HONEYCOMB_DATASET: litmus tests
10+
11+
jobs:
12+
setup_matrix:
13+
name: "Setup Test Matrix"
14+
runs-on: ubuntu-20.04
15+
outputs:
16+
spec_matrix: ${{ steps.get-matrix.outputs.spec_matrix }}
17+
18+
steps:
19+
- name: "Honeycomb: Start recording"
20+
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
21+
with:
22+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
23+
dataset: ${{ env.HONEYCOMB_DATASET }}
24+
job-status: ${{ job.status }}
25+
26+
- name: "Honeycomb: Start first step"
27+
run: |
28+
echo STEP_ID=setup-environment >> $GITHUB_ENV
29+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
30+
31+
- name: Checkout Source
32+
uses: actions/checkout@v2
33+
if: ${{ github.repository_owner == 'puppetlabs' }}
34+
35+
- name: Activate Ruby 2.7
36+
uses: ruby/setup-ruby@v1
37+
if: ${{ github.repository_owner == 'puppetlabs' }}
38+
with:
39+
ruby-version: "2.7"
40+
bundler-cache: true
41+
42+
- name: Print bundle environment
43+
if: ${{ github.repository_owner == 'puppetlabs' }}
44+
run: |
45+
echo ::group::bundler environment
46+
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
47+
echo ::endgroup::
48+
49+
- name: "Honeycomb: Record Setup Environment time"
50+
if: ${{ github.repository_owner == 'puppetlabs' }}
51+
run: |
52+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
53+
echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV
54+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
55+
56+
- name: Setup Spec Test Matrix
57+
id: get-matrix
58+
run: |
59+
if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
60+
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2
61+
else
62+
echo "::set-output name=spec_matrix::{}"
63+
fi
64+
65+
- name: "Honeycomb: Record Setup Test Matrix time"
66+
if: ${{ always() }}
67+
run: |
68+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
69+
70+
Spec:
71+
name: "Spec Tests (Puppet: ${{matrix.puppet_version}}, Ruby Ver: ${{matrix.ruby_version}})"
72+
needs:
73+
- setup_matrix
74+
if: ${{ needs.setup_matrix.outputs.spec_matrix != '{}' }}
75+
76+
runs-on: ubuntu-20.04
77+
strategy:
78+
fail-fast: false
79+
matrix: ${{fromJson(needs.setup_matrix.outputs.spec_matrix)}}
80+
81+
env:
82+
BUILDEVENT_FILE: '../buildevents.txt'
83+
PUPPET_GEM_VERSION: ${{ matrix.puppet_version }}
84+
85+
steps:
86+
- run: |
87+
echo "SANITIZED_PUPPET_VERSION=$(echo '${{ matrix.puppet_version }}' | sed 's/~> //g')" >> $GITHUB_ENV
88+
89+
- run: |
90+
echo 'puppet_version=${{ env.SANITIZED_PUPPET_VERSION }}' >> $BUILDEVENT_FILE
91+
92+
- name: "Honeycomb: Start first step"
93+
run: |
94+
echo "STEP_ID=${{ env.SANITIZED_PUPPET_VERSION }}-spec" >> $GITHUB_ENV
95+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
96+
97+
- name: "Honeycomb: Start recording"
98+
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
99+
with:
100+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
101+
dataset: ${{ env.HONEYCOMB_DATASET }}
102+
job-status: ${{ job.status }}
103+
matrix-key: ${{ env.SANITIZED_PUPPET_VERSION }}
104+
105+
- name: Checkout Source
106+
uses: actions/checkout@v2
107+
108+
- name: "Activate Ruby ${{ matrix.ruby_version }}"
109+
uses: ruby/setup-ruby@v1
110+
with:
111+
ruby-version: ${{matrix.ruby_version}}
112+
bundler-cache: true
113+
114+
- name: Print bundle environment
115+
run: |
116+
echo ::group::bundler environment
117+
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
118+
echo ::endgroup::
119+
120+
- name: Run Static & Syntax Tests
121+
run: |
122+
buildevents cmd $TRACE_ID $STEP_ID 'static_syntax_checks Puppet ${{ matrix.puppet_version }}, Ruby ${{ matrix.ruby_version }}' -- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
123+
124+
- name: Run parallel_spec tests
125+
run: |
126+
buildevents cmd $TRACE_ID $STEP_ID 'rake parallel_spec Puppet ${{ matrix.puppet_version }}, Ruby ${{ matrix.ruby_version }}' -- bundle exec rake parallel_spec

.sync.yml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
11
---
2-
mock_with: ':rspec'
2+
common:
33

4-
appveyor.yml:
4+
".gitlab-ci.yml":
55
delete: true
6-
.project:
6+
appveyor.yml:
77
delete: true
8-
.gitlab-ci.yml:
8+
.gitpod.Dockerfile:
9+
unmanaged: true
10+
.gitpod.yml:
11+
unmanaged: true
12+
.github/workflows/nightly.yml:
13+
unmanaged: true
14+
.github/workflows/pr_test.yml:
15+
unmanaged: true
16+
.github/workflows/auto_release.yml:
17+
unmanaged: true
18+
.github/workflows/spec.yml:
19+
checks: 'syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop'
20+
unmanaged: true
21+
.github/workflows/release.yml:
22+
unmanaged: true
23+
.travis.yml:
924
delete: true
1025

26+
Rakefile:
27+
changelog_user: "puppetlabs"
28+
29+
spec/spec_helper.rb:
30+
mock_with: ":rspec"
31+
coverage_report: true
1132
spec/default_facts.yml:
1233
extra_facts:
1334
pe_server_version: 2018.1.0
@@ -17,7 +38,6 @@ spec/default_facts.yml:
1738
"total_bytes": 17179869184
1839
processors:
1940
"count": 8
20-
2141
spec/default_facts.yml:
2242
extra_facts:
2343
pe_postgresql_info:

.travis.yml

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

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').a
99

1010
def changelog_user
1111
return unless Rake.application.top_level_tasks.include? "changelog"
12-
returnVal = nil || JSON.load(File.read('metadata.json'))['author']
12+
returnVal = "puppetlabs" || JSON.load(File.read('metadata.json'))['author']
1313
raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil?
1414
puts "GitHubChangelogGenerator user:#{returnVal}"
1515
returnVal

metadata.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"project_page": "https://github.com/puppetlabs/puppetlabs-pe_databases",
99
"issues_url": "https://github.com/puppetlabs/puppetlabs-pe_databases/issues",
1010
"dependencies": [
11+
1112
],
1213
"operatingsystem_support": [
1314
{
@@ -62,7 +63,7 @@
6263
"requirements": [
6364
{
6465
"name": "puppet",
65-
"version_requirement": ">= 5.5.0"
66+
"version_requirement": ">= 5.5.0 < 8.0.0"
6667
}
6768
],
6869
"pdk-version": "2.1.0",

spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
end
4747
c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT']
4848
c.after(:suite) do
49+
RSpec::Puppet::Coverage.report!(0)
4950
end
5051
end
5152

0 commit comments

Comments
 (0)