Skip to content

Commit 5ba0366

Browse files
authored
(IAC-1613) - Update GA workflows for Nightly and PR testing (#746)
* Update GA workflows for Nightly and PR Testing
1 parent b024d22 commit 5ba0366

File tree

4 files changed

+389
-1
lines changed

4 files changed

+389
-1
lines changed

.github/workflows/nightly.yml

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
name: "nightly"
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
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+
matrix: ${{ steps.get-matrix.outputs.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 Acceptance Test Matrix
57+
id: get-matrix
58+
if: ${{ github.repository_owner == 'puppetlabs' }}
59+
run: |
60+
if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
61+
echo "::set-output name=matrix::{'collection':['puppet6-nightly','puppet7-nightly'],'platforms':[{'label':'Windows 2016','provider':'provision::provision_service','image':'windows-2016'},{'label':'Windows 2019','provider':'provision::provision_service','image':'windows-2019-core'}]}"
62+
fi
63+
64+
- name: "Honeycomb: Record Setup Test Matrix time"
65+
if: ${{ always() }}
66+
run: |
67+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
68+
69+
Acceptance:
70+
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
71+
needs:
72+
- setup_matrix
73+
74+
runs-on: ubuntu-20.04
75+
strategy:
76+
fail-fast: false
77+
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}
78+
79+
env:
80+
BUILDEVENT_FILE: "../buildevents.txt"
81+
82+
steps:
83+
- run: |
84+
echo 'platform=${{ matrix.platforms.image }}' >> $BUILDEVENT_FILE
85+
echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE
86+
echo 'label=${{ matrix.platforms.label }}' >> $BUILDEVENT_FILE
87+
88+
- name: "Honeycomb: Start recording"
89+
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
90+
with:
91+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
92+
dataset: ${{ env.HONEYCOMB_DATASET }}
93+
job-status: ${{ job.status }}
94+
matrix-key: ${{ matrix.platforms.label }}-${{ matrix.collection }}
95+
96+
- name: "Honeycomb: start first step"
97+
run: |
98+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-1 >> $GITHUB_ENV
99+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
100+
101+
- name: Checkout Source
102+
uses: actions/checkout@v2
103+
104+
- name: Activate Ruby 2.7
105+
uses: ruby/setup-ruby@v1
106+
with:
107+
ruby-version: "2.7"
108+
bundler-cache: true
109+
110+
- name: Print bundle environment
111+
run: |
112+
echo ::group::bundler environment
113+
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
114+
echo ::endgroup::
115+
116+
- name: "Honeycomb: Record Setup Environment time"
117+
if: ${{ always() }}
118+
run: |
119+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
120+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
121+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
122+
123+
- name: Provision test environment
124+
run: |
125+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]'
126+
echo ::group::=== REQUEST ===
127+
cat request.json || true
128+
echo
129+
echo ::endgroup::
130+
echo ::group::=== INVENTORY ===
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
139+
echo ::endgroup::
140+
141+
- name: Install agent
142+
run: |
143+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
144+
145+
- name: Install module
146+
run: |
147+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module'
148+
149+
- name: "Honeycomb: Record deployment times"
150+
if: ${{ always() }}
151+
run: |
152+
echo ::group::honeycomb step
153+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Deploy test system'
154+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-3 >> $GITHUB_ENV
155+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
156+
echo ::endgroup::
157+
158+
- name: Run acceptance tests
159+
run: |
160+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel'
161+
162+
- name: "Honeycomb: Record acceptance testing times"
163+
if: ${{ always() }}
164+
run: |
165+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests'
166+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-4 >> $GITHUB_ENV
167+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
168+
169+
- name: Remove test environment
170+
if: ${{ always() }}
171+
continue-on-error: true
172+
run: |
173+
if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then
174+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down'
175+
echo ::group::=== REQUEST ===
176+
cat request.json || true
177+
echo
178+
echo ::endgroup::
179+
fi
180+
181+
- name: "Honeycomb: Record removal times"
182+
if: ${{ always() }}
183+
run: |
184+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment'
185+
186+
slack-workflow-status:
187+
if: always()
188+
name: Post Workflow Status To Slack
189+
needs:
190+
- Acceptance
191+
runs-on: ubuntu-20.04
192+
steps:
193+
- name: Slack Workflow Notification
194+
uses: puppetlabs/Gamesight-slack-workflow-status@pdk-templates-v1
195+
with:
196+
# Required Input
197+
repo_token: ${{ secrets.GITHUB_TOKEN }}
198+
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }}
199+
# Optional Input
200+
channel: "#team-ia-bots"
201+
name: "GABot"

.github/workflows/pr_test.yaml

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
name: "PR Test"
2+
3+
on:
4+
pull_request:
5+
6+
env:
7+
HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6
8+
HONEYCOMB_DATASET: litmus tests
9+
10+
jobs:
11+
setup_matrix:
12+
name: "Setup Test Matrix"
13+
runs-on: ubuntu-20.04
14+
outputs:
15+
matrix: ${{ steps.get-matrix.outputs.matrix }}
16+
17+
steps:
18+
- name: "Honeycomb: Start recording"
19+
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
20+
with:
21+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
22+
dataset: ${{ env.HONEYCOMB_DATASET }}
23+
job-status: ${{ job.status }}
24+
25+
- name: "Honeycomb: Start first step"
26+
run: |
27+
echo STEP_ID=setup-environment >> $GITHUB_ENV
28+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
29+
30+
- name: Checkout Source
31+
uses: actions/checkout@v2
32+
if: ${{ github.repository_owner == 'puppetlabs' }}
33+
34+
- name: Activate Ruby 2.7
35+
uses: ruby/setup-ruby@v1
36+
if: ${{ github.repository_owner == 'puppetlabs' }}
37+
with:
38+
ruby-version: "2.7"
39+
bundler-cache: true
40+
41+
- name: Print bundle environment
42+
if: ${{ github.repository_owner == 'puppetlabs' }}
43+
run: |
44+
echo ::group::bundler environment
45+
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
46+
echo ::endgroup::
47+
48+
- name: "Honeycomb: Record Setup Environment time"
49+
if: ${{ github.repository_owner == 'puppetlabs' }}
50+
run: |
51+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
52+
echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV
53+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
54+
55+
- name: Setup Acceptance Test Matrix
56+
id: get-matrix
57+
if: ${{ github.repository_owner == 'puppetlabs' }}
58+
run: |
59+
if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
60+
echo "::set-output name=matrix::{'collection':['puppet6-nightly','puppet7-nightly'],'platforms':[{'label':'Windows 2016','provider':'provision::provision_service','image':'windows-2016'},{'label':'Windows 2019','provider':'provision::provision_service','image':'windows-2019-core'}]}"
61+
fi
62+
63+
- name: "Honeycomb: Record Setup Test Matrix time"
64+
if: ${{ always() }}
65+
run: |
66+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
67+
68+
Acceptance:
69+
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
70+
needs:
71+
- setup_matrix
72+
73+
runs-on: ubuntu-20.04
74+
strategy:
75+
fail-fast: false
76+
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}
77+
78+
env:
79+
BUILDEVENT_FILE: "../buildevents.txt"
80+
81+
steps:
82+
- run: |
83+
echo 'platform=${{ matrix.platforms.image }}' >> $BUILDEVENT_FILE
84+
echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE
85+
echo 'label=${{ matrix.platforms.label }}' >> $BUILDEVENT_FILE
86+
87+
- name: "Honeycomb: Start recording"
88+
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
89+
with:
90+
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
91+
dataset: ${{ env.HONEYCOMB_DATASET }}
92+
job-status: ${{ job.status }}
93+
matrix-key: ${{ matrix.platforms.label }}-${{ matrix.collection }}
94+
95+
- name: "Honeycomb: start first step"
96+
run: |
97+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-1 >> $GITHUB_ENV
98+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
99+
100+
- name: Checkout Source
101+
uses: actions/checkout@v2
102+
103+
- name: Activate Ruby 2.7
104+
uses: ruby/setup-ruby@v1
105+
with:
106+
ruby-version: "2.7"
107+
bundler-cache: true
108+
109+
- name: Print bundle environment
110+
run: |
111+
echo ::group::bundler environment
112+
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
113+
echo ::endgroup::
114+
115+
- name: "Honeycomb: Record Setup Environment time"
116+
if: ${{ always() }}
117+
run: |
118+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
119+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
120+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
121+
122+
- name: Provision test environment
123+
run: |
124+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]'
125+
echo ::group::=== REQUEST ===
126+
cat request.json || true
127+
echo
128+
echo ::endgroup::
129+
echo ::group::=== INVENTORY ===
130+
if [ -f 'spec/fixtures/litmus_inventory.yaml' ];
131+
then
132+
FILE='spec/fixtures/litmus_inventory.yaml'
133+
elif [ -f 'inventory.yaml' ];
134+
then
135+
FILE='inventory.yaml'
136+
fi
137+
sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true
138+
echo ::endgroup::
139+
140+
- name: Install agent
141+
run: |
142+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
143+
144+
- name: Install module
145+
run: |
146+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module'
147+
148+
- name: "Honeycomb: Record deployment times"
149+
if: ${{ always() }}
150+
run: |
151+
echo ::group::honeycomb step
152+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Deploy test system'
153+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-3 >> $GITHUB_ENV
154+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
155+
echo ::endgroup::
156+
157+
- name: Run acceptance tests
158+
run: |
159+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel'
160+
161+
- name: "Honeycomb: Record acceptance testing times"
162+
if: ${{ always() }}
163+
run: |
164+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests'
165+
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-4 >> $GITHUB_ENV
166+
echo STEP_START=$(date +%s) >> $GITHUB_ENV
167+
168+
- name: Remove test environment
169+
if: ${{ always() }}
170+
continue-on-error: true
171+
run: |
172+
if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then
173+
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down'
174+
echo ::group::=== REQUEST ===
175+
cat request.json || true
176+
echo
177+
echo ::endgroup::
178+
fi
179+
180+
- name: "Honeycomb: Record removal times"
181+
if: ${{ always() }}
182+
run: |
183+
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment'

.github/workflows/ubuntu18_pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: "Test on Ubuntu Github Runners"
22

3-
on: [push, pull_request]
3+
on: [pull_request]
44

55
jobs:
66
Acceptance:

0 commit comments

Comments
 (0)