workflow - test db as services #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | ||
push: | ||
branches: | ||
- master # Adjust if your default branch has a different name | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
services: | ||
mysql: | ||
image: mysql-custom:latest | ||
build: | ||
context: . | ||
dockerfile: tests/db/mysql/Dockerfile | ||
env: | ||
MYSQL_ROOT_PASSWORD: root | ||
MYSQL_DATABASE: testSchema | ||
MYSQL_USER: testUser | ||
MYSQL_PASSWORD: 3WBUT7My996BLVoTZHo3 | ||
ports: | ||
- 3306:3306 | ||
options: >- | ||
--health-cmd="mysqladmin ping -h localhost -u root --password=root" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=5 | ||
mariadb: | ||
image: mariadb-custom:latest | ||
build: | ||
context: . | ||
dockerfile: tests/db/mariadb/Dockerfile | ||
env: | ||
MYSQL_ROOT_PASSWORD: root | ||
MYSQL_DATABASE: testSchema | ||
MYSQL_USER: testUser | ||
MYSQL_PASSWORD: 3WBUT7My996BLVoTZHo3 | ||
ports: | ||
- 3307:3306 | ||
options: >- | ||
--health-cmd="mysqladmin ping -h localhost -u root --password=root" | ||
--health-interval=10s | ||
--health-timeout=5s | ||
--health-retries=5 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Wait for MySQL to be ready | ||
run: | | ||
echo "Waiting for MySQL..." | ||
sleep 30 # Wait a bit longer to ensure MySQL is fully ready | ||
- name: Check MySQL connection | ||
run: | | ||
mysql -h 127.0.0.1 -P 3306 -u root --password=root -e "SHOW DATABASES;" | ||
- name: Wait for MariaDB to be ready | ||
run: | | ||
echo "Waiting for MariaDB..." | ||
sleep 30 # Wait a bit longer to ensure MariaDB is fully ready | ||
- name: Check MariaDB connection | ||
run: | | ||
mysql -h 127.0.0.1 -P 3307 -u root --password=root -e "SHOW DATABASES;" |