feat: Refactored acceptance test automation #245
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |