@@ -11,106 +11,79 @@ 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 :
4238 command : psqldef
4339 version : latest
40+ config-file : examples/psqldef.yaml
4441 baseline-schema-file : examples/psqldef-current.sql
4542 schema-file : examples/psqldef-desired.sql
4643 pg-user : postgres
47- pg-password : ' '
44+ pg-password : postgres
4845 pg-host : localhost
4946 pg-port : 5432
5047 pg-database : testdb
51-
52- - name : Stop PostgreSQL
53- if : always()
54- run : docker compose down postgres
48+ github-token : ${{ secrets.GITHUB_TOKEN }}
5549
5650 mysql-preview :
5751 runs-on : ubuntu-latest
5852
53+ services :
54+ mysql :
55+ image : mysql:8.0
56+ env :
57+ MYSQL_ROOT_PASSWORD : testpass
58+ MYSQL_DATABASE : testdb
59+ options : >-
60+ --health-cmd "mysqladmin ping -h localhost -u root -ptestpass"
61+ --health-interval 10s
62+ --health-timeout 5s
63+ --health-retries 10
64+ ports :
65+ - 3306:3306
66+
5967 steps :
6068 - name : Checkout code
6169 uses : actions/checkout@v5
6270 with :
6371 fetch-depth : 0
6472
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-
9873 - name : Preview MySQL schema changes
9974 uses : ./
10075 with :
10176 command : mysqldef
10277 version : latest
78+ config-file : examples/mysqldef.yaml
10379 baseline-schema-file : examples/mysqldef-current.sql
10480 schema-file : examples/mysqldef-desired.sql
10581 mysql-user : root
106- mysql-password : ' testpass'
82+ mysql-password : testpass
10783 mysql-host : 127.0.0.1
10884 mysql-port : 3306
10985 mysql-database : testdb
110-
111- - name : Stop MySQL
112- if : always()
113- run : docker compose down mysql
86+ github-token : ${{ secrets.GITHUB_TOKEN }}
11487
11588 sqlite-preview :
11689 runs-on : ubuntu-latest
@@ -126,26 +99,37 @@ jobs:
12699 with :
127100 command : sqlite3def
128101 version : latest
102+ config-file : examples/sqlite3def.yaml
129103 baseline-schema-file : examples/sqlite3def-current.sql
130104 schema-file : examples/sqlite3def-desired.sql
131105 sqlite-database : test.db
106+ github-token : ${{ secrets.GITHUB_TOKEN }}
132107
133108 mssql-preview :
134109 runs-on : ubuntu-latest
135110
111+ services :
112+ mssql :
113+ image : mcr.microsoft.com/mssql/server:2022-latest
114+ env :
115+ ACCEPT_EULA : Y
116+ SA_PASSWORD : Passw0rd
117+ options : >-
118+ --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P Passw0rd -Q 'SELECT 1' -C || /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P Passw0rd -Q 'SELECT 1'"
119+ --health-interval 10s
120+ --health-timeout 5s
121+ --health-retries 10
122+ --health-start-period 20s
123+ ports :
124+ - 1433:1433
125+
136126 steps :
137127 - name : Checkout code
138128 uses : actions/checkout@v5
139129 with :
140130 fetch-depth : 0
141131
142- - name : Start MSSQL with Docker Compose
143- run : |
144- docker compose up -d mssql
145- env :
146- MSSQL_VERSION : 2022-latest
147-
148- - name : Wait for MSSQL
132+ - name : Setup MSSQL database
149133 run : |
150134 # Install sqlcmd tools
151135 sudo apt-get update && sudo apt-get install -y curl gnupg
@@ -154,34 +138,20 @@ jobs:
154138 sudo apt-get update
155139 sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18
156140
157- # Wait for MSSQL to be ready
158- 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
162- echo "MSSQL is ready"
163- break
164- fi
165- echo "Waiting for MSSQL..."
166- sleep 3
167- 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;"
141+ # Create the test database
142+ /opt/mssql-tools18/bin/sqlcmd -S localhost -U SA -P "Passw0rd" -Q "CREATE DATABASE testdb;" -C
171143
172144 - name : Preview MSSQL schema changes
173145 uses : ./
174146 with :
175147 command : mssqldef
176148 version : latest
149+ config-file : examples/mssql.yaml
177150 baseline-schema-file : examples/mssqldef-current.sql
178151 schema-file : examples/mssqldef-desired.sql
179152 mssql-user : SA
180153 mssql-password : Passw0rd
181154 mssql-host : localhost
182155 mssql-port : 1433
183156 mssql-database : testdb
184-
185- - name : Stop MSSQL
186- if : always()
187- run : docker compose down mssql
157+ github-token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments