diff --git a/.github/workflows/check-terraform-bootstrap.yml b/.github/workflows/check-terraform-bootstrap.yml new file mode 100644 index 0000000..c63e9eb --- /dev/null +++ b/.github/workflows/check-terraform-bootstrap.yml @@ -0,0 +1,36 @@ +name: Check Terraform bootstrap + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + terraform-checks: + name: Run terraform bootstrap checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: hashicorp/setup-terraform@v2 + - name: Check tf gitlab + run: | + cd terraform/gitlab + terraform init -backend=false -lock=false -reconfigure + terraform fmt -check + terraform validate + - name: Check tf terraform-cloud + run: | + cd terraform/terraform-cloud + terraform init -backend=false -lock=false -reconfigure + terraform fmt -check + terraform validate + - name: Check tf vault + run: | + cd terraform/vault + terraform init -backend=false -lock=false -reconfigure + terraform fmt -check + terraform validate diff --git a/.github/workflows/check-terraform-project.yml b/.github/workflows/check-terraform-project.yml new file mode 100644 index 0000000..2e42c5b --- /dev/null +++ b/.github/workflows/check-terraform-project.yml @@ -0,0 +1,48 @@ +name: Check Terraform project + +on: + push: + branches: [main] + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + terraform-checks: + name: Run terraform project checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: hashicorp/setup-terraform@v2 + - name: Check project tf base digitalocean-k8s + run: | + cd \{\{cookiecutter.project_dirname\}\}/terraform/base/digitalocean-k8s + terraform init -backend=false -lock=false -reconfigure + terraform fmt -check + terraform validate + - name: Check project tf cluster digitalocean-k8s + run: | + cd \{\{cookiecutter.project_dirname\}\}/terraform/cluster/digitalocean-k8s + terraform init -backend=false -lock=false -reconfigure + terraform fmt -check + terraform validate + - name: Check project tf cluster other-k8s + run: | + cd \{\{cookiecutter.project_dirname\}\}/terraform/cluster/digitalocean-k8s + terraform init -backend=false -lock=false -reconfigure + terraform fmt -check + terraform validate + - name: Check project tf environment digitalocean-k8s + run: | + cd \{\{cookiecutter.project_dirname\}\}/terraform/environment/digitalocean-k8s + terraform init -backend=false -lock=false -reconfigure + terraform fmt -check + terraform validate + - name: Check project environment other-k8s + run: | + cd \{\{cookiecutter.project_dirname\}\}/terraform/environment/other-k8s + terraform init -backend=false -lock=false -reconfigure + terraform fmt -check + terraform validate diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9c7c6f6..ab38a56 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,6 +25,11 @@ jobs: - name: Install dependencies run: | python -m pip install -r requirements/test.txt + - name: Run Check + run: | + python3 -m black --check . + python3 -m ruff . + python3 -m mypy . - name: Run Test run: | python3 -m unittest