From 865027d9f52a362c04d85042523919caccb9e50d Mon Sep 17 00:00:00 2001 From: danischm Date: Sat, 20 Apr 2024 08:18:14 +0200 Subject: [PATCH] Add test workflow --- .github/dependabot.yml | 10 +++++++ .github/workflows/test.yml | 60 ++++++++++++++++++++++++++++++++++++++ .pre-commit-config.yaml | 4 +-- 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..bdb81a8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every weekday + interval: "daily" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..d224c83 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,60 @@ +name: Tests +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +jobs: + static: + name: Tests + runs-on: ubuntu-latest + timeout-minutes: 10 + concurrency: testing_environment + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Python Setup + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Terraform Setup + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: 1.5.7 + + - name: Tflint Setup + uses: terraform-linters/setup-tflint@v4 + + - name: Terraform Docs Setup + run: | + mkdir terraform-docs && cd terraform-docs + curl -sSLo terraform-docs.tar.gz https://terraform-docs.io/dl/v0.17.0/terraform-docs-v0.17.0-linux-amd64.tar.gz + tar -xzf terraform-docs.tar.gz + chmod +x terraform-docs + echo "$GITHUB_WORKSPACE/terraform-docs" >> $GITHUB_PATH + + - name: Pre-commit Checks + uses: pre-commit/action@v3.0.1 + + - name: Terraform Init + run: terraform init -input=false -no-color + + - name: Terraform Validate + run: terraform validate -no-color + + - name: Webex Notification + if: always() && github.event_name != 'pull_request' + uses: qsnyder/action-wxt@master + env: + TOKEN: ${{ secrets.WEBEX_TOKEN }} + ROOMID: ${{ secrets.WEBEX_ROOM_ID }} + MESSAGE: | + [**[${{ job.status }}] ${{ github.repository }} #${{ github.run_number }}**](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) + * Commit: [${{ github.event.head_commit.message }}](${{ github.event.head_commit.url }})[${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) + * Author: ${{ github.event.sender.login }} + * Branch: ${{ github.ref }} ${{ github.head_ref }} + * Event: ${{ github.event_name }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b9b895b..9a49cb5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,7 +9,7 @@ repos: - id: terraform_tflint - repo: https://github.com/terraform-docs/terraform-docs - rev: v0.16.0 + rev: v0.17.0 hooks: - id: terraform-docs-system args: ["./examples/network_groups"] @@ -17,7 +17,7 @@ repos: args: ["."] - repo: https://github.com/terraform-docs/terraform-docs - rev: v0.16.0 + rev: v0.17.0 hooks: - id: terraform-docs-system args: ["./templates"]