Skip to content

ci: synced file(s) with honestbank/.github #504

ci: synced file(s) with honestbank/.github

ci: synced file(s) with honestbank/.github #504

Workflow file for this run

name: terratest
on:
pull_request:
branches:
- main
push:
branches:
- main
env:
TERRATEST_GOOGLE_CREDENTIALS: ${{ secrets.TERRATEST_GOOGLE_CREDENTIALS }}
GOOGLE_PROJECT: ${{ secrets.TERRATEST_GOOGLE_PROJECT }}
GCP_SA_EMAIL: ${{ secrets.TERRATEST_GCP_SA_EMAIL }}
TF_VAR_google_project: ${{ secrets.TERRATEST_GOOGLE_PROJECT }}
TF_VAR_google_credentials: ${{ secrets.TERRATEST_GOOGLE_CREDENTIALS }}
TF_VAR_shared_vpc_host_google_credentials: ${{ secrets.TERRATEST_GOOGLE_CREDENTIALS }}
TF_VAR_google_region: asia-southeast2
jobs:
terratest:
name: terratest
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go modules directory
uses: actions/checkout@v2
with:
submodules: true
- name: Set up Go (1.17)
uses: actions/setup-go@v2
with:
go-version: 1.17
id: go
- id: "google-cloud-auth"
name: Google Cloud Auth
uses: "google-github-actions/auth@v0"
with:
credentials_json: "${{ env.TERRATEST_GOOGLE_CREDENTIALS }}"
- name: Setup gcloud CLI
uses: google-github-actions/setup-gcloud@v0
with:
version: "latest" # This is the default value anyways, just being explicit
project_id: ${{ secrets.TERRATEST_GOOGLE_PROJECT }}
- name: Set Google Cloud project
run: gcloud config set project $GOOGLE_PROJECT
- name: Run terratest
run: |
cd test
go test -v -timeout 30m
- name: Release
if: github.event_name == 'push'
uses: cycjimmy/semantic-release-action@v2
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
extra_plugins: |
@semantic-release/git@10.0.1
@semantic-release/exec@6.0.3
@semantic-release/changelog@6.0.1