-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (53 loc) · 1.75 KB
/
ci.yml
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
---
name: CI/CD
on:
push:
branches:
- main
- develop
pull_request:
jobs:
pre-commit:
name: Verify the pre-commit framework was used properly by developers
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
# Semantic version range syntax (like 3.x) or the exact Python version
python-version: '3.11.0'
- name: Run pre-commit framework as the developer should run it
run: sudo ./scripts/install.sh && sudo ./scripts/run.sh
- name: The `git diff` showing whether the pre-commit mandated extra changes to the repository files
if: failure()
run: git diff
validate:
name: Validate
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 0.15.3
- name: terraform validate
env:
AWS_DEFAULT_REGION: us-west-2
run: |
cd "$GITHUB_WORKSPACE"
for dir in $(find modules examples -type d -not \( -name ".?*" \) -maxdepth 1 -mindepth 1);
do
if [[ "$dir" == "modules/transit_gateway_peering" ]];
then
echo "Skipping directory: $dir"
echo "Terraform does not support validating a module which uses an aliased provider (module-specific; validating an entire configuration works fine)."
continue
fi
echo "Processing directory: $dir"
cd "$GITHUB_WORKSPACE/$dir"
terraform init -backend=false
terraform validate
done