@@ -72,18 +72,33 @@ jobs:
7272 # Each database provider runs independently to isolate failures and validate
7373 # database-specific persistence logic.
7474 test-sql-databases :
75- name : Test (Linux, ${{ matrix.db }})
75+ name : Test (Linux, ${{ matrix.tfm }})
7676 runs-on : ubuntu-latest
7777 strategy :
7878 fail-fast : false
7979 matrix :
80- db :
81- - postgresql
82- - mysql
83- - sqlite
84- - oracle
80+ # Run each modern TFM independently so failures are isolated and easy to read.
81+ tfm :
82+ - net8.0
83+ - net9.0
84+ - net10.0
8585
8686 services :
87+ sqlexpress :
88+ image : mcr.microsoft.com/mssql/server:2022-RTM-GDR1-ubuntu-20.04
89+ env :
90+ SA_PASSWORD : Password12!
91+ ACCEPT_EULA : Y
92+ MSSQL_PID : Express
93+ options : >-
94+ --health-cmd "/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U SA -P Password12! -Q 'SELECT 1' || /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P Password12! -Q 'SELECT 1'"
95+ --health-interval 10s
96+ --health-timeout 5s
97+ --health-retries 10
98+ --health-start-period 20s
99+ ports :
100+ - 1433:1433
101+
87102 postgresql :
88103 image : postgres:15-alpine
89104 env :
@@ -112,7 +127,7 @@ jobs:
112127 - 3306:3306
113128
114129 oracle :
115- image : gvenzl/oracle-xe:latest
130+ image : gvenzl/oracle-xe
116131 env :
117132 ORACLE_ALLOW_REMOTE : true
118133 ORACLE_PASSWORD : Password12!
@@ -125,6 +140,7 @@ jobs:
125140 - 1521:1521
126141
127142 env :
143+ NEventStore.MsSql : Server=localhost;Database=NEventStore;User Id=SA;Password=Password12!;TrustServerCertificate=True;
128144 NEventStore.PostgreSql : Server=localhost;Database=NEventStore;Uid=postgres;Pwd=Password12!;Enlist=false;
129145 NEventStore.MySql : Server=localhost;Database=NEventStore;Uid=root;Pwd=Password12!;AutoEnlist=false;
130146 NEventStore.Sqlite : Data Source=:memory:;Cache=Shared;
@@ -154,13 +170,39 @@ jobs:
154170 restore-keys : |
155171 nuget-${{ runner.os }}-
156172
157- - name : Run tests for ${{ matrix.db }}
158- run : dotnet test ./src/NEventStore.Persistence.Sql.Core.sln -c Release --logger "trx;LogFileName=test-results-${{ matrix.db }}.trx" --filter "Category=${{ matrix.db }}" 2>&1 || true
173+ - name : Create NEventStore database once SQL Server is healthy
174+ shell : bash
175+ run : |
176+ set -euo pipefail
177+
178+ container_id="$(/usr/bin/docker ps --filter "name=sqlexpress" --format "{{.ID}}" | head -n 1)"
179+ if [ -z "$container_id" ]; then
180+ echo "SQL Server service container not found."
181+ exit 1
182+ fi
183+
184+ for _ in {1..30}; do
185+ health_status="$(/usr/bin/docker inspect --format='{{.State.Health.Status}}' "$container_id" 2>/dev/null || echo starting)"
186+ if [ "$health_status" = "healthy" ]; then
187+ break
188+ fi
189+ sleep 2
190+ done
191+
192+ if [ "$health_status" != "healthy" ]; then
193+ echo "SQL Server container is not healthy."
194+ exit 1
195+ fi
196+
197+ /usr/bin/docker exec "$container_id" /opt/mssql-tools18/bin/sqlcmd -C -S localhost -U SA -P "Password12!" -Q "IF DB_ID(N'NEventStore') IS NULL CREATE DATABASE [NEventStore];"
198+
199+ - name : Run tests for ${{ matrix.tfm }}
200+ run : dotnet test ./src/NEventStore.Persistence.Sql.Core.sln -c Release -f ${{ matrix.tfm }} --logger "trx;LogFileName=test-results-${{ matrix.tfm }}.trx"
159201
160202 - name : Upload test results
161203 uses : actions/upload-artifact@v7
162204 with :
163- name : test-results-${{ matrix.db }}
164- path : " **/test-results-${{ matrix.db }}.trx"
205+ name : test-results-${{ matrix.tfm }}
206+ path : " **/test-results-${{ matrix.tfm }}.trx"
165207 if-no-files-found : ignore
166208 retention-days : 14
0 commit comments