Skip to content

chore(ci): Update .goreleaser.yml to include LICENSE.txt file (#480) #364

chore(ci): Update .goreleaser.yml to include LICENSE.txt file (#480)

chore(ci): Update .goreleaser.yml to include LICENSE.txt file (#480) #364

Workflow file for this run

# This GitHub action runs your tests for each commit push and/or PR. Optionally
# you can turn it on using a cron schedule for regular testing.
#
name: Acceptance Tests
on:
# Commenting out for now, since the Service Account with Vault can only create 10 secret keys
# at a time. If this runs twice (on push, when it's already PR'ed) that's 8 secret keys.
# TODO (mbang): re-evaluate ttl on tokens
# pull_request:
# paths-ignore:
# - 'README.md'
push:
branches:
- main
paths-ignore:
- 'README.md'
# For systems with an upstream API that could drift unexpectedly (like most SaaS systems, etc.),
# we recommend testing at a regular interval not necessarily tied to code changes. This will
# ensure you are alerted to something breaking due to an API change, even if the code did not
# change.
# schedule:
# - cron: '0 13 * * *'
jobs:
# ensure the code builds...
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Set up Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: '1.18'
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Get dependencies
run: |
go mod download
- name: Build
run: |
go build -v .
# run acceptance tests in a matrix with Terraform core versions
test:
name: Matrix Test
needs: build
runs-on: ubuntu-latest
timeout-minutes: 150
strategy:
fail-fast: false
max-parallel: 1
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- '0.12.31'
# skipping due to https://github.com/hashicorp/terraform/issues/25961 test failures
# - '0.13.4'
- '0.14.11'
- '1.0.3'
steps:
- name: Set up Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: '1.16'
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Get dependencies
run: |
go mod download
- name: Get credentials
id: vault
uses: hashicorp/vault-action@v2.4.0
with:
url: ${{ secrets.VAULT_ADDR }}
method: approle
roleId: ${{ secrets.ROLE_ID }}
secretId: ${{ secrets.SECRET_ID }}
tlsSkipVerify: true
exportEnv: false
namespace: admin/tpgw
secrets: |
gcp/key/tf-acctest private_key_data
- name: Pre-sweep lingering resources
timeout-minutes: 10
env:
GOOGLEWORKSPACE_CUSTOMER_ID: ${{ secrets.GOOGLEWORKSPACE_CUSTOMER_ID }}
GOOGLEWORKSPACE_IMPERSONATED_USER_EMAIL: ${{ secrets.GOOGLEWORKSPACE_IMPERSONATED_USER_EMAIL }}
run: |
export GOOGLEWORKSPACE_CREDENTIALS=$(echo -n ${{ steps.vault.outputs.private_key_data }} | base64 --decode)
go test ./internal/provider -v -sweep=us-central1 -sweep-run= -timeout 60m
- name: TF acceptance tests
timeout-minutes: 120
env:
TF_ACC: "1"
TF_LOG: "DEBUG"
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }}
# Set whatever additional acceptance test env vars here. You can
# optionally use data from your repository secrets using the
# following syntax:
# SOME_VAR: ${{ secrets.SOME_VAR }}
GOOGLEWORKSPACE_CUSTOMER_ID: ${{ secrets.GOOGLEWORKSPACE_CUSTOMER_ID }}
GOOGLEWORKSPACE_DOMAIN: ${{ secrets.GOOGLEWORKSPACE_DOMAIN }}
GOOGLEWORKSPACE_IMPERSONATED_USER_EMAIL: ${{ secrets.GOOGLEWORKSPACE_IMPERSONATED_USER_EMAIL }}
GOOGLEWORKSPACE_IMPERSONATED_SERVICE_ACCOUNT: ${{ secrets.GOOGLEWORKSPACE_IMPERSONATED_SERVICE_ACCOUNT }}
run: |
export GOOGLEWORKSPACE_CREDENTIALS=$(echo -n ${{ steps.vault.outputs.private_key_data }} | base64 --decode)
go test -v -cover ./internal/provider/ -timeout 120m
- name: Post-sweep lingering resources
timeout-minutes: 10
env:
GOOGLEWORKSPACE_CUSTOMER_ID: ${{ secrets.GOOGLEWORKSPACE_CUSTOMER_ID }}
GOOGLEWORKSPACE_IMPERSONATED_USER_EMAIL: ${{ secrets.GOOGLEWORKSPACE_IMPERSONATED_USER_EMAIL }}
run: |
export GOOGLEWORKSPACE_CREDENTIALS=$(echo -n ${{ steps.vault.outputs.private_key_data }} | base64 --decode)
go test ./internal/provider -v -sweep=us-central1 -sweep-run= -timeout 60m