Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAT-17839 Ephemeral Snowflake infra for liquibase-test-harness #822

Merged
merged 6 commits into from
Jun 6, 2024
49 changes: 38 additions & 11 deletions .github/workflows/snowflake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,69 @@ concurrency: snowflake-run
on:
# Triggers the workflow on a schedule for the main branch. Also allows for manual triggers
schedule:
- cron: '0 7 * * *' # Execute every day at 7AM UTC
- cron: '0 7 * * 6' # Execute on saturdays at 7AM UTC
workflow_dispatch:

jobs:

deploy-ephemeral-cloud-infra:
uses: liquibase/build-logic/.github/workflows/ephemeral-cloud-infra.yml@main
secrets: inherit
with:
deploy: true
snowflake_th: true

test:
runs-on: ubuntu-latest
needs: [deploy-ephemeral-cloud-infra]
permissions:
contents: read
id-token: write

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: liquibase-github-actions/drop-all@v4.27.0

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
url: "${{secrets.TH_SNOW_URL}}"
username: "${{secrets.TH_DB_ADMIN}}"
password: "${{secrets.TH_DB_PASSWD}}"
licenseKey: "${{secrets.LICENSE_KEY}}"
force: true
requireForce: true
role-to-assume: ${{ secrets.AWS_DEV_GITHUB_OIDC_ROLE_ARN_BUILD_LOGIC }}
aws-region: us-east-1

- name: Get LIQUIBASETH secrets
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: |
TH_DB_ADMIN, liquibaseth_usrname
TH_DB_PASSWD, liquibaseth_pwd

- uses: liquibase/liquibase-github-action@v7
with:
operation: "update"
classpath: "src/test/resources/init-changelogs/snowflake"
changeLogFile: "snowflake.sql"
username: "${{secrets.TH_DB_ADMIN}}"
password: "${{secrets.TH_DB_PASSWD}}"
username: "${{env.TH_DB_ADMIN}}"
password: "${{env.TH_DB_PASSWD}}"
url: "${{secrets.TH_SNOW_URL}}"

- name: Snowflake Test Run
env:
LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.LICENSE_KEY }}
run: mvn -Dtest=LiquibaseHarnessSuiteTest -DconfigFile=/harness-config-cloud.yml -DdbName=snowflake -DdbUsername=${{secrets.TH_DB_ADMIN}} -DdbPassword=${{secrets.TH_DB_PASSWD}} -DdbUrl='${{secrets.TH_SNOW_URL}}' -DrollbackStrategy=rollbackByTag test
run: mvn -Dtest=LiquibaseHarnessSuiteTest -DconfigFile=/harness-config-cloud.yml -DdbName=snowflake -DdbUsername=${{env.TH_DB_ADMIN}} -DdbPassword=${{env.TH_DB_PASSWD}} -DdbUrl='${{secrets.TH_SNOW_URL}}' -DrollbackStrategy=rollbackByTag test

- name: Archive Snowflake Database Test Results
uses: actions/upload-artifact@v4
with:
name: snowflake-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 }}
snowflake_th: true
Loading