Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify GitHub workflow #9

Merged
merged 2 commits into from
Aug 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 5 additions & 75 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,88 +6,18 @@ on:
pull_request:
branches: [ master ]

env:
TERRAFORM_DOCS_VERSION: "v0.9.1"
TFLINT_VERSION: "v0.16.2"

jobs:
terraform-validation:
runs-on: ubuntu-latest

steps:
- uses: actions/setup-python@v1
name: "SETUP: Python"

- uses: actions/setup-go@v2
name: "SETUP: Go"

- uses: pat-s/[email protected]
id: cache-terraform-docs
name: "CACHE: terraform-docs Go module"
with:
path: |
~/go/pkg/mod
~/go/bin/terraform-docs
key: ${{ runner.os }}-terraform_docs-${{ env.TERRAFORM_DOCS_VERSION }}
restore-keys: |
${{ runner.os}}-terraform_docs-

- shell: bash
name: "INSTALL: terraform-docs"
if: steps.cache-terraform-docs.output.cache-hit != 'true'
env:
GO111MODULE: "on"
run: |
go get github.com/segmentio/terraform-docs@${{ env.TERRAFORM_DOCS_VERSION }}

- shell: bash
name: "SETUP: Go path"
run: echo '::add-path::~/go/bin/'

- uses: actions/checkout@v1
name: Checkout source code

- uses: pat-s/[email protected]
id: cache-pre-commit-dependencies
name: "CACHE: pip and pre-commit dependencies"
with:
path: |
~/.cache/pre-commit
~/.cache/pip
key: ${{ runner.os }}-pip-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pip-pre-commit-

- uses: pat-s/[email protected]
id: cache-tflint
name: "CACHE: TFLint"
- uses: actions/setup-python@v1
- uses: lablabs/setup-terraform-docs@v1
- uses: lablabs/setup-tflint@v1
- uses: BSFishy/pip-action@v1
with:
path: |
~/tflint/bin/
key: ${{ runner.os }}-tflint-${{ env.TFLINT_VERSION }}
restore-keys: |
${{ runner.os }}-tflint-

- shell: bash
name: "INSTALL: detect-secrets"
run: |
pip install detect-secrets

- shell: bash
name: "INSTALL: TFLint"
if: steps.cache-tflint.outputs.cache-hit != 'true'
run: |
wget https://github.com/terraform-linters/tflint/releases/download/${{ env.TFLINT_VERSION }}/tflint_linux_amd64.zip
unzip tflint_linux_amd64.zip
mkdir -p ~/tflint/bin/
install tflint ~/tflint/bin/

- shell: bash
name: "SETUP: TFLint path"
run: |
echo '::add-path::~/tflint/bin/'

packages: detect-secrets
- uses: pre-commit/[email protected]
name: "RUN: pre-commit"
env:
AWS_DEFAULT_REGION: "eu-central-1"