Skip to content

Commit c205d92

Browse files
author
Daniel Carabas
committed
Replace Travis and Appveyor with Github Actions
1 parent 1d7c600 commit c205d92

File tree

8 files changed

+224
-97
lines changed

8 files changed

+224
-97
lines changed

Diff for: .github/workflows/nightly.yml

+20-10
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
if: ${{ github.repository_owner == 'puppetlabs' }}
5959
run: |
6060
if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
61-
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata
61+
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2
6262
else
6363
echo "::set-output name=matrix::{}"
6464
fi
@@ -69,6 +69,7 @@ jobs:
6969
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
7070
7171
Acceptance:
72+
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
7273
needs:
7374
- setup_matrix
7475

@@ -82,20 +83,22 @@ jobs:
8283

8384
steps:
8485
- run: |
85-
echo 'platform=${{ matrix.platform }}' >> $BUILDEVENT_FILE
86+
echo 'platform=${{ matrix.platforms.image }}' >> $BUILDEVENT_FILE
8687
echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE
88+
echo 'label=${{ matrix.platforms.label }}' >> $BUILDEVENT_FILE
89+
8790
8891
- name: "Honeycomb: Start recording"
8992
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
9093
with:
9194
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
9295
dataset: ${{ env.HONEYCOMB_DATASET }}
9396
job-status: ${{ job.status }}
94-
matrix-key: ${{ matrix.platform }}-${{ matrix.collection }}
97+
matrix-key: ${{ matrix.platforms.label }}-${{ matrix.collection }}
9598

9699
- name: "Honeycomb: start first step"
97100
run: |
98-
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-1 >> $GITHUB_ENV
101+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-1 >> $GITHUB_ENV
99102
echo STEP_START=$(date +%s) >> $GITHUB_ENV
100103
101104
- name: Checkout Source
@@ -117,18 +120,25 @@ jobs:
117120
if: ${{ always() }}
118121
run: |
119122
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
120-
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
123+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
121124
echo STEP_START=$(date +%s) >> $GITHUB_ENV
122125
123126
- name: Provision test environment
124127
run: |
125-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platform }}' -- bundle exec rake 'litmus:provision[provision::provision_service,${{ matrix.platform }}]'
128+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]'
126129
echo ::group::=== REQUEST ===
127130
cat request.json || true
128131
echo
129132
echo ::endgroup::
130133
echo ::group::=== INVENTORY ===
131-
sed -e 's/password: .*/password: "[redacted]"/' < inventory.yaml || true
134+
if [ -f 'spec/fixtures/litmus_inventory.yaml' ];
135+
then
136+
FILE='spec/fixtures/litmus_inventory.yaml'
137+
elif [ -f 'inventory.yaml' ];
138+
then
139+
FILE='inventory.yaml'
140+
fi
141+
sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true
132142
echo ::endgroup::
133143
134144
- name: Install agent
@@ -144,7 +154,7 @@ jobs:
144154
run: |
145155
echo ::group::honeycomb step
146156
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Deploy test system'
147-
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-3 >> $GITHUB_ENV
157+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-3 >> $GITHUB_ENV
148158
echo STEP_START=$(date +%s) >> $GITHUB_ENV
149159
echo ::endgroup::
150160
@@ -156,14 +166,14 @@ jobs:
156166
if: ${{ always() }}
157167
run: |
158168
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests'
159-
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-4 >> $GITHUB_ENV
169+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-4 >> $GITHUB_ENV
160170
echo STEP_START=$(date +%s) >> $GITHUB_ENV
161171
162172
- name: Remove test environment
163173
if: ${{ always() }}
164174
continue-on-error: true
165175
run: |
166-
if [ -f inventory.yaml ]; then
176+
if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then
167177
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down'
168178
echo ::group::=== REQUEST ===
169179
cat request.json || true

Diff for: .github/workflows/pr_test.yml

+19-10
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
id: get-matrix
5656
run: |
5757
if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
58-
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata
58+
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2
5959
else
6060
echo "::set-output name=matrix::{}"
6161
fi
@@ -66,6 +66,7 @@ jobs:
6666
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
6767
6868
Acceptance:
69+
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
6970
needs:
7071
- setup_matrix
7172
if: ${{ needs.setup_matrix.outputs.matrix != '{}' }}
@@ -80,20 +81,21 @@ jobs:
8081

8182
steps:
8283
- run: |
83-
echo 'platform=${{ matrix.platform }}' >> $BUILDEVENT_FILE
84+
echo 'platform=${{ matrix.platforms.image }}' >> $BUILDEVENT_FILE
8485
echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE
86+
echo 'label=${{ matrix.platforms.label }}' >> $BUILDEVENT_FILE
8587
8688
- name: "Honeycomb: Start recording"
8789
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
8890
with:
8991
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
9092
dataset: ${{ env.HONEYCOMB_DATASET }}
9193
job-status: ${{ job.status }}
92-
matrix-key: ${{ matrix.platform }}-${{ matrix.collection }}
94+
matrix-key: ${{ matrix.platforms.label }}-${{ matrix.collection }}
9395

9496
- name: "Honeycomb: start first step"
9597
run: |
96-
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-1 >> $GITHUB_ENV
98+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-1 >> $GITHUB_ENV
9799
echo STEP_START=$(date +%s) >> $GITHUB_ENV
98100
99101
- name: Checkout Source
@@ -115,18 +117,25 @@ jobs:
115117
if: ${{ always() }}
116118
run: |
117119
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
118-
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
120+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
119121
echo STEP_START=$(date +%s) >> $GITHUB_ENV
120122
121123
- name: Provision test environment
122124
run: |
123-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platform }}' -- bundle exec rake 'litmus:provision[provision::provision_service,${{ matrix.platform }}]'
125+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]'
124126
echo ::group::=== REQUEST ===
125127
cat request.json || true
126128
echo
127129
echo ::endgroup::
128130
echo ::group::=== INVENTORY ===
129-
sed -e 's/password: .*/password: "[redacted]"/' < inventory.yaml || true
131+
if [ -f 'spec/fixtures/litmus_inventory.yaml' ];
132+
then
133+
FILE='spec/fixtures/litmus_inventory.yaml'
134+
elif [ -f 'inventory.yaml' ];
135+
then
136+
FILE='inventory.yaml'
137+
fi
138+
sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true
130139
echo ::endgroup::
131140
132141
- name: Install agent
@@ -142,7 +151,7 @@ jobs:
142151
run: |
143152
echo ::group::honeycomb step
144153
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Deploy test system'
145-
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-3 >> $GITHUB_ENV
154+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-3 >> $GITHUB_ENV
146155
echo STEP_START=$(date +%s) >> $GITHUB_ENV
147156
echo ::endgroup::
148157
@@ -154,14 +163,14 @@ jobs:
154163
if: ${{ always() }}
155164
run: |
156165
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests'
157-
echo STEP_ID=${{ matrix.platform }}-${{ matrix.collection }}-4 >> $GITHUB_ENV
166+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-4 >> $GITHUB_ENV
158167
echo STEP_START=$(date +%s) >> $GITHUB_ENV
159168
160169
- name: Remove test environment
161170
if: ${{ always() }}
162171
continue-on-error: true
163172
run: |
164-
if [ -f inventory.yaml ]; then
173+
if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then
165174
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down'
166175
echo ::group::=== REQUEST ===
167176
cat request.json || true

Diff for: .github/workflows/release.yml

+47
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'

Diff for: .github/workflows/spec.yml

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

Diff for: .pdkignore

+1
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@
4242
/spec/
4343
/.vscode/
4444
/.sync.yml
45+
/.devcontainer/

0 commit comments

Comments
 (0)