Skip to content

Schema check on startup #347

Schema check on startup

Schema check on startup #347

name: check smoke tests
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
smoke_tests:
runs-on: ubuntu-latest
strategy:
matrix:
database: [postgres, mysql, sqlserver] # Matrix for database types
services:
postgres:
image: postgres:17
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: pw
mysql:
image: mysql:8
ports:
- 3306:3306
env:
MYSQL_ROOT_PASSWORD: pw
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
ports:
- 1433:1433
env:
ACCEPT_EULA: Y
SA_PASSWORD: "YourStrong!Passw0rd"
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build RecordLinker Docker Image
run: |
docker build -t rl-service-image .
- name: Start RecordLinker Service and Run Smoke Tests
run: |
if [[ "${{ matrix.database }}" == "postgres" ]]; then
export DB_URI="postgresql+psycopg2://postgres:pw@localhost:5432/postgres"
elif [[ "${{ matrix.database }}" == "sqlite" ]]; then
export DB_URI="sqlite:///testdb.sqlite3"
elif [[ "${{ matrix.database }}" == "mysql" ]]; then
export DB_URI="mysql+pymysql://root:pw@localhost:3306/mysql"
elif [[ "${{ matrix.database }}" == "sqlserver" ]]; then
export DB_URI="mssql+pyodbc://sa:YourStrong!Passw0rd@localhost:1433/master?driver=ODBC+Driver+18+for+SQL+Server&TrustServerCertificate=yes"
fi
echo "DB_URI: $DB_URI"
docker run -d --name rl-service --network="host" -e DB_URI="$DB_URI" rl-service-image
TRIES=3
while ! curl -s http://localhost:8080/ | grep "OK"; do
echo "Waiting for RL Service to become healthy..."
sleep 3
((TRIES--))
if [ "$TRIES" -eq 0 ]; then
echo "RL Service did not become healthy in time."
docker logs rl-service # Fetch and print the logs
exit 1
fi
done
./scripts/smoke_tests.sh http://localhost:8080