Skip to content

Commit 997529e

Browse files
Merge pull request #414 from puppetlabs/cat-2083-modernise_puppetlabs_testing
(CAT-2083) - Modernize module
2 parents c22d6aa + 05364da commit 997529e

File tree

20 files changed

+196
-1001
lines changed

20 files changed

+196
-1001
lines changed

.github/workflows/auto_release.yml

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

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: "ci"
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
7+
jobs:
8+
Spec:
9+
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
10+
secrets: "inherit"
11+
12+
Acceptance:
13+
uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main"
14+
secrets: "inherit"
15+
with:
16+
runs_on: "ubuntu-20.04"

.github/workflows/manual_test.yml

Lines changed: 14 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ on:
88
required: true
99

1010
env:
11-
HONEYCOMB_WRITEKEY: xxxxxxxxxxxxxxx
12-
HONEYCOMB_DATASET: litmus tests
1311
SERVICE_URL: ${{ github.event.inputs.service }}/v1/provision
1412

1513
jobs:
@@ -20,56 +18,28 @@ jobs:
2018
matrix: ${{ steps.get-matrix.outputs.matrix }}
2119

2220
steps:
23-
- name: "Honeycomb: Start recording"
24-
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
25-
with:
26-
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
27-
dataset: ${{ env.HONEYCOMB_DATASET }}
28-
job-status: ${{ job.status }}
29-
30-
- name: "Honeycomb: Start first step"
31-
run: |
32-
echo STEP_ID=setup-environment >> $GITHUB_ENV
33-
echo STEP_START=$(date +%s) >> $GITHUB_ENV
34-
3521
- name: Checkout Source
36-
uses: actions/checkout@v2
22+
uses: actions/checkout@v4
3723
if: ${{ github.repository_owner == 'puppetlabs' }}
3824

39-
- name: Activate Ruby 2.7
25+
- name: Activate Ruby 3.2
4026
uses: ruby/setup-ruby@v1
4127
if: ${{ github.repository_owner == 'puppetlabs' }}
4228
with:
43-
ruby-version: "2.7"
29+
ruby-version: "3.2"
4430
bundler-cache: true
4531

4632
- name: Print bundle environment
4733
if: ${{ github.repository_owner == 'puppetlabs' }}
4834
run: |
4935
echo ::group::bundler environment
50-
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
36+
bundle env
5137
echo ::endgroup::
5238
53-
- name: "Honeycomb: Record Setup Environment time"
54-
if: ${{ github.repository_owner == 'puppetlabs' }}
55-
run: |
56-
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
57-
echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV
58-
echo STEP_START=$(date +%s) >> $GITHUB_ENV
59-
6039
- name: Setup Acceptance Test Matrix
6140
id: get-matrix
6241
run: |
63-
if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then
64-
buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2
65-
else
66-
echo "::set-output name=matrix::{}"
67-
fi
68-
69-
- name: "Honeycomb: Record Setup Test Matrix time"
70-
if: ${{ always() }}
71-
run: |
72-
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix'
42+
bundle exec matrix_from_metadata_v2 --provision-service
7343
7444
Acceptance:
7545
name: "${{matrix.platforms.label}}, ${{matrix.collection}}"
@@ -82,53 +52,25 @@ jobs:
8252
fail-fast: false
8353
matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}}
8454

85-
env:
86-
BUILDEVENT_FILE: '../buildevents.txt'
87-
8855
steps:
89-
- run: |
90-
echo 'platform=${{ matrix.platforms.image }}' >> $BUILDEVENT_FILE
91-
echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE
92-
echo 'label=${{ matrix.platforms.label }}' >> $BUILDEVENT_FILE
93-
94-
- name: "Honeycomb: Start recording"
95-
uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1
96-
with:
97-
apikey: ${{ env.HONEYCOMB_WRITEKEY }}
98-
dataset: ${{ env.HONEYCOMB_DATASET }}
99-
job-status: ${{ job.status }}
100-
matrix-key: ${{ matrix.platforms.label }}-${{ matrix.collection }}
101-
102-
- name: "Honeycomb: start first step"
103-
run: |
104-
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-1 >> $GITHUB_ENV
105-
echo STEP_START=$(date +%s) >> $GITHUB_ENV
106-
10756
- name: Checkout Source
108-
uses: actions/checkout@v2
57+
uses: actions/checkout@v4
10958

110-
- name: Activate Ruby 2.7
59+
- name: Activate Ruby 3.2
11160
uses: ruby/setup-ruby@v1
11261
with:
113-
ruby-version: "2.7"
62+
ruby-version: "3.2"
11463
bundler-cache: true
11564

11665
- name: Print bundle environment
11766
run: |
11867
echo ::group::bundler environment
119-
buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env
68+
bundle env
12069
echo ::endgroup::
12170
122-
- name: "Honeycomb: Record Setup Environment time"
123-
if: ${{ always() }}
124-
run: |
125-
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment'
126-
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV
127-
echo STEP_START=$(date +%s) >> $GITHUB_ENV
128-
12971
- name: Provision test environment
13072
run: |
131-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]'
73+
bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]'
13274
echo ::group::=== REQUEST ===
13375
cat request.json || true
13476
echo
@@ -146,62 +88,18 @@ jobs:
14688
14789
- name: Install agent
14890
run: |
149-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
91+
bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]'
15092
15193
- name: Install module
15294
run: |
153-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module'
154-
155-
- name: "Honeycomb: Record deployment times"
156-
if: ${{ always() }}
157-
run: |
158-
echo ::group::honeycomb step
159-
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Deploy test system'
160-
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-3 >> $GITHUB_ENV
161-
echo STEP_START=$(date +%s) >> $GITHUB_ENV
162-
echo ::endgroup::
95+
bundle exec rake 'litmus:install_module'
16396
16497
- name: Run acceptance tests
16598
run: |
166-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel'
167-
168-
- name: "Honeycomb: Record acceptance testing times"
169-
if: ${{ always() }}
170-
run: |
171-
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests'
172-
echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-4 >> $GITHUB_ENV
173-
echo STEP_START=$(date +%s) >> $GITHUB_ENV
99+
bundle exec rake 'litmus:acceptance:parallel'
174100
175101
- name: Remove test environment
176102
if: ${{ always() }}
177103
continue-on-error: true
178104
run: |
179-
if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then
180-
buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down'
181-
echo ::group::=== REQUEST ===
182-
cat request.json || true
183-
echo
184-
echo ::endgroup::
185-
fi
186-
187-
- name: "Honeycomb: Record removal times"
188-
if: ${{ always() }}
189-
run: |
190-
buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment'
191-
192-
slack-workflow-status:
193-
if: always()
194-
name: Post Workflow Status To Slack
195-
needs:
196-
- Acceptance
197-
runs-on: ubuntu-20.04
198-
steps:
199-
- name: Slack Workflow Notification
200-
uses: puppetlabs/Gamesight-slack-workflow-status@pdk-templates-v1
201-
with:
202-
# Required Input
203-
repo_token: ${{secrets.GITHUB_TOKEN}}
204-
slack_webhook_url: ${{secrets.SLACK_WEBHOOK}}
205-
# Optional Input
206-
channel: '#team-ia-bots'
207-
name: 'GABot'
105+
bundle exec rake 'litmus:tear_down'

0 commit comments

Comments
 (0)