Skip to content

Commit

Permalink
fix(test.yml): fix incorrect step order in workflow file to ensure co…
Browse files Browse the repository at this point in the history
…rrect execution order

feat(test.yml): add test for liquibase version to verify correct installation and setup
  • Loading branch information
jandroav committed Dec 15, 2023
1 parent b9d8624 commit 891514b
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@ jobs:
run: |
docker build -f ${{ matrix.dockerfile }} -t liquibase/liquibase:${{ github.sha }} .
- name: Test liquibase version
- name: Test liquibase init start-h2
run: |
LOG_STRING="Liquibase Version:"
docker run --name $CONTAINER_NAME -d -v $(pwd)/.github/test:/liquibase/changelog liquibase/liquibase:${{ github.sha }} init start-h2
sleep 5
docker logs $CONTAINER_NAME
LOG_STRING="jdbc:h2:tcp://localhost:9090/mem:dev"
# Check if the container is running
if docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" 2>/dev/null | grep -q "true"; then
# Get the logs and check if the desired string is present
if docker exec $CONTAINER_NAME liquibase --version 2>&1 | grep -q "$LOG_STRING"; then
if docker logs "$CONTAINER_NAME" 2>&1 | grep -q "$LOG_STRING"; then
echo "The log contains the string: $LOG_STRING"
else
echo "The log does not contain the string: $LOG_STRING"
Expand All @@ -53,16 +56,13 @@ jobs:
exit 2
fi
- name: Test liquibase init start-h2
- name: Test liquibase version
run: |
docker run --name $CONTAINER_NAME -d -v $(pwd)/.github/test:/liquibase/changelog liquibase/liquibase:${{ github.sha }} init start-h2
sleep 5
docker logs $CONTAINER_NAME
LOG_STRING="jdbc:h2:tcp://localhost:9090/mem:dev"
LOG_STRING="Liquibase Version:"
# Check if the container is running
if docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" 2>/dev/null | grep -q "true"; then
# Get the logs and check if the desired string is present
if docker logs "$CONTAINER_NAME" 2>&1 | grep -q "$LOG_STRING"; then
if docker exec $CONTAINER_NAME liquibase --version 2>&1 | grep -q "$LOG_STRING"; then
echo "The log contains the string: $LOG_STRING"
else
echo "The log does not contain the string: $LOG_STRING"
Expand Down

0 comments on commit 891514b

Please sign in to comment.