-
Notifications
You must be signed in to change notification settings - Fork 45
217 lines (208 loc) · 6.39 KB
/
Copy pathtest.yml
File metadata and controls
217 lines (208 loc) · 6.39 KB
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
name: Tests
on:
pull_request:
paths-ignore:
- "README.md"
push:
branches:
- main
paths-ignore:
- "README.md"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
ACCEPTANCE_GENERAL_SHARDS: "4"
jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26"
id: go
- name: Install Task
uses: arduino/setup-task@v2
with:
version: "3.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Get dependencies
run: go mod download
- name: Build
run: task build
- name: Format
run: task lint
docs:
name: Docs Test
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26"
id: go
- name: Install Task
uses: arduino/setup-task@v2
with:
version: "3.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check if docs are up-to-date
run: |
task docs
git diff
BADDOCS=$(git status --porcelain)
test -z "$BADDOCS" || (echo -e "documentation needs regenerating using task docs: $BADDOCS"; exit 1)
unit:
name: Unit Test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
id: go
- name: Get dependencies
run: go mod download
- name: Go tests without acceptance mode
run: go test ./... -skip '^TestAcc_'
acceptance-plan:
name: Acceptance Plan
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
matrix: ${{ steps.plan.outputs.matrix }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
id: go
- name: Get dependencies
run: go mod download
- name: Generate shard matrix
id: plan
run: |
matrix=$(go run ./tools/ci-acceptance-shards -general-shards "${ACCEPTANCE_GENERAL_SHARDS}" -format matrix)
printf 'matrix=%s\n' "$matrix" >> "$GITHUB_OUTPUT"
- name: Show shard plan
run: go run ./tools/ci-acceptance-shards -general-shards "${ACCEPTANCE_GENERAL_SHARDS}" -format summary
acceptance:
name: Acceptance (${{ matrix.name }})
needs: [build, acceptance-plan]
timeout-minutes: 45
strategy:
max-parallel: 3
fail-fast: false
matrix: ${{ fromJson(needs.acceptance-plan.outputs.matrix) }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26"
id: go
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.14.*"
terraform_wrapper: false
- name: Get dependencies
run: go mod download
- name: TF acceptance shard
timeout-minutes: 45
env:
TF_ACC: "true"
TEST_PACKAGE: ${{ matrix.package }}
TEST_PATTERN: ${{ matrix.pattern }}
VERCEL_API_TOKEN: ${{ secrets.VERCEL_API_TOKEN }}
VERCEL_TERRAFORM_TESTING_TEAM: "team_GwBFaTRF7juuJfO2jZzzKRgc"
VERCEL_TERRAFORM_TESTING_GITHUB_REPO: "dglsparsons/test"
VERCEL_TERRAFORM_TESTING_GITLAB_REPO: "dglsparsons/test"
VERCEL_TERRAFORM_TESTING_BITBUCKET_REPO: "dglsparsons-test/test"
VERCEL_TERRAFORM_TESTING_DOMAIN: "vercel-terraform.com"
VERCEL_TERRAFORM_TESTING_ADDITIONAL_USER_EMAIL: ${{ secrets.VERCEL_TERRAFORM_TESTING_ADDITIONAL_USER_EMAIL }}
VERCEL_TERRAFORM_TESTING_EXISTING_INTEGRATION: ${{ secrets.VERCEL_TERRAFORM_TESTING_EXISTING_INTEGRATION }}
run: |
go test -count=1 -timeout 30m "${TEST_PACKAGE}" -run "${TEST_PATTERN}"
acceptance-compat:
name: Acceptance Compat (${{ matrix.name }})
if: ${{ github.event_name == 'push' }}
needs: [build]
timeout-minutes: 45
strategy:
max-parallel: 1
fail-fast: false
matrix:
include:
- name: ubuntu-tf-1.4
os: ubuntu-latest
terraform: "1.4.*"
- name: windows-tf-1.14
os: windows-latest
terraform: "1.14.*"
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
id: go
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- name: Get dependencies
run: go mod download
- name: Full TF acceptance suite
timeout-minutes: 45
env:
TF_ACC: "true"
VERCEL_API_TOKEN: ${{ secrets.VERCEL_API_TOKEN }}
VERCEL_TERRAFORM_TESTING_TEAM: "team_GwBFaTRF7juuJfO2jZzzKRgc"
VERCEL_TERRAFORM_TESTING_GITHUB_REPO: "dglsparsons/test"
VERCEL_TERRAFORM_TESTING_GITLAB_REPO: "dglsparsons/test"
VERCEL_TERRAFORM_TESTING_BITBUCKET_REPO: "dglsparsons-test/test"
VERCEL_TERRAFORM_TESTING_DOMAIN: "vercel-terraform.com"
VERCEL_TERRAFORM_TESTING_ADDITIONAL_USER_EMAIL: ${{ secrets.VERCEL_TERRAFORM_TESTING_ADDITIONAL_USER_EMAIL }}
VERCEL_TERRAFORM_TESTING_EXISTING_INTEGRATION: ${{ secrets.VERCEL_TERRAFORM_TESTING_EXISTING_INTEGRATION }}
run: |
go test -count=1 -timeout 30m ./...
summary:
name: Summary
runs-on: ubuntu-latest
needs:
- acceptance
- acceptance-compat
- acceptance-plan
- docs
- build
- unit
timeout-minutes: 5
if: ${{ always() }}
steps:
- name: Success
run: |-
for status in ${{ join(needs.*.result, ' ') }}
do
if [ "$status" != "success" ] && [ "$status" != "skipped" ]
then
echo "Some checks failed"
exit 1
fi
done