Skip to content

Commit

Permalink
chore: add examples validation ci/cd workflow (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryantbiggs authored Feb 20, 2021
1 parent b2c9646 commit 27be1f8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ name: Pre-Commit

on:
pull_request:
push:
branches:
- master

jobs:
versionExtract:
getBaseVersion:
name: Get min/max versions
runs-on: ubuntu-latest

Expand All @@ -19,17 +22,16 @@ jobs:
minVersion: ${{ steps.minMax.outputs.minVersion }}
maxVersion: ${{ steps.minMax.outputs.maxVersion }}

versionEvaluate:
name: Evaluate Terraform versions
preCommit:
name: Pre-commit check
runs-on: ubuntu-latest
needs: versionExtract
needs: getBaseVersion
strategy:
fail-fast: false
matrix:
version:
- ${{ needs.versionExtract.outputs.minVersion }}
- ${{ needs.versionExtract.outputs.maxVersion }}
directory: [examples/complete, examples/simple]
- ${{ needs.getBaseVersion.outputs.minVersion }}
- ${{ needs.getBaseVersion.outputs.maxVersion }}

steps:
- name: Checkout
Expand All @@ -48,5 +50,6 @@ jobs:
pip install pre-commit
curl -L "$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E "https://.+?-linux-amd64" | head -n1)" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/
- name: Execute pre-commit
run: pre-commit run --color=always --show-diff-on-failure --all-files

0 comments on commit 27be1f8

Please sign in to comment.