-
Notifications
You must be signed in to change notification settings - Fork 8
73 lines (61 loc) · 1.97 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: CI Workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint_terraform:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.8"
- name: Rewrites all Terraform configuration files to a canonical format
run: terraform fmt -diff -check -recursive
generate_docs:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate documentation from Terraform modules
run: |
brew install terraform-docs
terraform-docs --version
./scripts/generate_docs.sh
check_docs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check if the documents have been updated
run: |
git diff
git status --porcelain --untracked-files=all
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then echo "Error changes detected ${CHANGES}"; exit 1; fi
run_sanity_checks:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.8"
- name: Google Cloud auth
uses: google-github-actions/auth@v2
with:
credentials_json: '${{ secrets.BASE64_GOOGLE_APPLICATION_CREDENTIALS }}'
- name: Test the Terraform code inside the ./tests folder to make sure the modules/recipes are working
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
GOOGLE_PROJECT: ${{ secrets.GOOGLE_PROJECT_ID }}
run: |
./scripts/run_sanity_checks.sh tests