Skip to content

Commit 64d803c

Browse files
committed
feat: Refactored acceptance test automation
Signed-off-by: Steve Hipwell <[email protected]>
1 parent 84c6bd2 commit 64d803c

6 files changed

+76
-438
lines changed

.github/workflows/dotcom-acceptance-tests-all.yml

-97
This file was deleted.

.github/workflows/dotcom-acceptance-tests-manual.yml

-115
This file was deleted.
+33-47
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,47 @@
1-
name: Dotcom Acceptance Tests
1+
name: Acceptance Tests (github.com)
22

33
on:
4-
push:
4+
workflow_dispatch:
5+
pull_request:
6+
types:
7+
- opened
8+
- synchronize
9+
- reopened
510
branches:
6-
- test/**
11+
- main
712

8-
jobs:
13+
permissions: read-all
914

10-
acceptance-tests-anonymous:
15+
jobs:
16+
test:
17+
name: Test ${{ matrix.type }}
18+
# if: contains(github.event.pull_request.labels.*.name, 'test')
1119
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
defaults:
23+
run:
24+
shell: bash
25+
strategy:
26+
matrix:
27+
type: [anonymous, individual, organization]
28+
fail-fast: false
1229
steps:
1330
- name: Checkout
1431
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
15-
with:
16-
ref: ${{ github.event.pull_request.head.ref }}
17-
fetch-depth: 2
18-
- name: Acceptance Tests (Anonymous)
19-
uses: terraformtesting/acceptance-tests@66f4842d934555dde0f59bf1a00abd0fc710ece4 # v2.2.0
20-
with:
21-
TF_LOG: INFO
2232

23-
acceptance-tests-individual:
24-
runs-on: ubuntu-latest
25-
steps:
26-
- name: Checkout
27-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
28-
with:
29-
ref: ${{ github.event.pull_request.head.ref }}
30-
fetch-depth: 2
31-
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
33+
- name: Set up Go
34+
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
3235
with:
33-
go-version-file: 'go.mod'
36+
go-version-file: go.mod
3437
cache: true
35-
- name: Acceptance Tests (Individual)
36-
uses: terraformtesting/acceptance-tests@66f4842d934555dde0f59bf1a00abd0fc710ece4 # v2.2.0
37-
with:
38-
TF_LOG: INFO
39-
GITHUB_OWNER: github-terraform-test-user
40-
GITHUB_TEST_USER_TOKEN: ${{ secrets.DOTCOM_TEST_USER_TOKEN }}
41-
GITHUB_TEST_ORGANIZATION: terraformtesting
4238

43-
acceptance-tests-organization:
44-
runs-on: ubuntu-latest
45-
steps:
46-
- name: Checkout
47-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
48-
with:
49-
ref: ${{ github.event.pull_request.head.ref }}
50-
fetch-depth: 2
51-
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
52-
with:
53-
go-version-file: 'go.mod'
54-
cache: true
55-
- name: Acceptance Tests (Organization)
56-
uses: terraformtesting/acceptance-tests@66f4842d934555dde0f59bf1a00abd0fc710ece4 # v2.2.0
57-
with:
39+
- name: Run tests
40+
env:
5841
TF_LOG: INFO
59-
GITHUB_ORGANIZATION: terraformtesting
60-
GITHUB_TEST_USER_TOKEN: ${{ secrets.DOTCOM_TEST_USER_TOKEN }}
61-
GITHUB_TEST_OWNER: github-terraform-test-user
42+
GITHUB_OWNER: ${{ matrix.type == 'individual' && 'github-terraform-test-user' || '' }}
43+
GITHUB_TEST_ORGANIZATION: ${{ matrix.type == 'individual' && 'terraformtesting' || '' }}
44+
GITHUB_ORGANIZATION: ${{ matrix.type == 'organization' && 'terraformtesting' || '' }}
45+
GITHUB_TEST_OWNER: ${{ matrix.type == 'organization' && 'github-terraform-test-user' || '' }}
46+
GITHUB_TEST_USER_TOKEN: ${{ (matrix.type == 'individual' || matrix.type == 'organization') && secrets.DOTCOM_TEST_USER_TOKEN || '' }}
47+
run: make testacc

0 commit comments

Comments
 (0)