Skip to content

Commit

Permalink
feat: Refactored acceptance test automation
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Hipwell <[email protected]>
  • Loading branch information
stevehipwell committed Nov 25, 2024
1 parent 84c6bd2 commit 1a83288
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 439 deletions.
97 changes: 0 additions & 97 deletions .github/workflows/dotcom-acceptance-tests-all.yml

This file was deleted.

115 changes: 0 additions & 115 deletions .github/workflows/dotcom-acceptance-tests-manual.yml

This file was deleted.

81 changes: 34 additions & 47 deletions .github/workflows/dotcom-acceptance-tests.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,48 @@
name: Dotcom Acceptance Tests
name: Acceptance Tests (github.com)

on:
push:
workflow_dispatch:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- test/**
- main

jobs:
permissions: read-all

acceptance-tests-anonymous:
jobs:
test:
name: Test ${{ matrix.type }}
# if: contains(github.event.pull_request.labels.*.name, 'test')
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
shell: bash
strategy:
matrix:
type: [anonymous, individual, organization]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 2
- name: Acceptance Tests (Anonymous)
uses: terraformtesting/acceptance-tests@66f4842d934555dde0f59bf1a00abd0fc710ece4 # v2.2.0
with:
TF_LOG: INFO

acceptance-tests-individual:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 2
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
- name: Set up Go
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: 'go.mod'
go-version-file: go.mod
cache: true
- name: Acceptance Tests (Individual)
uses: terraformtesting/acceptance-tests@66f4842d934555dde0f59bf1a00abd0fc710ece4 # v2.2.0
with:
TF_LOG: INFO
GITHUB_OWNER: github-terraform-test-user
GITHUB_TEST_USER_TOKEN: ${{ secrets.DOTCOM_TEST_USER_TOKEN }}
GITHUB_TEST_ORGANIZATION: terraformtesting

acceptance-tests-organization:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 2
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: 'go.mod'
cache: true
- name: Acceptance Tests (Organization)
uses: terraformtesting/acceptance-tests@66f4842d934555dde0f59bf1a00abd0fc710ece4 # v2.2.0
with:
- name: Run tests
env:
TF_LOG: INFO
GITHUB_ORGANIZATION: terraformtesting
GITHUB_TEST_USER_TOKEN: ${{ secrets.DOTCOM_TEST_USER_TOKEN }}
GITHUB_TEST_OWNER: github-terraform-test-user
GITHUB_OWNER: ${{ matrix.type == 'individual' && 'github-terraform-test-user' || '' }}
GITHUB_TEST_ORGANIZATION: ${{ matrix.type == 'individual' && 'terraformtesting' || '' }}
GITHUB_ORGANIZATION: ${{ matrix.type == 'organization' && 'terraformtesting' || '' }}
GITHUB_TEST_OWNER: ${{ matrix.type == 'organization' && 'github-terraform-test-user' || '' }}
GITHUB_TEST_USER_TOKEN: ${{ (matrix.type == 'individual' || matrix.type == 'organization') && secrets.DOTCOM_TEST_USER_TOKEN || '' }}
GITHUB_TOKEN: ${{ (matrix.type == 'individual' || matrix.type == 'organization') && secrets.DOTCOM_TEST_USER_TOKEN || '' }}
run: make testacc
Loading

0 comments on commit 1a83288

Please sign in to comment.