feat: Adding GHA workflow for UAT Test Suite #27
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: terratests-uat-suite | ||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
jobs: | ||
setup-tests: | ||
name: Setup UAT Tests | ||
runs-on: ubuntu-latest | ||
env: | ||
EQUINIX_API_ENDPOINT: "https://uatapi.equinix.com" | ||
steps: | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | ||
id: actions-checkout | ||
with: | ||
ref: main | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha || github.ref }} | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: './go.mod' | ||
id: go | ||
- name: Get dependencies | ||
run: | | ||
go mod download | ||
- uses: hashicorp/setup-terraform@v3 | ||
with: | ||
terraform_version: ${{ matrix.terraform }} | ||
terraform_wrapper: false | ||
- name: Setup Variables Files | ||
run: | | ||
Check failure on line 40 in .github/workflows/test-uat-suite.yaml GitHub Actions / terratests-uat-suiteInvalid workflow file
|
||
secret_names=$(gh api repos/equinix/terraform-equinix-fabric/actions/secrets | \ | ||
jq -r '.secrets[].name | select(startswith("TEST_DATA_UAT"))') | ||
echo "::GITHUB_OUTPUT name=secret_names::$secret_names" | ||
for secret_name in $secret_names; do | ||
if [[ "$secret_name" == *"PORT_CONNECTION_PORT_ZSIDE"* ]]; then | ||
secret_value=$(gh api repos/equinix/terraform-equinix-fabric/actions/secrets/$secret_name) | ||
parsed_secret_name=$(echo "$secret_value" | jq -r '.value') | ||
parsed_secret_value="${{ secrets.$parsed_secret_name }}" | ||
echo "$parsed_secret_value" > ./examples/port-2-port-connection/terraform.tfvars.json | ||
echo "Variable Files Transferred" | ||
fi | ||
done | ||
env: | ||
GH_TOKEN: ${{ secrets.SECRET_TOKEN }} | ||
- name: Run Go Tests | ||
run: | ||
go test ./tests/uat -v -coverprofile coverage_uat_modules.txt -covermode=atomic -count 1 -parallel 8 -timeout 180m | ||
- name: Upload test coverage to Codecov | ||
if: ${{ always() }} | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./coverage_uat_modules.txt |