Skip to content

feat: Refactored acceptance test automation #245

feat: Refactored acceptance test automation

feat: Refactored acceptance test automation #245

name: Acceptance Tests (GHES)
on:
workflow_dispatch:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- main
permissions: read-all
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
- name: Set up Go
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: go.mod
cache: true
- name: Check server address
run: |
address="$(dig +short terraformtesting-ghe.eastus.cloudapp.azure.com)"
if [[ "${address}" == ""]]; then
echo "Invalid server address" >&2
exit 1
fi
- name: Run tests
env:
TF_LOG: INFO
GITHUB_BASE_URL: https://terraformtesting-ghe.eastus.cloudapp.azure.com/
GITHUB_OWNER: ${{ matrix.type == 'individual' && 'administrator' || '' }}
GITHUB_ORGANIZATION: ${{ matrix.type == 'organization' && 'terraformtesting' || '' }}
GITHUB_TEST_USER_TOKEN: ${{ (matrix.type == 'individual' || matrix.type == 'organization') && secrets.GHES_TEST_USER_TOKEN || '' }}
run: make testacc