Skip to content

Commit

Permalink
Merge branch 'master' into fix-JdbcExecutor-for-RawParameterizedSqlSt…
Browse files Browse the repository at this point in the history
…atement

Signed-off-by: filipe <flautert@liquibase.org>
  • Loading branch information
filipelautert committed Aug 29, 2023
2 parents 32a0e09 + 5e30bb5 commit 93bafee
Show file tree
Hide file tree
Showing 106 changed files with 2,358 additions and 556 deletions.
62 changes: 36 additions & 26 deletions .github/workflows/build-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ name: Build Branch SNAPSHOT

on:
workflow_dispatch:
push:
branches-ignore:
- master
workflow_call:
#push:
#branches:
#- 'master'
pull_request:
types:
- opened
- reopened
- synchronize

env:
MAVEN_VERSION: '3.9.2'
Expand All @@ -16,17 +20,23 @@ jobs:
runs-on: ubuntu-22.04
outputs:
timeStamp: ${{ steps.get-timestamp.outputs.timestamp }}
latestMergeSha: ${{ steps.get-sha.outputs.latest_Merge_Sha }}
thisBranchName: ${{ steps.get-branch-name.outputs.this_Branch_Name }}
thisBranchName: ${{ steps.get-branch-name.outputs.thisBranchName }}
thisSha: ${{ steps.get-commit-sha.outputs.thisSha }}
setupSuccessful: "true"

steps:
- uses: actions/checkout@v3
- name: Get Latest Merge Commit SHA
id: get-sha
run: |
latestMergeSha=$(git rev-parse HEAD)
echo "latest_Merge_Sha=${latestMergeSha}" >> $GITHUB_OUTPUT
with:
ref: ${{ github.event.pull_request.head.sha || github.event.after}}

- name: Get commit-sha
id: get-commit-sha
uses: actions/github-script@v6
with:
github-token: ${{ secrets.BOT_TOKEN }}
script: |
const helper = require('./.github/util/workflow-helper.js')({github, context});
core.setOutput("thisSha", helper.getCurrentSha());
- name: Get Timestamp
id: get-timestamp
Expand All @@ -37,9 +47,16 @@ jobs:
- name: Get Current BranchName
id: get-branch-name
run: |
thisBranchName=$(basename ${GITHUB_REF#refs/heads/})
modified_branch=$(echo "$thisBranchName" | tr / -)
echo "this_Branch_Name=$modified_branch" >> $GITHUB_OUTPUT
# this logic checks if the branch is from a forked repository PR or not. Where -n is the inverse of -z (not empty)
if [ -n "${GITHUB_HEAD_REF}" ];
then
branch_name=${GITHUB_HEAD_REF}
else
branch_name=${{ github.ref_name }}
fi
modified_branch_name=`(echo $branch_name | tr / -)`
echo "thisBranchName=$modified_branch_name" >> $GITHUB_OUTPUT
build:
name: Build & Package
Expand All @@ -48,14 +65,10 @@ jobs:
permissions:
contents: read
packages: write
env:
LATEST_MERGE_SHA: ${{ needs.setup.outputs.latestMergeSha }}
TIMESTAMP: ${{ needs.setup.outputs.timeStamp }}
CURRENT_BRANCH_NAME: ${{ needs.setup.outputs.thisBranchName }}


steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha || github.event.after}}
- name: Set up Java for publishing to GitHub Repository
uses: actions/setup-java@v3
with:
Expand All @@ -72,15 +85,12 @@ jobs:
# Version artifact based off of branch and commit SHA.
- name: Version Artifact
run: |
version=${{ github.ref_name }}-SNAPSHOT
# Replace / with - in branch name
version=$(echo "$version" | sed 's/\//-/g')
mvn versions:set -DnewVersion="$version"
mvn versions:set "-DnewVersion=${{ needs.setup.outputs.thisBranchName }}-SNAPSHOT"
#mvn versions:set "-DnewVersion=${{ inputs.branchName }}-SNAPSHOT"
# This would still deploy a package if there are test failures. Might help to have build.yml complete and then run this workflow
# Publish to GitHub Packages
- name: Publish package
run: |
mvn -B clean deploy -pl '!liquibase-dist' -DskipTests=true "-Dbuild.repository.owner=liquibase" "-Dbuild.repository.name=liquibase" "-Dbuild.branch=${{ env.CURRENT_BRANCH_NAME }}" "-Dbuild.number=${{ github.run_number }}" "-Dbuild.commit=${{ env.LATEST_MERGE_SHA }}" "-Dbuild.timestamp=${{ env.TIMESTAMP }}"
mvn -B clean deploy -pl '!liquibase-dist' -DskipTests=true "-Dbuild.repository.owner=liquibase" "-Dbuild.repository.name=liquibase" "-Dbuild.branch=${{ needs.setup.outputs.thisBranchName }}" "-Dbuild.number=${{ github.run_number }}" "-Dbuild.commit=${{ needs.setup.outputs.thisSha }}" "-Dbuild.timestamp=${{ needs.setup.outputs.timeStamp }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110 changes: 27 additions & 83 deletions .github/workflows/build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,99 +13,40 @@ env:
MAVEN_VERSION: '3.9.2'

jobs:
build:
name: Build & Package
runs-on: ubuntu-22.04
needs: setup
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3

- name: Find mvn Build Attributes
id: find-attributes
uses: actions/github-script@v6
with:
github-token: ${{ secrets.BOT_TOKEN }}
script: |
const helper = require('./.github/util/workflow-helper.js')({github, context});
core.setOutput("thisSha", helper.getCurrentSha());
core.setOutput("thisBranchName", helper.getCurrentBranch());
core.setOutput("thisRepoName", helper.getRepositoryName());
core.setOutput("thisRepoOwner", helper.getRepositoryOwner());
- uses: actions/checkout@v3

- name: Set up Java for publishing to GitHub Repository
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: liquibase

- name: Set up Maven
uses: stCarolas/setup-maven@v4.5
with:
maven-version: ${{ env.MAVEN_VERSION }}

# Version artifact based off of branch and commit SHA.
- name: Version Artifact
run: mvn versions:set "-DnewVersion=master-SNAPSHOT"

# Publish to GitHub Packages
- name: Publish package
run: mvn -B clean deploy -pl '!liquibase-dist' -DskipTests=true "-Dbuild.repository.owner=${{ needs.setup.outputs.thisRepositoryOwner }}" "-Dbuild.repository.name=${{ needs.setup.outputs.thisRepositoryName }}" "-Dbuild.branch=${{ needs.setup.outputs.thisBranchName }}" "-Dbuild.number=${{ github.run_number }}" "-Dbuild.commit=${{ needs.setup.outputs.thisSha }}" "-Dbuild.timestamp=${{ needs.setup.outputs.timestamp }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

setup:
name: Setup
runs-on: ubuntu-22.04
outputs:
thisSha: ${{ steps.find-attributes.outputs.thisSha }}
thisBranchName: ${{ steps.find-attributes.outputs.thisBranchName }}
thisBranchFileName: ${{ steps.find-attributes.outputs.thisBranchFileName }}
thisRepositoryName: ${{ steps.find-attributes.outputs.thisRepositoryName }}
thisRepositoryOwner: ${{ steps.find-attributes.outputs.thisRepositoryOwner }}
timestamp: ${{ steps.get-date.outputs.date }}
timeStamp: ${{ steps.get-timestamp.outputs.timeStamp }}
latestMergeSha: ${{ steps.get-sha.outputs.latestMergeSha }}
setupSuccessful: "true"

steps:
- uses: actions/checkout@v3
- name: Get current date
id: get-date
run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S')"
- name: Get Latest Merge Commit SHA
id: get-sha
run: |
latest_merge_sha=`(git rev-parse --short HEAD)`
echo "latestMergeSha=${latest_merge_sha}" >> $GITHUB_OUTPUT
- name: Find mvn Build Attributes
id: find-attributes
uses: actions/github-script@v6
with:
github-token: ${{ secrets.BOT_TOKEN }}
script: |
const helper = require('./.github/util/workflow-helper.js')({github, context});
- name: Get Timestamp
id: get-timestamp
run: |
timestamp=`(date +'%Y-%m-%d %H:%M:%S %Z')`
echo "timeStamp=${timestamp}" >> $GITHUB_OUTPUT
core.setOutput("thisSha", helper.getCurrentSha());
core.setOutput("thisBranchName", helper.getCurrentBranch());
core.setOutput("thisBranchFileName", helper.getCurrentBranch().replace(/[^a-zA-Z0-9\-_]/g, "_"));
core.setOutput("thisRepositoryName", helper.getRepositoryName());
core.setOutput("thisRepositoryOwner", helper.getRepositoryOwner());
build-sha:
name: Build & Package SHA
build-and-publish:
name: Build & Publish
runs-on: ubuntu-22.04
needs: setup
permissions:
contents: read
packages: write

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3

- name: Set up Java for publishing to GitHub Repository
uses: actions/setup-java@v3
with:
Expand All @@ -119,13 +60,16 @@ jobs:
with:
maven-version: ${{ env.MAVEN_VERSION }}

# Version artifact based off of branch and commit SHA.
- name: Version Artifact
run: mvn versions:set -DnewVersion="$(git rev-parse --short HEAD)-SNAPSHOT"
# Publish master-SNAPSHOT version to GPM
- name: Version Artifact as master-SNAPSHOT
run: mvn versions:set "-DnewVersion=master-SNAPSHOT"

- name: Publish master-SNAPSHOT
run: mvn -B clean deploy -pl '!liquibase-dist' -DskipTests=true "-Dbuild.repository.owner=liquibase" "-Dbuild.repository.name=liquibase" "-Dbuild.branch=master" "-Dbuild.number=${{ github.run_number }}" "-Dbuild.commit=${{ needs.setup.outputs.latestMergeSha }}" "-Dbuild.timestamp=${{ needs.setup.outputs.timeStamp }}"

# Publish to GitHub Packages
- name: Publish package
run: mvn -B clean deploy -pl '!liquibase-dist' -DskipTests=true "-Dbuild.repository.owner=${{ needs.setup.outputs.thisRepositoryOwner }}" "-Dbuild.repository.name=${{ needs.setup.outputs.thisRepositoryName }}" "-Dbuild.branch=${{ needs.setup.outputs.thisBranchFileName }}" "-Dbuild.number=${{ github.run_number }}" "-Dbuild.commit=${{ needs.setup.outputs.thisSha }}" "-Dbuild.timestamp=${{ needs.setup.outputs.timestamp }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Publish <commitsha>-SNAPSHOT version to GPM
- name: Version Artifact as commit-SNAPSHOT
run: mvn versions:set -DnewVersion="${{ needs.setup.outputs.latestMergeSha }}-SNAPSHOT"

- name: Publish commit-SNAPSHOT
run: mvn -B clean deploy -pl '!liquibase-dist' -DskipTests=true "-Dbuild.repository.owner=liquibase" "-Dbuild.repository.name=liquibase" "-Dbuild.branch=master" "-Dbuild.number=${{ github.run_number }}" "-Dbuild.commit=${{ needs.setup.outputs.latestMergeSha }}" "-Dbuild.timestamp=${{ needs.setup.outputs.timeStamp }}"
16 changes: 9 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ concurrency:

on:
workflow_dispatch:
inputs:
archive_test_results:
description: 'If set to true, the unit and integration test results will be archived to the build artifacts page.'
required: false
default: 'false'

# DAT branches can get triggered from this logic
pull_request_target:
Expand Down Expand Up @@ -70,7 +75,7 @@ jobs:

- name: Get current date
id: get-date
run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S')"
run: echo "::set-output name=date::$(date +'%Y-%m-%d %H:%M:%S %Z')"

- name: Find corresponding branches
id: find-branches
Expand Down Expand Up @@ -203,7 +208,7 @@ jobs:
find . -name original-*.jar -exec rm {} \;
- name: Archive Test Results
if: ${{ always() }}
if: ${{ inputs.archive_test_results == 'true' }}
uses: actions/upload-artifact@v3
with:
name: liquibase-test-results-jdk${{ matrix.java }}
Expand Down Expand Up @@ -314,20 +319,17 @@ jobs:
run: mvn -B jar:jar jar:test-jar surefire:test -DtrimStackTrace=false -Dliquibase.sdk.testSystem.test=${{ matrix.testSystem }} -Dliquibase.sdk.testSystem.acceptLicenses=${{ matrix.testSystem }} -Dtest=*IntegrationTest,*ExecutorTest -DfailIfNoTests=false -Dsurefire.failIfNoSpecifiedTests=false

- name: Archive Test Results
if: ${{ always() }}
if: ${{ inputs.archive_test_results == 'true' }}
uses: actions/upload-artifact@v3
with:
name: ${{ steps.prepare.outputs.testResultsArtifact }}
path: |
./**/target/surefire-reports
call-build-branch:
uses: liquibase/liquibase/.github/workflows/build-branch.yml@master

package:
name: Package Artifacts
runs-on: macos-latest
needs: [ setup, build, call-build-branch ]
needs: [ setup, build ]
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion liquibase-cdi-jakarta/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<!-- Converts the generated flattened-pom into a cleaner version for maven distribution -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0.2</version>
<version>1.1.0</version>
<executions>
<execution>
<id>transform-deploy-pom</id>
Expand Down
2 changes: 1 addition & 1 deletion liquibase-cdi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<!-- Converts the generated flattened-pom into a cleaner version for maven distribution -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0.2</version>
<version>1.1.0</version>
<executions>
<execution>
<id>transform-deploy-pom</id>
Expand Down
4 changes: 2 additions & 2 deletions liquibase-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<properties>
<deploy.repositoryId>liquibase</deploy.repositoryId>
<deploy.url>https://maven.pkg.github.com/liquibase/liquibase</deploy.url>
<h2.version>2.1.214</h2.version>
<h2.version>2.2.220</h2.version>
<hsqldb.version>2.7.2</hsqldb.version>
<postgresql.version>42.6.0</postgresql.version>
<mssql.version>12.2.0.jre8</mssql.version>
Expand Down Expand Up @@ -145,7 +145,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>2.0</version>
<version>2.2</version>
</dependency>

<!-- needed for inclusion in CLI when running in newer java versions -->
Expand Down
2 changes: 1 addition & 1 deletion liquibase-dist/src/main/install4j/liquibase.install4j
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<entry>sqlite-*</entry>
</macSearchedJars>
</codeSigning>
<jreBundles jdkProviderId="AdoptOpenJDK" release="openjdk17/jdk-17.0.7+7" />
<jreBundles jdkProviderId="AdoptOpenJDK" release="openjdk17/jdk-17.0.8+7" />
</application>
<files>
<mountPoints>
Expand Down
12 changes: 0 additions & 12 deletions liquibase-extension-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,17 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
<scope>compile</scope>
<type>pom</type>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-testng</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${dependency.spock.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>compile</scope>
</dependency>

</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Long Description: ${commandDefinition.getLongDescription() ?: "NOT SET"}
def currentOs = OperatingSystem.getCurrent()
Assume.assumeTrue("The current operating system (" + currentOs.name + ") does not support this test.", testDef.supportedOs.contains(currentOs))
}
final commandScope
def commandScope
try {
commandScope = new CommandScope(testDef.commandTestDefinition.command as String[])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ protected Driver getDriver(String url) throws SQLException {
//
final URLClassLoader isolatedClassloader = new URLClassLoader(new URL[]{
driverPath.toUri().toURL(),
}, null);
}, this.getClass().getClassLoader());

final Class<?> isolatedDriverManager = Class.forName(DriverManager.class.getName(), true, isolatedClassloader);
final Method getDriverMethod = isolatedDriverManager.getMethod("getDriver", String.class);
Expand Down

0 comments on commit 93bafee

Please sign in to comment.