Skip to content

Commit

Permalink
Merge pull request #16 from liquibase/feature/LTHDocker
Browse files Browse the repository at this point in the history
DAT-12741 create reusable workflow for LTH on Docker Databases
  • Loading branch information
jnewton03 authored Mar 20, 2023
2 parents 3f9ad88 + b4cbb69 commit ac442f2
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 12 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/lth-docker.yml
Original file line number Diff line number Diff line change
@@ -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
33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -130,3 +130,12 @@ The following artifacts must be created `mvn clean package`. If the javadoc and
</executions>
</plugin>
```
## 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`

0 comments on commit ac442f2

Please sign in to comment.