-
Notifications
You must be signed in to change notification settings - Fork 44
129 lines (122 loc) · 3.45 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: ci
on:
pull_request:
types: [opened, synchronize]
jobs:
unit-tests:
name: Unit Tests
timeout-minutes: 10
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23
- name: Go fmt
run: |
! go fmt ./... | read
- name: Go vet
run: |
! go vet ./... | read
- name: Go Test
run: SKIP_INTEGRATION_TESTS=1 go test -v ./...
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
terraform_version: ["12", "13", "14", "15", "latest"]
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23
id: go
- name: Get dependencies
run: |
go mod tidy
- name: Install tfenv
run: |
git clone https://github.com/tfutils/tfenv.git $GITHUB_WORKSPACE/.tfenv
echo "$GITHUB_WORKSPACE/.tfenv/bin" >> $GITHUB_PATH
- name: Install terraform
working-directory: test/tfenvconf/terraform_${{ matrix.terraform_version }}
run: |
tfenv install
tfenv use
- name: Print Terraform version
run: |
terraform --version
- name: Set Test-Suite
id: test-suite
env:
TF_VERSION: ${{ matrix.terraform_version }}
uses: actions/github-script@v6
with:
script: |
console.log(`Setting test suite version based on ${process.env.TF_VERSION}`)
const suite = process.env.TF_VERSION.replace('.', 'o')
console.log(`Test suite set to ${suite}`)
return suite
result-encoding: string
- name: Test
run: |
go test -v -run ^TestTerraform${{ steps.test-suite.outputs.result }}
terragrunt-integration-tests:
name: Terragrunt Integration Tests
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23
id: go
- name: Get dependencies
run: |
go mod tidy
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.2.5
- name: Print Terraform version
run: |
terraform --version
- name: Install Terragrunt
uses: autero1/action-terragrunt@v1.3.2
with:
terragrunt_version: 0.54.22
- name: Print Terragrunt version
run: |
terragrunt --version
- name: Test
run: |
go test -v -run ^TestTerragruntWithCache$
opentofu-integration-tests:
name: OpenTofu Integration Tests
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23
id: go
- name: Get dependencies
run: |
go mod tidy
- name: Install OpenTofu
uses: opentofu/setup-opentofu@v1
- name: Print OpenTofu version
run: |
tofu --version
- name: Test
run: |
go test -v -run ^TestOpenTofu$