generated from hashicorp/terraform-provider-scaffolding-framework
-
Notifications
You must be signed in to change notification settings - Fork 4
169 lines (160 loc) · 4.9 KB
/
import-script-tests.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
name: Import Script Tests
on:
pull_request:
push:
branches:
- main
# Testing only needs permissions to read the repository contents.
permissions:
contents: read
jobs:
# Ensure project builds before running testing matrix
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- name: Build import script
run: go build -o import_script ./import/import_script.go
test-import-script:
name: Import Script Tests
needs: build
timeout-minutes: 20
strategy:
fail-fast: true
matrix:
terraform:
- latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: go mod download
- name: Run import script tests
env:
IMPORT: "1"
HOSTED_ORGANIZATION_API_TOKEN: ${{ secrets.DEV_HOSTED_ORGANIZATION_API_TOKEN }}
HOSTED_ORGANIZATION_ID: clx42kkcm01fo01o06agtmshg
run: |
cat <<EOF > main.tf
terraform {
required_providers {
astro = {
source = "astronomer/astro"
}
}
}
provider "astro" {
organization_id = "$HOSTED_ORGANIZATION_ID"
host = "https://api.astronomer-dev.io"
token = "$HOSTED_ORGANIZATION_API_TOKEN"
}
EOF
terraform init
make test-import-script
test-import-script-stage:
name: Import Script Tests - Stage
needs: build
timeout-minutes: 20
strategy:
fail-fast: true
matrix:
terraform:
- latest
provider_version:
- main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: go mod download
- name: Run import script tests
env:
IMPORT: "1"
HOSTED_ORGANIZATION_API_TOKEN: ${{ secrets.STAGE_HOSTED_ORGANIZATION_API_TOKEN }}
HOSTED_ORGANIZATION_ID: clx46acvv060e01ilddqlbsmc
run: |
cat <<EOF > main.tf
terraform {
required_providers {
astro = {
source = "astronomer/astro"
}
}
}
provider "astro" {
organization_id = "$HOSTED_ORGANIZATION_ID"
host = "https://api.astronomer-dev.io"
token = "$HOSTED_ORGANIZATION_API_TOKEN"
}
EOF
terraform init
make test-import-script
test-import-script-dev:
name: Import Script Tests - Dev
needs: build
timeout-minutes: 20
strategy:
fail-fast: true
matrix:
terraform:
- latest
provider_version:
- v0.3.1
- v0.2.1
- v0.1.0-alpha
- main
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
cache: true
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
with:
terraform_version: ${{ matrix.terraform }}
terraform_wrapper: false
- run: go mod download
- name: Run import script tests
env:
IMPORT: "1"
HOSTED_ORGANIZATION_API_TOKEN: ${{ secrets.DEV_HOSTED_ORGANIZATION_API_TOKEN }}
HOSTED_ORGANIZATION_ID: clx42kkcm01fo01o06agtmshg
run: |
cat <<EOF > main.tf
terraform {
required_providers {
astro = {
source = "astronomer/astro"
}
}
}
provider "astro" {
organization_id = "$HOSTED_ORGANIZATION_ID"
host = "https://api.astronomer-dev.io"
token = "$HOSTED_ORGANIZATION_API_TOKEN"
}
EOF
terraform init
make test-import-script