Migrate tests to Localstack #163
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: terraform-aws-vpc-peering | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
types: | |
- opened | |
- edited | |
- reopened | |
- synchronize | |
paths-ignore: | |
- '**.md' | |
jobs: | |
terraform-static: | |
name: terraform-fmt | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
terraform: ['1.5.7', '1.7.3'] | |
steps: | |
- uses: actions/checkout@master | |
- uses: hashicorp/setup-terraform@v1 | |
with: | |
terraform_version: ${{ matrix.terraform }} | |
- name: Terraform Format | |
id: fmt | |
run: terraform fmt -check | |
terratest: | |
name: terratest | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
terraform: ['1.5.7', '1.7.3'] | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.21' | |
- name: Checkout | |
uses: actions/checkout@v1 | |
with: | |
fetch-depth: 1 | |
- name: Install Build Dependencies | |
env: | |
TF_VERSION: ${{ matrix.terraform }} | |
run: > | |
wget https://releases.hashicorp.com/terraform/${TF_VERSION}/terraform_${TF_VERSION}_linux_amd64.zip -O /tmp/terraform.zip && | |
sudo unzip -d /tmp/ /tmp/terraform.zip && | |
sudo mv /tmp/terraform /usr/local/bin/ | |
- name: Start Localstack | |
run: docker-compose up -d | |
- name: Terratest | |
env: | |
GOPATH: /home/runner/work/terraform-aws-vpc-peering/go | |
run: > | |
go mod init github.com/grem11n/terraform-aws-vpc-peering && | |
go mod tidy && | |
echo 'package main' > main.go && | |
go test -v -timeout=30m ./... | |
cleanup: | |
name: cleanup | |
runs-on: ubuntu-latest | |
if: always() | |
strategy: | |
matrix: | |
terraform: ['1.5.7', '1.7.3'] | |
needs: ["terratest"] | |
steps: | |
- name: Stop Localstack container | |
run: docker-compose down | |