Support "Advanced" level validation #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Liquibase Test Harness | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
liquibase-test-harness: | |
name: Liquibase Test Harness | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
env: | |
TF_VAR_DBX_HOST: ${{ secrets.TH_DATABRICKS_WORKSPACE_HOST }} | |
TF_VAR_DBX_TOKEN: ${{ secrets.TH_DATABRICKS_WORKSPACE_TOKEN }} | |
TF_VAR_TEST_CATALOG: main | |
TF_VAR_TEST_SCHEMA: lb_test_harness | |
WORKSPACE_ID: ${{ secrets.TH_DATABRICKS_WORKSPACE_ID }} | |
strategy: | |
matrix: | |
liquibase-support-level: [Foundational, Contributed, Advanced] # Define the different test levels to run | |
fail-fast: false # Set fail-fast to false to run all test levels even if some of them fail | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- run: terraform init | |
working-directory: src/test/terraform | |
- run: terraform plan | |
working-directory: src/test/terraform | |
- run: terraform apply -auto-approve | |
working-directory: src/test/terraform | |
- name: Collect Databricks Config | |
working-directory: src/test/terraform | |
run: | | |
CLUSTER_ID=$(terraform output -raw cluster_url) | |
DATABRICKS_HOST=${TF_VAR_DBX_HOST#https://} | |
echo "DATABRICKS_URL=jdbc:databricks://$DATABRICKS_HOST:443/default;transportMode=http;ssl=1;httpPath=sql/protocolv1/o/$WORKSPACE_ID/$CLUSTER_ID;AuthMech=3;ConnCatalog=$TF_VAR_TEST_CATALOG;ConnSchema=$TF_VAR_TEST_SCHEMA;EnableArrow=0" >> "$GITHUB_ENV" | |
- name: Setup Temurin Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: temurin | |
cache: 'maven' | |
- name: Build with Maven # Build the code with Maven (skip tests) | |
run: mvn -B -ntp -Dmaven.test.skip package | |
- name: Run ${{ matrix.liquibase-support-level }} Liquibase Test Harness # Run the Liquibase test harness at each test level | |
continue-on-error: true # Continue to run the action even if the previous steps fail | |
run: mvn -B -ntp -DdbPassword=${{env.TF_VAR_DBX_TOKEN}} -DdbUrl='${{env.DATABRICKS_URL}}' -Dtest=liquibase.ext.databricks.${{ matrix.liquibase-support-level }}ExtensionHarnessTestSuite test # Run the Liquibase test harness at each test level | |
- name: Test Reporter # Generate a test report using the Test Reporter action | |
uses: dorny/[email protected] | |
if: always() # Run the action even if the previous steps fail | |
with: | |
name: Liquibase Test Harness - ${{ matrix.liquibase-support-level }} Reports # Set the name of the test report | |
path: target/surefire-reports/TEST-*.xml # Set the path to the test report files | |
reporter: java-junit # Set the reporter to use | |
fail-on-error: false # Set fail-on-error to false to show report even if it has failed tests | |
- name: Stop test database | |
if: always() # Always destroy, even if the previous steps fail | |
working-directory: src/test/terraform | |
run: terraform destroy -auto-approve |