Repository navigation
135 lines (132 loc) · 3.71 KB
/
Copy pathtest.yaml
File metadata and controls
135 lines (132 loc) · 3.71 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
on:
pull_request:
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- 'LICENSE'
push:
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- 'LICENSE'
name: Test
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # needed for `only-new-issues` to compare diffs
- name: install go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: go1.20-${{ hashFiles('**/go.sum') }}
- name: Vet
run: go vet ./...
- name: setup Terraform
uses: hashicorp/setup-terraform@v3
- name: write Terraform configuration
run: |
cat > main.tf <<EOF
terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 4"
}
}
}
EOF
- name: terraform init
run: terraform init
- name: go test
env:
CLOUDFLARE_EMAIL: noone@cloudflare.com
CLOUDFLARE_API_KEY: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
CLOUDFLARE_TERRAFORM_INSTALL_PATH: ${{ github.workspace }}
run: TESTARGS="-run=V4" make test
test-v5-generate:
name: Go + Terraform v5 (Generate)
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: install go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: go1.20-${{ hashFiles('**/go.sum') }}
- name: Vet
run: go vet ./...
- name: setup Terraform
uses: hashicorp/setup-terraform@v3
- name: write Terraform configuration for v5
run: |
cat > main.tf <<EOF
terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 5"
}
}
}
EOF
- name: terraform init
run: terraform init
- name: go test generate
env:
CLOUDFLARE_EMAIL: noone@cloudflare.com
CLOUDFLARE_API_KEY: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
CLOUDFLARE_TERRAFORM_INSTALL_PATH: ${{ github.workspace }}
run: TESTARGS="-run=^TestResourceGenerationV5" make test
test-v5-import:
name: Go + Terraform v5 (Import)
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: install go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: go1.20-${{ hashFiles('**/go.sum') }}
- name: Vet
run: go vet ./...
- name: setup Terraform
uses: hashicorp/setup-terraform@v3
- name: write Terraform configuration for v5
run: |
cat > main.tf <<EOF
terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 5"
}
}
}
EOF
- name: terraform init
run: terraform init
- name: go test import
env:
CLOUDFLARE_EMAIL: noone@cloudflare.com
CLOUDFLARE_API_KEY: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
CLOUDFLARE_TERRAFORM_INSTALL_PATH: ${{ github.workspace }}
run: TESTARGS="-run=^TestResourceImportV5" make test