-
Notifications
You must be signed in to change notification settings - Fork 17
325 lines (288 loc) · 17.3 KB
/
aws-weekly.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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# Terraform Action to test Cloud Databases with test-harness
name: AWS Weekly Cloud Database Test Execution
on:
# Triggers the workflow on a schedule for the main branch. Also allows for manual triggers
# Execute every sunday at 4:00 AM
schedule:
- cron: '0 4 * * 0'
workflow_dispatch:
inputs:
testClasses:
type: choice
description: Test Suite or test class to run
options:
- LiquibaseHarnessSuiteTest
- FoundationalHarnessSuiteTest
- AdvancedHarnessSuiteTest
- ChangeObjectTests
- ChangeDataTests
- SnapshotObjectTests
- GenerateChangelogTest
- FoundationalTest
databases:
description: Databases to start up. Comma separated list of "name:version"
required: true
default: "[\"postgresql:12\",\"postgresql:13\",\"postgresql:14\",\"oracle:aws_19\",\"mariadb:aws_10.6\",\"mysql:aws\",\"mysql:aurora\",\"mssql:2019\",\"postgresql:aurora\"]"
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
databases: ${{ github.event.inputs.databases || '["postgresql:12","postgresql:13","postgresql:14","oracle:aws_19","mariadb:aws_10.6","mysql:aws","mysql:aurora","mssql:2019","postgresql:aurora"]' }}
testClasses: ${{ inputs.testClasses || 'LiquibaseHarnessSuiteTest' }}
steps:
- name: Checkout
uses: actions/checkout@v4
deploy-ephemeral-cloud-infra:
uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@main
secrets: inherit
with:
deploy: true
aws_postgresql: ${{ github.event_name == 'schedule' || contains(inputs.databases, 'postgresql:12') || contains(inputs.databases, 'postgresql:13') || contains(inputs.databases, 'postgresql:14')}}
aws_oracle: ${{ github.event_name == 'schedule' || contains(inputs.databases, 'oracle') }}
aws_mariadb: ${{ github.event_name == 'schedule' || contains(inputs.databases, 'mariadb') }}
aws_aurora_mysql: ${{ github.event_name == 'schedule' || contains(inputs.databases, 'mysql:aurora') }}
aws_mssql: ${{ github.event_name == 'schedule' || contains(inputs.databases, 'mssql') }}
aws_aurora_postgres: ${{ github.event_name == 'schedule' || contains(inputs.databases, 'postgresql:aurora') }}
aws_mysql: ${{ github.event_name == 'schedule' || contains(inputs.databases, 'mysql:aws') }}
init-mysql:
runs-on: ubuntu-latest
needs: [deploy-ephemeral-cloud-infra]
permissions:
contents: read
id-token: write
container:
image: liquibase/liquibase:latest
env:
LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
strategy:
fail-fast: false
matrix:
include:
- database: mysql
version: aws
- database: mysql
version: aurora
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_DEV_GITHUB_OIDC_ROLE_ARN_BUILD_LOGIC }}
aws-region: us-east-1
- name: Configure Test
id: setup
uses: actions/[email protected]
with:
script: |
let splitValues = "${{ matrix.database }}".split(":")
core.setOutput("databasePlatform", splitValues[0]);
core.setOutput("databaseVersion", splitValues[1]);
- name: Get AWS secrets
if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- name: Get AWS secrets
if: ${{ matrix.version == 'aurora' && matrix.database == 'mysql'}}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
#This additional init step is required because of mysql driver issue on GH actions
- name: Install Dependencies
run: lpm update && lpm add mysql
- name: Init Database
if: ${{ matrix.version == 'aws' && matrix.database == 'mysql'}}
run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_MYSQLURL_8_0 }}" update
- name: Init Database
if: ${{ matrix.version == 'aurora' && matrix.database == 'mysql'}}
run: liquibase --classpath="src/test/resources/init-changelogs/aws" --changeLogFile="${{ matrix.database }}_cloud.sql" --username="${{ secrets.TH_DB_ADMIN }}" --password="${{ secrets.TH_DB_PASSWD }}" --url="${{ env.TH_AURORA_MYSQLURL }}" update
test:
needs: [deploy-ephemeral-cloud-infra, init-mysql, setup]
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
database: ${{ fromJson(needs.setup.outputs.databases) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure Test
id: setup
uses: actions/[email protected]
with:
script: |
let splitValues = "${{ matrix.database }}".split(":")
core.setOutput("databasePlatform", splitValues[0]);
core.setOutput("databaseVersion", splitValues[1]);
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_DEV_GITHUB_OIDC_ROLE_ARN_BUILD_LOGIC }}
aws-region: us-east-1
- name: Get AWS secrets
if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_MYSQLURL_8_0, /testautomation/db_details/aws_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- name: Get AWS secrets
if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_AURORA_MYSQLURL, /testautomation/db_details/aurora_mysql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- name: Get AWS secrets
if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_ORACLEURL_19, /testautomation/db_details/aws_oracle_19_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- name: Get AWS secrets
if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_PGRESURL_12, /testautomation/db_details/aws_postgresql_12_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
TH_PGRESURL_13, /testautomation/db_details/aws_postgresql_13_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
TH_PGRESURL_14, /testautomation/db_details/aws_postgresql_14_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- name: Get AWS secrets
if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_MARIADBURL_10_6, /testautomation/db_details/aws_mariadb_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- name: Get AWS secrets
if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_MSSQLURL, /testautomation/db_details/aws_mssql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
TH_MSSQLURL_HOST, /testautomation/db_details/aws_mssql_host_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- name: Get AWS secrets
if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }}
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_AURORA_POSTGRESQLURL, /testautomation/db_details/aurora_postgresql_jdbc_${{ needs.deploy-ephemeral-cloud-infra.outputs.resources_id }}
- uses: liquibase/liquibase-github-action@v7
if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }}
with:
operation: "update"
classpath: "src/test/resources/init-changelogs/aws"
changeLogFile: "oracle.sql"
username: "${{secrets.TH_DB_ADMIN}}"
password: "${{secrets.TH_DB_PASSWD}}"
url: "${{ env.TH_ORACLEURL_19 }}"
- uses: liquibase/liquibase-github-action@v7
if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }}
with:
operation: "update"
classpath: "src/test/resources/init-changelogs/aws"
changeLogFile: "postgresql.sql"
username: "${{secrets.TH_DB_ADMIN}}"
password: "${{secrets.TH_DB_PASSWD}}"
url: "${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}"
- uses: liquibase/liquibase-github-action@v7
if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }}
with:
operation: "update"
classpath: "src/test/resources/init-changelogs/aws"
changeLogFile: "mariadb.sql"
username: "${{secrets.TH_DB_ADMIN}}"
password: "${{secrets.TH_DB_PASSWD}}"
url: "${{ env.TH_MARIADBURL_10_6 }}"
- name: Install a SQL Server suite of tools
if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }}
uses: potatoqualitee/[email protected]
with:
install: sqlengine, sqlclient, sqlpackage
- name: Run sqlcmd
if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }}
run: sqlcmd -S ${{ env.TH_MSSQLURL_HOST }} -U ${{secrets.TH_DB_ADMIN}} -P ${{secrets.TH_DB_PASSWD}} -Q "CREATE DATABASE lbcat"
- uses: liquibase/liquibase-github-action@v7
if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }}
with:
operation: "update"
classpath: "src/test/resources/init-changelogs/aws"
changeLogFile: "mssql.sql"
username: "${{secrets.TH_DB_ADMIN}}"
password: "${{secrets.TH_DB_PASSWD}}"
url: "${{ env.TH_MSSQLURL }}"
- uses: liquibase/liquibase-github-action@v7
if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }}
with:
operation: "update"
classpath: "src/test/resources/init-changelogs/aws"
changeLogFile: "postgresql.sql"
username: "${{secrets.TH_DB_ADMIN}}"
password: "${{secrets.TH_DB_PASSWD}}"
url: "${{ env.TH_AURORA_POSTGRESQLURL }}"
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run
if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion != 'aurora' }}
env:
LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -Dprefix=aws -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env[format('TH_PGRESURL_{0}', steps.setup.outputs.databaseVersion)] }}' test
- name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run
if: ${{ steps.setup.outputs.databasePlatform == 'oracle' }}
env:
LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_ORACLEURL_19 }}' test
- name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run
if: ${{ steps.setup.outputs.databasePlatform == 'mariadb' }}
env:
LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MARIADBURL_10_6 }}' test
- name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run
if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aws' }}
env:
LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MYSQLURL_8_0 }}' test
- name: AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run
if: ${{ steps.setup.outputs.databasePlatform == 'mssql' }}
env:
LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_MSSQLURL }}' test
- name: AWS Aurora ${{ steps.setup.outputs.databasePlatform }} Test Run
if: ${{ steps.setup.outputs.databasePlatform == 'mysql' && steps.setup.outputs.databaseVersion == 'aurora' }}
env:
LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_MYSQLURL }}' test
- name: AWS Aurora ${{ steps.setup.outputs.databasePlatform }} Test Run
if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'aurora' }}
env:
LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
run: mvn -Dtest=${{ needs.setup.outputs.testClasses }} -DconfigFile=/harness-config-cloud.yml -DdbName=${{ steps.setup.outputs.databasePlatform }} -DdbVersion=13 -Dprefix=aurora -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ env.TH_AURORA_POSTGRESQLURL }}' test
- name: Archive AWS RDS ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Results
uses: actions/upload-artifact@v4
with:
name: aws-rds-${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }}-test-results
path: build/spock-reports
destroy-ephemeral-cloud-infra:
if: always()
needs: [ deploy-ephemeral-cloud-infra, test ]
uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@main
secrets: inherit
with:
destroy: true
stack_id: ${{ needs.deploy-ephemeral-cloud-infra.outputs.stack_id }}
aws_postgresql: ${{ github.event_name == 'schedule' || contains(inputs.databases, 'postgresql:12') || contains(inputs.databases, 'postgresql:13') || contains(inputs.databases, 'postgresql:14')}}
aws_oracle: ${{ github.event_name == 'schedule' || contains(inputs.databases, 'oracle') }}
aws_mariadb: ${{ github.event_name == 'schedule' || contains(inputs.databases, 'mariadb') }}
aws_aurora_mysql: ${{ github.event_name == 'schedule' || contains(inputs.databases, 'mysql:aurora') }}
aws_mssql: ${{ github.event_name == 'schedule' || contains(inputs.databases, 'mssql') }}
aws_aurora_postgres: ${{ github.event_name == 'schedule' || contains(inputs.databases, 'postgresql:aurora') }}
aws_mysql: ${{ github.event_name == 'schedule' || contains(inputs.databases, 'mysql:aws') }}