Add Lint action #171
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: | |
markdown-check: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Lint | |
uses: github/super-linter/slim@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
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 ./... |