diff --git a/.github/workflows/lth-docker.yml b/.github/workflows/lth-docker.yml new file mode 100644 index 00000000..8b30b213 --- /dev/null +++ b/.github/workflows/lth-docker.yml @@ -0,0 +1,53 @@ +name: Liquibase Test Harness on Docker-Based Databases + +on: + workflow_call: + secrets: + PRO_LICENSE_KEY: + description: 'Liquibase Pro license key' + required: true + +jobs: + liquibase-test-harness: + name: Liquibase Test Harness + runs-on: ubuntu-latest + + strategy: + matrix: + liquibase-support-level: [Contributed, Foundational, 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 # Checkout the code from the repository + uses: actions/checkout@v3 + + - name: Start database container # Start the database container using Docker Compose + run: docker compose -f src/test/resources/docker/docker-compose.yml up -d + + - name: Setup Temurin Java 17 # Set up Java 17 with Temurin distribution and cache the Maven packages + 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 -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 + env: + LIQUIBASE_PRO_LICENSE_KEY: ${{ secrets.PRO_LICENSE_KEY }} # Set the environment variable for the Liquibase Pro license key + run: mvn -ntp -Dtest=${{ matrix.liquibase-support-level }}ExtensionHarnessSuite test # Run the Liquibase test harness at each test level + + - name: Test Reporter # Generate a test report using the Test Reporter action + uses: dorny/test-reporter@v1.6.0 + 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 database container # Stop the database container using Docker Compose + run: docker compose -f src/test/resources/docker/docker-compose.yml down diff --git a/README.md b/README.md index a05851af..266b355a 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ jobs: uses: liquibase/build-logic/.github/workflows/{workflow}.yml@main ``` -## Example Extension Workflow +## Example Build/Test/Release Extension Workflow ```mermaid graph LR @@ -40,17 +40,17 @@ graph LR Please review the below table of reusable workflows and their descriptions: -| Workflow | Description | -|-----------------------------------------|--------------------------------------------------------------------------------| -| `build-artifact.yml` | Runs maven build and saves artifacts | -| `create-release.yml` | Runs Release Drafter to auto create draft release notes | -| `extension-attach-artifact-release.yml` | Attaches a tested artifact to the draft release | -| `extension-release-published.yml` | Publishes a release to Maven Central | -| `os-extension-test.yml` | Unit tests across build matrix on previously built artifact | -| `pro-extension-test.yml` | Same as OS job, but with additional Pro-only vars such as License Key | -| `sonar-pull-request.yml` | Code Coverage Scan for PRs. Requires branch name parameter | -| `sonar-push.yml` | Same as PR job, but for pushes to main. Does not require branch name parameter | -| `snyk-nightly.yml` | Nightly Security Scans | +| Workflow | Description | +|-----------------------------------------|---------------------------------------------------------------------------------------| +| `build-artifact.yml` | Runs maven build and saves artifacts | +| `create-release.yml` | Runs Release Drafter to auto create draft release notes | +| `extension-attach-artifact-release.yml` | Attaches a tested artifact to the draft release | +| `extension-release-published.yml` | Publishes a release to Maven Central | +| `os-extension-test.yml` | Unit tests across build matrix on previously built artifact | +| `pro-extension-test.yml` | Same as OS job, but with additional Pro-only vars such as License Key | +| `sonar-pull-request.yml` | Code Coverage Scan for PRs. Requires branch name parameter | +| `sonar-push.yml` | Same as PR job, but for pushes to main. Does not require branch name parameter | +| `snyk-nightly.yml` | Nightly Security Scans | | various shell scripts | helper scripts for getting the draft release, signing artifacts, and uploading assets | ## Requirements @@ -130,3 +130,12 @@ The following artifacts must be created `mvn clean package`. If the javadoc and ``` +## Liquibase Test Harness + +| Workflow | Description | +|-----------------------------------------|---------------------------------------------------------------------------------------| +| `lth-docker.yml` | Runs Liquibase Test Harness against a docker container | + +### Docker Databases +#### Requirements +- Docker Compose file must be located in `src/test/resources/docker-compose.yml` \ No newline at end of file