-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (118 loc) · 3.7 KB
/
test.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
# Terraform Provider testing workflow.
name: Tests
# This GitHub action runs your tests for each pull request and push.
# Optionally, you can turn it on using a schedule for regular testing.
on:
pull_request:
paths-ignore:
- "README.md"
push:
branches:
- main
paths-ignore:
- "README.md"
# 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@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@v6
with:
version: latest
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
- uses: hashicorp/[email protected]
with:
terraform_version: "1.9.5"
terraform_wrapper: false
- run: go generate ./...
- name: git diff
run: |
git diff --compact-summary
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1)
# Run acceptance tests in a matrix with Terraform CLI versions
test:
name: Terraform Provider Acceptance Tests
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
# list whatever Terraform versions here you would like to support
terraform:
- version: "1.0.*"
name: "TF-1.0"
- version: "1.9.*"
name: "TF-1.9"
console:
- "1.26.0"
- "1.27.0"
- "1.28.0"
- "1.29.0"
gateway:
- "3.4.0"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
cache: true
- uses: hashicorp/[email protected]
with:
terraform_version: ${{ matrix.terraform.version }}
terraform_wrapper: false
- run: go mod download
- run: make pull_test_assets
timeout-minutes: 10
- name: Set License if not dependabot
run: |
if [ "${{ github.actor }}" != "dependabot[bot]" ]; then
echo "CDK_LICENSE=${{ secrets.TEST_LICENSE }}" >> "$GITHUB_ENV"
fi
- name: Run acceptance tests
env:
TF_ACC: "1"
TESTARGS: "-cover ./internal/provider/"
CONDUKTOR_CONSOLE_IMAGE: conduktor/conduktor-console:${{ matrix.console }}
CONDUKTOR_CONSOLE_CORTEX_IMAGE: conduktor/conduktor-console-cortex:${{ matrix.console }}
CONDUKTOR_GATEWAY_IMAGE: conduktor/conduktor-gateway:${{ matrix.gateway }}
CDK_BASE_URL: http://localhost:8080
CDK_ADMIN_EMAIL: [email protected]
CDK_ADMIN_PASSWORD: testP4ss!
CDK_GATEWAY_BASE_URL: http://localhost:8888
CDK_GATEWAY_USER: admin
CDK_GATEWAY_PASSWORD: conduktor
TF_LOG_PROVIDER_CONDUKTOR: DEBUG
timeout-minutes: 15
run: |
# empty env to avoid any conflict with the current env
echo "" > .env
make testacc
- uses: actions/upload-artifact@v4
if: always()
with:
name: api-logs-CDK-${{ matrix.console }}-${{ matrix.terraform.name }}
path: ./logs/
if-no-files-found: error
retention-days: 1