generated from actions/typescript-action
-
-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (59 loc) · 1.77 KB
/
test.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
65
66
67
68
69
70
name: test
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
collectInputs:
name: Collect workflow inputs
runs-on: ubuntu-latest
outputs:
directories: ${{ steps.dirs.outputs.directories }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get root directories
id: dirs
uses: clowdhaus/terraform-composite-actions/directories@v1.11.1
preCommit:
name: Pre-commit
needs: collectInputs
runs-on: ubuntu-latest
strategy:
matrix:
directory: ${{ fromJson(needs.collectInputs.outputs.directories) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Terraform min/max versions
id: minMax
uses: ./
with:
directory: ${{ matrix.directory }}
# Min version
- name: Remove default Terraform
run: rm -rf $(which terraform)
- name: Install Terraform ${{ steps.minMax.outputs.minVersion }}
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ steps.minMax.outputs.minVersion }}
- name: Terraform validate ${{ steps.minMax.outputs.minVersion }}
working-directory: ${{ matrix.directory }}
run: |
terraform init
terraform validate
# Max version
- name: Remove min Terraform
run: rm -rf $(which terraform)
- name: Install Terraform ${{ steps.minMax.outputs.maxVersion }}
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ steps.minMax.outputs.maxVersion }}
- name: Terraform validate ${{ steps.minMax.outputs.maxVersion }}
working-directory: ${{ matrix.directory }}
run: |
terraform init
terraform validate