@@ -11,31 +11,27 @@ jobs:
1111 postgresql-preview :
1212 runs-on : ubuntu-latest
1313
14+ services :
15+ postgres :
16+ image : postgres:17
17+ env :
18+ POSTGRES_USER : postgres
19+ POSTGRES_PASSWORD : postgres
20+ POSTGRES_DB : testdb
21+ options : >-
22+ --health-cmd pg_isready
23+ --health-interval 10s
24+ --health-timeout 5s
25+ --health-retries 5
26+ ports :
27+ - 5432:5432
28+
1429 steps :
1530 - name : Checkout code
1631 uses : actions/checkout@v5
1732 with :
1833 fetch-depth : 0
1934
20- - name : Start PostgreSQL with Docker Compose
21- run : |
22- docker compose up -d postgres
23- env :
24- POSTGRES_VERSION : 17
25-
26- - name : Wait for PostgreSQL
27- run : |
28- for i in {1..30}; do
29- if docker exec $(docker compose ps -q postgres) pg_isready -U postgres >/dev/null 2>&1; then
30- echo "PostgreSQL is ready"
31- break
32- fi
33- echo "Waiting for PostgreSQL..."
34- sleep 2
35- done
36- # Create the test database
37- docker exec $(docker compose ps -q postgres) psql -U postgres -c "CREATE DATABASE testdb;"
38-
3935 - name : Preview PostgreSQL schema changes
4036 uses : ./
4137 with :
@@ -44,57 +40,34 @@ jobs:
4440 baseline-schema-file : examples/psqldef-current.sql
4541 schema-file : examples/psqldef-desired.sql
4642 pg-user : postgres
47- pg-password : ' '
43+ pg-password : postgres
4844 pg-host : localhost
4945 pg-port : 5432
5046 pg-database : testdb
5147
52- - name : Stop PostgreSQL
53- if : always()
54- run : docker compose down postgres
55-
5648 mysql-preview :
5749 runs-on : ubuntu-latest
5850
51+ services :
52+ mysql :
53+ image : mysql:8.0
54+ env :
55+ MYSQL_ROOT_PASSWORD : testpass
56+ MYSQL_DATABASE : testdb
57+ options : >-
58+ --health-cmd "mysqladmin ping -h localhost -u root -ptestpass"
59+ --health-interval 10s
60+ --health-timeout 5s
61+ --health-retries 10
62+ ports :
63+ - 3306:3306
64+
5965 steps :
6066 - name : Checkout code
6167 uses : actions/checkout@v5
6268 with :
6369 fetch-depth : 0
6470
65- - name : Start MySQL with Docker Compose
66- run : |
67- docker compose up -d mysql
68- env :
69- MYSQL_VERSION : 8.0
70-
71- - name : Wait for MySQL
72- run : |
73- # Wait for MySQL to be ready inside container
74- for i in {1..30}; do
75- if docker exec $(docker compose ps -q mysql) mysql -uroot -ptestpass -e "SELECT 1" >/dev/null 2>&1; then
76- echo "MySQL is ready inside container"
77- break
78- fi
79- echo "Waiting for MySQL..."
80- sleep 2
81- done
82-
83- # Give MySQL more time to accept external connections
84- echo "Waiting for MySQL to accept external connections..."
85- sleep 5
86-
87- # Create the test database
88- docker exec $(docker compose ps -q mysql) mysql -uroot -ptestpass -e "CREATE DATABASE testdb;"
89-
90- # Debug: Check MySQL status and users
91- echo "Checking MySQL users and permissions..."
92- docker exec $(docker compose ps -q mysql) mysql -uroot -ptestpass -e "SELECT user, host FROM mysql.user WHERE user='root';"
93-
94- # Test connection from host
95- echo "Testing connection from host..."
96- mysql -h 127.0.0.1 -P 3306 -u root -ptestpass -e "SHOW DATABASES;" || echo "Note: Direct MySQL client connection failed"
97-
9871 - name : Preview MySQL schema changes
9972 uses : ./
10073 with :
@@ -103,15 +76,11 @@ jobs:
10376 baseline-schema-file : examples/mysqldef-current.sql
10477 schema-file : examples/mysqldef-desired.sql
10578 mysql-user : root
106- mysql-password : ' testpass'
79+ mysql-password : testpass
10780 mysql-host : 127.0.0.1
10881 mysql-port : 3306
10982 mysql-database : testdb
11083
111- - name : Stop MySQL
112- if : always()
113- run : docker compose down mysql
114-
11584 sqlite-preview :
11685 runs-on : ubuntu-latest
11786
@@ -139,11 +108,14 @@ jobs:
139108 with :
140109 fetch-depth : 0
141110
142- - name : Start MSSQL with Docker Compose
111+ - name : Start MSSQL
143112 run : |
144- docker compose up -d mssql
145- env :
146- MSSQL_VERSION : 2022-latest
113+ docker run -d \
114+ --name mssql \
115+ -e "ACCEPT_EULA=Y" \
116+ -e "SA_PASSWORD=Passw0rd" \
117+ -p 1433:1433 \
118+ mcr.microsoft.com/mssql/server:2022-latest
147119
148120 - name : Wait for MSSQL
149121 run : |
@@ -156,18 +128,16 @@ jobs:
156128
157129 # Wait for MSSQL to be ready
158130 for i in {1..60}; do
159- # Try both old and new sqlcmd paths for compatibility
160- if docker exec $(docker compose ps -q mssql) /opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P "Passw0rd" -Q "SELECT 1" -C >/dev/null 2>&1 || \
161- docker exec $(docker compose ps -q mssql) /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Passw0rd" -Q "SELECT 1" >/dev/null 2>&1; then
131+ if /opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P "Passw0rd" -Q "SELECT 1" -C >/dev/null 2>&1; then
162132 echo "MSSQL is ready"
163133 break
164134 fi
165135 echo "Waiting for MSSQL..."
166136 sleep 3
167137 done
168- # Create the test database (try both paths)
169- docker exec $(docker compose ps -q mssql) /opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P "Passw0rd" -Q "CREATE DATABASE testdb;" -C || \
170- docker exec $(docker compose ps -q mssql) /opt/mssql-tools /bin/sqlcmd -S localhost -U SA -P "Passw0rd" -Q "CREATE DATABASE testdb;"
138+
139+ # Create the test database
140+ /opt/mssql-tools18 /bin/sqlcmd -S localhost -U SA -P "Passw0rd" -Q "CREATE DATABASE testdb;" -C
171141
172142 - name : Preview MSSQL schema changes
173143 uses : ./
@@ -184,4 +154,4 @@ jobs:
184154
185155 - name : Stop MSSQL
186156 if : always()
187- run : docker compose down mssql
157+ run : docker stop mssql && docker rm mssql
0 commit comments