generated from liquibase/liquibase-extension-example
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
106 additions
and
7 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,8 @@ jobs: | |
TF_VAR_TEST_CATALOG: main | ||
TF_VAR_TEST_SCHEMA: liquibase_harness_test_ds | ||
WORKSPACE_ID: ${{ secrets.TH_DATABRICKS_WORKSPACE_ID }} | ||
|
||
LIQUIBOT_TOKEN: ${{ secrets.LIQUIBOT_PAT }} | ||
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | ||
strategy: | ||
max-parallel: 1 | ||
matrix: | ||
|
@@ -62,12 +63,54 @@ jobs: | |
distribution: temurin | ||
cache: 'maven' | ||
|
||
- name: maven-settings-xml-action | ||
uses: whelk-io/maven-settings-xml-action@v22 | ||
with: | ||
repositories: | | ||
[ | ||
{ | ||
"id": "liquibase", | ||
"url": "https://maven.pkg.github.com/liquibase/liquibase", | ||
"releases": { | ||
"enabled": "false" | ||
}, | ||
"snapshots": { | ||
"enabled": "true", | ||
"updatePolicy": "always" | ||
} | ||
}, | ||
{ | ||
"id": "liquibase-pro", | ||
"url": "https://maven.pkg.github.com/liquibase/liquibase-pro", | ||
"releases": { | ||
"enabled": "false" | ||
}, | ||
"snapshots": { | ||
"enabled": "true", | ||
"updatePolicy": "always" | ||
} | ||
} | ||
] | ||
servers: | | ||
[ | ||
{ | ||
"id": "liquibase-pro", | ||
"username": "liquibot", | ||
"password": "${{ secrets.LIQUIBOT_PAT }}" | ||
}, | ||
{ | ||
"id": "liquibase", | ||
"username": "liquibot", | ||
"password": "${{ secrets.LIQUIBOT_PAT }}" | ||
} | ||
] | ||
- name: Build with Maven # Build the code with Maven (skip tests) | ||
run: mvn -B -ntp -Dmaven.test.skip package | ||
run: mvn -B -ntp -Dmaven.test.skip package -Dliquibase.version=master-SNAPSHOT | ||
|
||
- name: Run ${{ matrix.liquibase-support-level }} Liquibase Test Harness # Run the Liquibase test harness at each test level | ||
if: always() # 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 | ||
run: mvn -B -ntp -DdbPassword=${{env.TF_VAR_DBX_TOKEN}} -DdbUrl='${{env.DATABRICKS_URL}}' -Dtest=liquibase.ext.databricks.${{ matrix.liquibase-support-level }}ExtensionHarnessTestSuite test -Dliquibase.version=master-SNAPSHOT # 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] | ||
|
@@ -93,4 +136,4 @@ jobs: | |
else | ||
echo "Schema does not exist. Skipping removal." | ||
fi | ||
fi | ||
fi |
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
55 changes: 55 additions & 0 deletions
55
src/main/java/liquibase/ext/databricks/parser/NamespaceDetailsDatabricks.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package liquibase.ext.databricks.parser; | ||
|
||
import liquibase.parser.LiquibaseParser; | ||
import liquibase.parser.NamespaceDetails; | ||
import liquibase.parser.core.xml.XMLChangeLogSAXParser; | ||
import liquibase.serializer.LiquibaseSerializer; | ||
import liquibase.serializer.core.xml.XMLChangeLogSerializer; | ||
|
||
/** | ||
* Namespace details for Databricks extension. | ||
* It is used by Liquibase when generating changelogs - ie during a snapshot. | ||
*/ | ||
public class NamespaceDetailsDatabricks implements NamespaceDetails { | ||
|
||
public static final String DATABRICKS_NAMESPACE = "http://www.liquibase.org/xml/ns/databricks"; | ||
|
||
public static final String DATABRICKS_XSD = "http://www.liquibase.org/xml/ns/databricks/liquibase-databricks-latest.xsd"; | ||
|
||
@Override | ||
public int getPriority() { | ||
return PRIORITY_EXTENSION; | ||
} | ||
|
||
@Override | ||
public boolean supports(LiquibaseSerializer serializer, String namespace) { | ||
return namespaceCorrect(namespace) && serializer instanceof XMLChangeLogSerializer; | ||
} | ||
|
||
@Override | ||
public boolean supports(LiquibaseParser parser, String namespace) { | ||
return namespaceCorrect(namespace) && parser instanceof XMLChangeLogSAXParser; | ||
} | ||
|
||
@Override | ||
public String getShortName(String namespace) { | ||
return "databricks"; | ||
} | ||
|
||
@Override | ||
public String getSchemaUrl(String namespace) { | ||
return DATABRICKS_XSD; | ||
} | ||
|
||
@Override | ||
public String[] getNamespaces() { | ||
return new String[]{ | ||
DATABRICKS_NAMESPACE | ||
}; | ||
} | ||
|
||
private boolean namespaceCorrect(String namespace) { | ||
return namespace.equals(DATABRICKS_NAMESPACE) || namespace.equals(DATABRICKS_XSD); | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
src/main/resources/META-INF/services/liquibase.parser.NamespaceDetails
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
liquibase.ext.databricks.parser.NamespaceDetailsDatabricks |