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

Spike/gh actions tf checks #243

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
36 changes: 36 additions & 0 deletions .github/workflows/check-terraform-bootstrap.yml
Original file line number Diff line number Diff line change
@@ -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
48 changes: 48 additions & 0 deletions .github/workflows/check-terraform-project.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading