Skip to content

Commit 27618d8

Browse files
authored
Merge pull request #403 from puppetlabs/pdksync_pdkupdate
pdksync - PDK Update - Replace Travis and Appveyor with Github Actions
2 parents 7b63b3c + f2f8e14 commit 27618d8

File tree

10 files changed

+206
-220
lines changed

10 files changed

+206
-220
lines changed

.github/workflows/auto_release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
persist-credentials: false
3838

3939
- name: "PDK Release prep"
40-
uses: docker://puppet/pdk:nightly
40+
uses: docker://puppet/iac_release:ci
4141
with:
4242
args: 'release prep --force'
4343
env:

.github/workflows/nightly.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,14 @@ jobs:
132132
echo
133133
echo ::endgroup::
134134
echo ::group::=== INVENTORY ===
135-
sed -e 's/password: .*/password: "[redacted]"/' < inventory.yaml || true
135+
if [ -f 'spec/fixtures/litmus_inventory.yaml' ];
136+
then
137+
FILE='spec/fixtures/litmus_inventory.yaml'
138+
elif [ -f 'inventory.yaml' ];
139+
then
140+
FILE='inventory.yaml'
141+
fi
142+
sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true
136143
echo ::endgroup::
137144
138145
- name: Install agent
@@ -167,7 +174,7 @@ jobs:
167174
if: ${{ always() }}
168175
continue-on-error: true
169176
run: |
170-
if [ -f inventory.yaml ]; then
177+
if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then
171178
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down'
172179
echo ::group::=== REQUEST ===
173180
cat request.json || true

.github/workflows/pr_test.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,14 @@ jobs:
129129
echo
130130
echo ::endgroup::
131131
echo ::group::=== INVENTORY ===
132-
sed -e 's/password: .*/password: "[redacted]"/' < inventory.yaml || true
132+
if [ -f 'spec/fixtures/litmus_inventory.yaml' ];
133+
then
134+
FILE='spec/fixtures/litmus_inventory.yaml'
135+
elif [ -f 'inventory.yaml' ];
136+
then
137+
FILE='inventory.yaml'
138+
fi
139+
sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true
133140
echo ::endgroup::
134141
135142
- name: Install agent
@@ -164,7 +171,7 @@ jobs:
164171
if: ${{ always() }}
165172
continue-on-error: true
166173
run: |
167-
if [ -f inventory.yaml ]; then
174+
if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then
168175
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down'
169176
echo ::group::=== REQUEST ===
170177
cat request.json || true

.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:nightly
42+
with:
43+
args: 'build'
44+
- name: "Push to Forge"
45+
uses: docker://puppet/pdk:nightly
46+
with:
47+
args: 'release publish --forge-token ${{ secrets.FORGE_API_KEY }} --force'

.github/workflows/spec.yml

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

.pdkignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@
4242
/spec/
4343
/.vscode/
4444
/.sync.yml
45+
/.devcontainer/

.sync.yml

Lines changed: 9 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,9 @@ common:
44

55
".gitlab-ci.yml":
66
delete: true
7-
".travis.yml":
8-
global_env:
9-
- HONEYCOMB_WRITEKEY="7f3c63a70eecc61d635917de46bea4e6",HONEYCOMB_DATASET="litmus tests"
10-
dist: trusty
11-
deploy_to_forge:
12-
enabled: false
13-
branches:
14-
- release
15-
user: puppet
16-
secure: ''
17-
use_litmus: true
18-
litmus:
19-
provision_list:
20-
- ---travis_el
21-
- travis_deb
22-
- travis_el7
23-
- travis_el8
24-
complex:
25-
- collection:
26-
puppet_collection:
27-
- puppet6
28-
provision_list:
29-
- travis_ub_6
30-
simplecov: true
31-
notifications:
32-
slack:
33-
secure: kWN4IvjB5scKS6a00jGLVgn2l0wZz6o+DC4ZyZNCxrf4LlihySJyneboPNQb6nthPwVCFh72sBxjT45Ue2JZO30dKiT7eOXGo/N2EK6NpORXEDtuIKBfuZ8ZQ+bos9hVXHmxzujnunQZemLwodDKcwEWMIEjT3QeV5NQUukOHYM=
347
appveyor.yml:
35-
environment:
36-
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
37-
HONEYCOMB_DATASET: litmus tests
38-
use_litmus: true
39-
matrix_extras:
40-
- RUBY_VERSION: 25-x64
41-
ACCEPTANCE: 'yes'
42-
TARGET_HOST: localhost
43-
- RUBY_VERSION: 25-x64
44-
ACCEPTANCE: 'yes'
45-
TARGET_HOST: localhost
46-
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
47-
simplecov: true
8+
delete: true
9+
4810
Gemfile:
4911
optional:
5012
":development":
@@ -66,3 +28,10 @@ spec/spec_helper.rb:
6628
unmanaged: false
6729
.github/workflows/auto_release.yml:
6830
unmanaged: false
31+
.github/workflows/spec.yml:
32+
checks: 'syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop'
33+
unmanaged: false
34+
.github/workflows/release.yml:
35+
unmanaged: false
36+
.travis.yml:
37+
delete: true

0 commit comments

Comments
 (0)