Skip to content

Azure Cloud Sql DB Test #960

Azure Cloud Sql DB Test

Azure Cloud Sql DB Test #960

Workflow file for this run

name: Azure Cloud Sql DB Test
concurrency: azure-run
on:
# Triggers the workflow on a schedule for the main branch. Also allows for manual triggers
schedule:
- cron: '30 8 * * *'
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: "[\"mysql:azure\", \"mssql:azure\", \"mssql:mi\", \"postgresql:azure\", \"postgresql:flexible\"]"
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
databases: ${{ github.event.inputs.databases || '["mysql:azure","mssql:azure","mssql:mi","postgresql:azure"]' }}
testClasses: ${{ inputs.testClasses || 'LiquibaseHarnessSuiteTest' }}
steps:
- name: Checkout
uses: actions/checkout@v4
init-mysql:
runs-on: ubuntu-latest
container:
image: liquibase/liquibase:latest
env:
LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
strategy:
fail-fast: false
matrix:
include:
- database: mysql
version: azure
steps:
- name: Checkout
uses: actions/checkout@v4
# This additional init step is required because of mysql driver issue on GH actions
- name: Install Dependencies
run: lpm update && lpm add mysql
- name: Clean Azure MySQL Database
uses: liquibase-github-actions/drop-all@v4.29.2
if: ${{ matrix.database == 'mysql' }}
with:
url: "${{secrets.TH_AZURE_MYSQL_URL}}"
username: "${{ format('{0}@{1}', secrets.TH_DB_ADMIN, secrets.TH_AZURE_MYSQL_FQDN) }}"
password: "${{secrets.TH_DB_PASSWD}}"
licenseKey: "${{secrets.LICENSE_KEY}}"
force: true
requireForce: true
- name: Init Azure MySQL Database
uses: liquibase/liquibase-github-action@v7
if: ${{ matrix.database == 'mysql' }}
with:
operation: "update"
classpath: "src/test/resources/init-changelogs/azure"
changeLogFile: "mysql.sql"
username: "${{ format('{0}@{1}', secrets.TH_DB_ADMIN, secrets.TH_AZURE_MYSQL_FQDN) }}"
password: "${{secrets.TH_DB_PASSWD}}"
url: "${{secrets.TH_AZURE_MYSQL_URL}}"
test:
needs: [init-mysql, setup]
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/github-script@v7.0.1
with:
script: |
let splitValues = "${{ matrix.database }}".split(":")
core.setOutput("databasePlatform", splitValues[0]);
core.setOutput("databaseVersion", splitValues[1]);
- name: Azure MSSQL dropAll
uses: liquibase-github-actions/drop-all@v4.29.2
if: ${{ steps.setup.outputs.databasePlatform == 'mssql' && steps.setup.outputs.databaseVersion == 'azure' }}
with:
url: "${{secrets.TH_AZURE_URL}}"
username: "${{secrets.TH_DB_ADMIN}}"
password: "${{secrets.TH_DB_PASSWD}}"
licenseKey: "${{secrets.LICENSE_KEY}}"
force: true
requireForce: true
- name: Azure MSSQL init changelogs update
uses: liquibase/liquibase-github-action@v7
if: ${{ steps.setup.outputs.databasePlatform == 'mssql' && steps.setup.outputs.databaseVersion == 'azure' }}
with:
operation: "update"
classpath: "src/test/resources/init-changelogs/azure"
changeLogFile: "sqlserver.sql"
username: "${{secrets.TH_DB_ADMIN}}"
password: "${{secrets.TH_DB_PASSWD}}"
url: "${{secrets.TH_AZURE_URL}}"
- name: Azure MSSQL MI dropAll
uses: liquibase-github-actions/drop-all@v4.29.2
if: ${{ steps.setup.outputs.databasePlatform == 'mssql' && steps.setup.outputs.databaseVersion == 'mi' }}
with:
url: "${{secrets.TH_AZURE_MSSQL_MI_URL}}"
username: "${{secrets.TH_DB_ADMIN}}"
password: "${{secrets.TH_DB_PASSWD}}"
licenseKey: "${{secrets.LICENSE_KEY}}"
force: true
requireForce: true
- name: Azure MSSQL MI init changelogs update
uses: liquibase/liquibase-github-action@v7
if: ${{ steps.setup.outputs.databasePlatform == 'mssql' && steps.setup.outputs.databaseVersion == 'mi' }}
with:
operation: "update"
classpath: "src/test/resources/init-changelogs/azure"
changeLogFile: "sqlserver.sql"
username: "${{secrets.TH_DB_ADMIN}}"
password: "${{secrets.TH_DB_PASSWD}}"
url: "${{secrets.TH_AZURE_MSSQL_MI_URL}}"
- name: Azure PostgreSQL Single Server dropAll
uses: liquibase-github-actions/drop-all@v4.29.2
if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'azure' }}
with:
url: "${{secrets.TH_AZURE_POSTGRESQL_URL}}"
username: "${{ format('{0}@{1}', secrets.TH_DB_ADMIN, secrets.TH_AZURE_POSTGRESQL_FQDN) }}"
password: "${{secrets.TH_DB_PASSWD}}"
licenseKey: "${{secrets.LICENSE_KEY}}"
force: true
requireForce: true
- name: Azure PostgreSQL Single Server init changelogs update
uses: liquibase/liquibase-github-action@v7
if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'azure' }}
with:
operation: "update"
classpath: "src/test/resources/init-changelogs/azure"
changeLogFile: "postgresql.sql"
username: "${{ format('{0}@{1}', secrets.TH_DB_ADMIN, secrets.TH_AZURE_POSTGRESQL_FQDN) }}"
password: "${{secrets.TH_DB_PASSWD}}"
url: "${{secrets.TH_AZURE_POSTGRESQL_URL}}"
- name: Azure ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run
if: ${{ steps.setup.outputs.databasePlatform == 'mysql' }}
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 }} -Dprefix=azure -DdbVersion=${{ steps.setup.outputs.databaseVersion }} -DdbUsername=${{ format('{0}@{1}', secrets.TH_DB_ADMIN, secrets.TH_AZURE_MYSQL_FQDN) }} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{secrets.TH_AZURE_MYSQL_URL}}' test
- name: Azure ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run
if: ${{ steps.setup.outputs.databasePlatform == 'mssql' && steps.setup.outputs.databaseVersion == 'azure' }}
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 }} -Dprefix=azure -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{secrets.TH_AZURE_URL}}' test
- name: Azure ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run
if: ${{ steps.setup.outputs.databasePlatform == 'mssql' && steps.setup.outputs.databaseVersion == 'mi' }}
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 }} -Dprefix=azure -DdbVersion=mi -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{secrets.TH_AZURE_MSSQL_MI_URL}}' test
- name: Azure ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run
if: ${{ steps.setup.outputs.databasePlatform == 'postgresql' && steps.setup.outputs.databaseVersion == 'azure' }}
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 }} -Dprefix=azure -DdbVersion=azure -DdbUsername=${{ format('{0}@{1}', secrets.TH_DB_ADMIN, secrets.TH_AZURE_POSTGRESQL_FQDN) }} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{secrets.TH_AZURE_POSTGRESQL_URL}}' test
- name: Archive Azure ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Results
uses: actions/upload-artifact@v4
with:
name: azure-${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }}-test-results
path: build/spock-reports
postgresql-flexible-test:
name: PostgreSQL Flexible Server Test
needs: setup
if: "contains(inputs.databases, 'postgresql:flexible')"
runs-on: ubuntu-latest
env:
TH_AZURE_POSTGRESQL_FLEXIBLE_SERVER_URL: TH_AZURE_POSTGRESQL_FLEXIBLE_SERVER_${{ matrix.version }}_URL
strategy:
matrix:
version: [15, 16]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Azure PostgreSQL Flexible Server dropAll
uses: liquibase-github-actions/drop-all@v4.29.2
with:
url: ${{ secrets[env.TH_AZURE_POSTGRESQL_FLEXIBLE_SERVER_URL] }}
username: "${{secrets.TH_DB_ADMIN}}"
password: "${{secrets.TH_DB_PASSWD}}"
licenseKey: "${{secrets.LICENSE_KEY}}"
force: true
requireForce: true
- name: Azure PostgreSQL Flexible Server init changelogs update
uses: liquibase/liquibase-github-action@v7
with:
operation: "update"
classpath: "src/test/resources/init-changelogs/azure"
changeLogFile: "postgresql.sql"
username: "${{secrets.TH_DB_ADMIN}}"
password: "${{secrets.TH_DB_PASSWD}}"
url: ${{ secrets[env.TH_AZURE_POSTGRESQL_FLEXIBLE_SERVER_URL] }}
- name: Azure ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Run
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 }} -Dprefix=azure -DdbVersion=flexible_${{ matrix.version }} -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{ secrets[env.TH_AZURE_POSTGRESQL_FLEXIBLE_SERVER_URL] }}' test
- name: Archive Azure ${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }} Test Results
uses: actions/upload-artifact@v4
with:
name: azure-${{ steps.setup.outputs.databasePlatform }}-${{ steps.setup.outputs.databaseVersion }}-flexible-${{ matrix.version }}-test-results
path: build/spock-reports