-
Notifications
You must be signed in to change notification settings - Fork 0
184 lines (176 loc) · 5.37 KB
/
test.yml
File metadata and controls
184 lines (176 loc) · 5.37 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
name: Tests
on:
pull_request:
paths-ignore:
- "README.md"
- "CHANGELOG.md"
- "LICENSE"
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
version: latest
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: 'go.mod'
cache: true
# We need the latest version of Terraform for our documentation generation to use
- uses: hashicorp/setup-terraform@5e8dbf3c6d9deaf4193ca7a8fb23f2ac83bb6c85 # v4.0.0
with:
terraform_wrapper: false
- run: make generate
- name: git diff
run: |
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference in directories after code generation. Run 'make generate' command and commit."; exit 1)
test_tls:
name: Terraform Provider TLS Tests
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
services:
api:
image: dependencytrack/apiserver:${{ matrix.api }}
env:
TELEMETRY_SUBMISSION_ENABLED_DEFAULT: false
ports:
- 8081:8080
strategy:
fail-fast: false
matrix:
api:
# TLS Connectivity is between TF and Nginx, so is independent of API version.
# Full API testing is handled in subsequent jobs. Therefore, this can be the latest supported API version.
- "4.13.6-alpine"
provider:
- "default"
- "rootCA"
- "mtls"
- "rootCA+mtls"
terraform:
- '1.0.*'
- '1.1.*'
- '1.2.*'
- '1.3.*'
- '1.4.*'
- '1.5.*'
- '1.6.*'
- '1.7.*'
- '1.8.*'
- '1.9.*'
- '1.10.*'
- '1.11.*'
- '1.12.*'
- '1.13.*'
- '1.14.*'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/test
with:
terraform_version: ${{ matrix.terraform }}
provider_config_key: ${{ matrix.provider }}
# Arbitrarily picked test. Uses Project, as that is the primary resource within DT.
tests_run_regex: "^TestAccProjectResource$"
# Run acceptance tests in a matrix with Terraform CLI versions
test:
name: Terraform Provider Acceptance Tests
needs:
- build
- test_tls
runs-on: ubuntu-latest
timeout-minutes: 15
services:
api:
image: dependencytrack/apiserver:${{ matrix.api.version }}
env:
# TODO: Use external (to DT) DB
#ALPINE_DATABASE_MODE: external
#ALPINE_DATABASE_URL: "jdbc:postgresql://db:5432/dtrack"
#ALPINE_DATABASE_DRIVER: "org.postgresql.Driver"
#ALPINE_DATABASE_USERNAME: dtrack
#ALPINE_DATABASE_PASSWORD: dtrack
TELEMETRY_SUBMISSION_ENABLED_DEFAULT: false
ports:
- 8081:8080
# db:
# image: postgres:17-alpine
# env:
# POSTGRES_DB: dtrack
# POSTGRES_USER: dtrack
# POSTGRES_PASSWORD: dtrack
# options: >-
# --health-cmd pg_isready
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# ports:
# - 5432:5432
strategy:
fail-fast: false
matrix:
api:
- version: "4.11.7"
skip: "^(TestAccTagResource)|(TestAccProjectTagsRead)|(TestAccTagPoliciesResource)|(TestAccTagProjectsResource)|(TestAccProjectCollection)|(TestAccProjectIsLatest)|(TestAccProjectDataSourceIsLatest)$"
- version: "4.12.7"
skip: "^(TestAccTagResource)|(TestAccProjectCollection)$"
- version: "4.13.0"
skip: "^$"
- version: "4.13.1"
skip: "^$"
- version: "4.13.2"
skip: "^$"
- version: "4.13.3"
skip: "^$"
- version: "4.13.4"
skip: "^$"
- version: "4.13.5"
skip: "^$"
- version: "4.13.6"
skip: "^$"
- version: "4.13.6-alpine"
skip: "^$"
terraform:
- '1.0.*'
- '1.1.*'
- '1.2.*'
- '1.3.*'
- '1.4.*'
- '1.5.*'
- '1.6.*'
- '1.7.*'
- '1.8.*'
- '1.9.*'
- '1.10.*'
- '1.11.*'
- '1.12.*'
- '1.13.*'
- '1.14.*'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/test
with:
terraform_version: ${{ matrix.terraform }}
tests_skip_regex: ${{ matrix.api.skip }}