Skip to content

Commit c243759

Browse files
committed
chore: splitting up main branch and pr branch style tests into different workflows
1 parent 6b37aa5 commit c243759

File tree

2 files changed

+192
-5
lines changed

2 files changed

+192
-5
lines changed
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
name: Terraform Provider Checks - main branch
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- develop
8+
env:
9+
TERRAFORM_VERSION: "1.2.6"
10+
REDISCLOUD_ACCESS_KEY: ${{ secrets.REDISCLOUD_ACCESS_KEY_STAGING }}
11+
REDISCLOUD_SECRET_KEY: ${{ secrets.REDISCLOUD_SECRET_KEY_STAGING }}
12+
REDISCLOUD_URL: ${{ secrets.REDISCLOUD_URL_STAGING }}
13+
AWS_TEST_CLOUD_ACCOUNT_NAME: "${{ secrets.AWS_TEST_CLOUD_ACCOUNT_NAME_STAGING }}"
14+
AWS_PEERING_REGION: ${{ secrets.AWS_PEERING_REGION }}
15+
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
16+
AWS_VPC_CIDR: ${{ secrets.AWS_VPC_CIDR }}
17+
AWS_VPC_ID: ${{ secrets.AWS_VPC_ID }}
18+
AWS_TEST_TGW_ID: ${{ secrets.AWS_TEST_TGW_ID_STAGING }}
19+
TF_ACC: true
20+
TF_LOG: info
21+
AWS_ACCESS_KEY_ID: ${{ secrets.CLOUD_ACCOUNT_KEY }}
22+
AWS_ACCESS_SECRET_KEY: ${{ secrets.CLOUD_ACCOUNT_SECRET }}
23+
AWS_CONSOLE_USERNAME: ${{ secrets.CLOUD_ACCOUNT_USERNAME }}
24+
AWS_CONSOLE_PASSWORD: ${{ secrets.CLOUD_ACCOUNT_PASS }}
25+
AWS_SIGNIN_URL: ${{ secrets.CLOUD_ACCOUNT_URL }}
26+
GCP_VPC_PROJECT: ${{ secrets.GCP_VPC_PROJECT }}
27+
GCP_VPC_ID: ${{ secrets.GCP_VPC_ID }}
28+
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
29+
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
30+
31+
concurrency:
32+
group: <span class="math-inline">\{\{ github\.workflow \}\}\-</span>{{ github.ref }}
33+
cancel-in-progress: true
34+
35+
jobs:
36+
go_build:
37+
name: go build
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
42+
continue-on-error: true
43+
id: cache-terraform-plugin-dir
44+
timeout-minutes: 2
45+
with:
46+
path: terraform-plugin-dir
47+
key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }}
48+
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
49+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
50+
with:
51+
go-version-file: go.mod
52+
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
53+
name: go mod download
54+
run: go mod download
55+
- if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure'
56+
name: go build
57+
run: go build -o terraform-plugin-dir/registry.terraform.io/RedisLabs/rediscloud/99.99.99/$(go env GOOS)_$(go env GOARCH)/terraform-provider-rediscloud .
58+
59+
terraform_providers_schema:
60+
name: terraform providers schema
61+
needs: [go_build]
62+
runs-on: ubuntu-latest
63+
steps:
64+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
65+
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
66+
continue-on-error: true
67+
id: cache-terraform-providers-schema
68+
timeout-minutes: 2
69+
with:
70+
path: terraform-providers-schema
71+
key: ${{ runner.os }}-terraform-providers-schema-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }}
72+
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
73+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
74+
timeout-minutes: 2
75+
with:
76+
path: terraform-plugin-dir
77+
key: ${{ runner.os }}-terraform-plugin-dir-${{ hashFiles('go.sum') }}-${{ hashFiles('provider/**') }}
78+
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
79+
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
80+
with:
81+
terraform_version: ${{ env.TERRAFORM_VERSION }}
82+
terraform_wrapper: false
83+
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
84+
name: terraform init
85+
run: |
86+
# We need a file to initialize the provider
87+
cat <<EOT >> providers.tf
88+
terraform {
89+
required_providers {
90+
rediscloud = {
91+
source = "RedisLabs/rediscloud"
92+
version = "99.99.99"
93+
}
94+
}
95+
}
96+
EOT
97+
echo 'resource "rediscloud_subscription" "example" {}' > example.tf
98+
terraform init -plugin-dir terraform-plugin-dir
99+
- if: steps.cache-terraform-providers-schema.outputs.cache-hit != 'true' || steps.cache-terraform-providers-schema.outcome == 'failure'
100+
name: terraform providers schema
101+
run: |
102+
mkdir terraform-providers-schema
103+
terraform providers schema -json > terraform-providers-schema/schema.json
104+
105+
go_test_databases:
106+
name: go test Databases
107+
needs: [go_build]
108+
runs-on: ubuntu-latest
109+
steps:
110+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
111+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
112+
with:
113+
go-version-file: go.mod
114+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloud(Essentials|Pro|ActiveActive)Database_.*"'
115+
116+
go_test_subscriptions:
117+
name: go test Subscriptions
118+
needs: [go_test_databases]
119+
runs-on: ubuntu-latest
120+
steps:
121+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
122+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
123+
with:
124+
go-version-file: go.mod
125+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloud(Essentials|Pro|ActiveActive)Subscription_.*"'
126+
127+
go_test_subscriptions_tls:
128+
name: go test Subscriptions TLS
129+
needs: [go_test_subscriptions]
130+
runs-on: ubuntu-latest
131+
steps:
132+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
133+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
134+
with:
135+
go-version-file: go.mod
136+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloudSubscriptionTls_.*"'
137+
138+
go_test_essentials_plan:
139+
name: go test Essentials Plan
140+
needs: [go_test_subscriptions_tls]
141+
runs-on: ubuntu-latest
142+
steps:
143+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
144+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
145+
with:
146+
go-version-file: go.mod
147+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloudEssentialsPlan_.*"'
148+
149+
go_test_persistence_modules_regions_acl:
150+
name: go test Other
151+
needs: [go_test_essentials_plan]
152+
runs-on: ubuntu-latest
153+
steps:
154+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
155+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
156+
with:
157+
go-version-file: go.mod
158+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloud(DataPersistence|DatabaseModules|Regions|Acl).*"'
159+
160+
go_test_cloud_account:
161+
name: go test Cloud Account
162+
needs: [go_test_persistence_modules_regions_acl]
163+
runs-on: ubuntu-latest
164+
steps:
165+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
166+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
167+
with:
168+
go-version-file: go.mod
169+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-test.short -run="TestAcc(DataSource|Resource)RedisCloud(CloudAccount).*"'
170+
171+
go_test_transit_payment:
172+
name: go test Transit Gateway & Payment
173+
needs: [go_test_cloud_account]
174+
runs-on: ubuntu-latest
175+
steps:
176+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
177+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
178+
with:
179+
go-version-file: go.mod
180+
- run: EXECUTE_TESTS=true make testacc TESTARGS='-run="TestAcc(DataSource|Resource)RedisCloud(TransitGatewayAttachment|PaymentMethod).*"'
181+
182+
tfproviderlint:
183+
name: tfproviderlint
184+
needs: [go_build]
185+
runs-on: ubuntu-latest
186+
steps:
187+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
188+
- uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
189+
with:
190+
go-version-file: go.mod
191+
- run: make tfproviderlint

.github/workflows/terraform_provider.yml renamed to .github/workflows/terraform_provider_smaller_branch.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
name: Terraform Provider Checks
1+
name: Terraform Provider Checks - non-main branches
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
- develop
84
pull_request:
95
branches:
106
- main

0 commit comments

Comments
 (0)