Skip to content

Commit

Permalink
feat: Adds integration test execution to the pipeline.
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavofreze committed Mar 3, 2024
1 parent 7c683ab commit 5213da2
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,20 @@ jobs:
MYSQL_DATABASE: "cheap_delivery_adm_test"
MYSQL_ROOT_PASSWORD: "root"
ports:
- 3306:3306
- 3307:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

steps:
- name: Start database container
run: docker run --name cheap-delivery-adm -d mysql:8.1

- name: Wait for database to start
run: |
until docker exec cheap-delivery-adm mysqladmin ping --silent; do
echo "Waiting for database to start..."
sleep 5
done
- name: Checkout
uses: actions/checkout@v3

Expand All @@ -57,11 +64,12 @@ jobs:

- name: Run database migrations
run: |
DOCKER_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cheap-delivery-adm)
docker run --rm -v ${PWD}/db/mysql/migrations:/flyway/sql --env-file=config/local.env \
flyway/flyway:10.8.1 \
-locations=filesystem:/flyway/sql \
-schemas=cheap_delivery_adm_test \
migrate
-url=jdbc:mysql://${DOCKER_IP}:3306/cheap_delivery_adm_test \
-user=root -password=root \
-locations=filesystem:/flyway/sql migrate
- name: Run tests
env:
Expand Down

0 comments on commit 5213da2

Please sign in to comment.