-
Notifications
You must be signed in to change notification settings - Fork 123
341 lines (314 loc) · 11.5 KB
/
acceptance.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
#############################
# NOTE: The below providers that are commented out have account token issues
# related to neglect and aremost likely expired or somesort of billing issue.
# There is a backlog item to fix these accounts and re-enable these tests.
#############################
name: Acceptance
on:
push:
permissions:
contents: read
env:
TEST_RESULTS: /tmp/test-results
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version-file: go.mod
- run: go mod download
- name: Check go mod tidy
run: |-
go mod tidy
git diff --exit-code
- name: Check Formatting
run: |-
files=$(go fmt ./...)
if [ -n "$files" ]; then
echo "The following file(s) do not conform to go fmt:"
echo "$files"
exit 1
fi
go-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version:
- '1.22' # oldest supported; named in go.mod
- 'oldstable'
- 'stable'
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: ${{ matrix.go-version }}
- uses: autero1/action-gotestsum@7263b9d73912eec65f46337689e59fac865c425f # v2.0.0
with:
gotestsum_version: 1.9.0
- name: Run go tests
run: |-
mkdir -p "$TEST_RESULTS"
gotestsum -f standard-verbose --junitfile "${TEST_RESULTS}/results.xml" .
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
path: ${{ env.TEST_RESULTS }}
name: tests-linux
alicloud-provider:
# don't run on fork PRs
if: github.repository_owner == 'hashicorp'
runs-on: ubuntu-latest
needs:
- go-test
env:
ALICLOUD_ACCESS_KEY: ${{ secrets.ALICLOUD_ACCESS_KEY }}
ALICLOUD_SECRET_KEY: ${{ secrets.ALICLOUD_SECRET_KEY }}
# XXX
# ALICLOUD_REGION: xxx
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: 'stable'
- uses: autero1/action-gotestsum@7263b9d73912eec65f46337689e59fac865c425f # v2.0.0
with:
gotestsum_version: 1.9.0
- uses: './.github/actions/acctest'
with:
provider-test-infra-dir: aliyun
provider-go-test-dir: aliyun
# aws-provider:
# # don't run on fork PRs
# if: github.repository_owner == 'hashicorp'
# runs-on: ubuntu-latest
# needs:
# - go-test
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_REGION: ${{ vars.AWS_REGION }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# steps:
# - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
# - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
# with:
# go-version: 'stable'
# - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0
# with:
# gotestsum_version: 1.9.0
# - uses: "./.github/actions/acctest"
# with:
# provider-test-infra-dir: aws
# provider-go-test-dir: aws
# aws-region: ${{ vars.AWS_REGION }}
# aws-role-arn: ${{ secrets.SERVICE_GO_DISCOVER_TESTS_ROLE_ARN }}
azure-vmss-provider:
# don't run on fork PRs
if: github.repository_owner == 'hashicorp'
runs-on: ubuntu-latest
needs:
- go-test
env:
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_ENVIRONMENT: ${{ vars.ARM_ENVIRONMENT }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: 'stable'
- uses: autero1/action-gotestsum@7263b9d73912eec65f46337689e59fac865c425f # v2.0.0
with:
gotestsum_version: 1.9.0
- uses: "./.github/actions/acctest"
with:
provider-test-infra-dir: azure-vmss
provider-go-test-dir: azure
provider-go-test-tags: TestVmScaleSetAddrs
azurerm-provider:
# don't run on fork PRs
if: github.repository_owner == 'hashicorp'
runs-on: ubuntu-latest
needs:
- go-test
env:
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_ENVIRONMENT: ${{ vars.ARM_ENVIRONMENT }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: 'stable'
- uses: autero1/action-gotestsum@7263b9d73912eec65f46337689e59fac865c425f # v2.0.0
with:
gotestsum_version: 1.9.0
- uses: "./.github/actions/acctest"
with:
provider-test-infra-dir: azurerm
provider-go-test-dir: azure
provider-go-test-tags: TestTagAddrs
# digitalocean-provider:
# # don't run on fork PRs
# if: github.repository_owner == 'hashicorp'
# runs-on: ubuntu-latest
# needs:
# - go-test
# env:
# DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
# steps:
# - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
# - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
# with:
# go-version: 'stable'
# - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0
# with:
# gotestsum_version: 1.9.0
# - uses: "./.github/actions/acctest"
# with:
# provider-test-infra-dir: digitalocean
# provider-go-test-dir: digitalocean
# gce-provider:
# # don't run on fork PRs
# if: github.repository_owner == 'hashicorp'
# runs-on: ubuntu-latest
# needs:
# - go-test
# env:
# GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
# GOOGLE_PROJECT: ${{ secrets.GOOGLE_PROJECT }}
# GOOGLE_ZONE: ${{ vars.GOOGLE_ZONE }}
# steps:
# - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
# - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
# with:
# go-version: 'stable'
# - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0
# with:
# gotestsum_version: 1.9.0
# - uses: "./.github/actions/acctest"
# with:
# provider-test-infra-dir: gce
# provider-go-test-dir: gce
# k8s-provider:
# # don't run on fork PRs
# if: github.repository_owner == 'hashicorp'
# runs-on: ubuntu-latest
# needs:
# - go-test
# steps:
# - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
# - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
# with:
# go-version: 'stable'
# - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0
# with:
# gotestsum_version: 1.9.0
# - uses: "./.github/actions/acctest"
# with:
# provider-test-infra-dir: k8s
# provider-go-test-dir: k8s
# provider-tf-apply: terraform apply -target google_container_cluster.cluster -auto-approve && terraform apply -auto-approve
# packet-provider:
# # don't run on fork PRs
# if: github.repository_owner == 'hashicorp'
# runs-on: ubuntu-latest
# needs:
# - go-test
# env:
# TF_VAR_packet_project: ${{ secrets.PACKET_PROJECT }}
# PACKET_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }}
# PACKET_PROJECT: ${{ secrets.PACKET_PROJECT }}
# steps:
# - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
# - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
# with:
# go-version: 'stable'
# - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0
# with:
# gotestsum_version: 1.9.0
# - uses: "./.github/actions/acctest"
# with:
# provider-test-infra-dir: packet
# provider-go-test-dir: packet
# scaleway-provider:
# # don't run on fork PRs
# if: github.repository_owner == 'hashicorp'
# runs-on: ubuntu-latest
# needs:
# - go-test
# steps:
# - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
# - uses: "./.github/actions/acctest"
# with:
# provider-test-infra-dir: scaleway
# provider-go-test-dir: scaleway
# triton-provider:
# # don't run on fork PRs
# if: github.repository_owner == 'hashicorp'
# runs-on: ubuntu-latest
# needs:
# - go-test
# env:
# TRITON_URL: ${{ vars.TRITON_URL }}
# TRITON_ACCOUNT: ${{ secrets.TRITON_ACCOUNT }}
# TRITON_KEY_ID: ${{ secrets.TRITON_KEY_ID }}
# steps:
# - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
# - uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
# with:
# go-version: 'stable'
# - uses: autero1/action-gotestsum@2e48af62f5248bd3b014f598cd1aa69a01dd36e3 # v1.0.0
# with:
# gotestsum_version: 1.9.0
# # Ensure parameter if_key_exists is set correctly
# #- name: Install SSH key
# # uses: shimataro/ssh-key-action@685d0f20da72e4b53cc81d373a2ed0a867770e46 # v2.5.1
# # with:
# # key: "${{ secrets.CIRCLE_CI_SSH_KEY }}"
# # name: circle_ci_id_rsa
# # known_hosts: "${{ secrets.CIRCLE_CI_KNOWN_HOSTS }}"
# # if_key_exists: fail
# - uses: "./.github/actions/acctest"
# with:
# provider-test-infra-dir: triton
# provider-go-test-dir: triton
# This is job is required for branch protection as a required gihub check
# because GitHub actions show up as checks at the job level and not the
# workflow level. This is currently a feature request:
# https://github.com/orgs/community/discussions/12395
#
# This job must:
# - be placed after the fanout of a workflow so that everything fans back in
# to this job.
# - "need" any job that is part of the fan out / fan in
# - implement the if logic because we have conditional jobs
# (go-test-enteprise) that this job needs and this would potentially get
# skipped if a previous job got skipped. So we use the if clause to make
# sure it does not get skipped.
acceptance-success:
needs:
- lint
- go-test
- alicloud-provider
# - aws-provider
- azure-vmss-provider
- azurerm-provider
# - digitalocean-provider
# - gce-provider
# - k8s-provider
# - packet-provider
# - scaleway-provider
# - triton-provider
runs-on: ubuntu-latest
if: |
(always() && ! cancelled()) &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
steps:
- run: echo "go-tests succeeded"