Skip to content

feat: Refactored acceptance test automation #6

feat: Refactored acceptance test automation

feat: Refactored acceptance test automation #6

name: Acceptance Tests (github.com)
on:
workflow_dispatch:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- main
permissions: read-all
jobs:
test:
name: Test ${{ matrix.mode }}
# if: contains(github.event.pull_request.labels.*.name, 'acctest')
# environment:
# name: dotcom
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
mode: [anonymous, individual, organization] # enterprise
fail-fast: false
defaults:
run:
shell: bash
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 credentials
if: matrix.mode != 'anonymous'
run: |
if [[ -z "${{ secrets.DOTCOM_TEST_USER_TOKEN }}" ]]; then
echo "Missing credentials" >&2
exit 1
fi
- name: Run tests
env:
TF_ACC: "1"
TF_LOG: INFO
TESTARGS: ${{ matrix.mode != 'anonymous' && '-sweep="noregion"' || '' }}
GITHUB_BASE_URL: https://api.github.com/
GITHUB_TEST_USERNAME: github-terraform-test-user
GITHUB_TEST_COLLABORATOR_USERNAME: ""
GITHUB_TEST_COLLABORATOR_TOKEN: ""
GITHUB_TEST_COLLABORATOR_USERNAME2: ""
GITHUB_TEST_ORGANIZATION: terraformtesting
GITHUB_TEST_ORGANIZATION_SECRET_NAME: ""
GITHUB_TEST_ORGANIZATION_APP_INSTALLATION_ID: ""
GITHUB_TEST_ORGANIZATION_REPOSITORY: test-repo
GITHUB_TEST_TYPE: ${{ matrix.mode }}
GITHUB_OWNER: ${{ (matrix.mode == 'individual' && 'github-terraform-test-user') || (matrix.mode == 'organization' && 'terraformtesting') || '' }}
GITHUB_ENTERPRISE_SLUG: ""
GITHUB_TOKEN: ${{ matrix.mode != 'anonymous' && secrets.DOTCOM_TEST_USER_TOKEN || '' }}
run: make testacc