Skip to content

Commit

Permalink
demo issue 20 fix via GH Actions
Browse files Browse the repository at this point in the history
Ideally, tf-summarize would feature a suite of automated tests verifying
its functionality. In absenece of that, this demos the issue #20 fix via
GH Actions.
  • Loading branch information
mdb committed Jan 13, 2024
1 parent ed100ee commit f99306a
Showing 1 changed file with 75 additions and 20 deletions.
95 changes: 75 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,89 @@ name: Build

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: -exclude=G204 ./...

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest

- name: Test
run: go test -v ./...

- name: Build
run: go build

demo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "1.21"

- name: Build
run: |
go build -o example/tf-summarize
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false

- name: Print tf-summarize version and help
run: |
./tf-summarize -v
./tf-summarize -h
working-directory: ./example

- name: Terraform Init
run: terraform init
working-directory: ./example

- name: Terraform Plan
run: |
terraform plan -out=tfplan -refresh=false # -refresh=false is only for demo workflow
terraform show -json tfplan > tfplan.json
working-directory: ./example

- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
args: -exclude=G204 ./...
- name: summary in table format
run: terraform show -json tfplan | ./tf-summarize
working-directory: ./example

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: summary in table format with plan JSON file passed
run: |
./tf-summarize tfplan.json
working-directory: ./example

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
- name: summary in tree format
run: terraform show -json tfplan | ./tf-summarize -tree
working-directory: ./example

- name: Test
run: go test -v ./...
- name: summary in separate tree format
run: terraform show -json tfplan | ./tf-summarize -separate-tree
working-directory: ./example

- name: Build
run: go build
- name: summary in draw visual tree format
run: terraform show -json tfplan | ./tf-summarize -tree -draw
working-directory: ./example

0 comments on commit f99306a

Please sign in to comment.