From cd43e71100307dd5bcbd0404f99dd9714e7edc8e Mon Sep 17 00:00:00 2001 From: diodonfrost Date: Sun, 29 Nov 2020 04:47:30 +0100 Subject: [PATCH] ci(github-action): add github-action support Github-action is the integration tools make by github to execute workflows. This commit add github-action workflows to check the syntax of the terraform code. --- .github/workflows/ci.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a9764d4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: ci + +on: + push: + pull_request: + schedule: + - cron: '0 18 * * sun' + +jobs: + build: + name: terraform ${{ matrix.terraform_version }} fmt + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + terraform_version: + - latest + - 0.13.0 + - 0.12.0 + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install Terraform + run: | + sudo pip install ansible + sudo ansible-galaxy install diodonfrost.terraform && sudo ln -s /root/.ansible/roles/diodonfrost.terraform /root/.ansible/roles/ansible-role-terraform + sudo ansible-pull -U https://github.com/diodonfrost/ansible-role-terraform tests/test.yml -e "terraform_version=${{ matrix.terraform_version }}" + terraform -version + + - name: Terraform fmt + run: | + set -e + terraform fmt -check -diff -recursive