Skip to content

Commit 8a5e797

Browse files
committed
Update CI workflows to use modern TFM for testing and adjust .NET version in pack-and-publish
1 parent 7db2192 commit 8a5e797

3 files changed

Lines changed: 54 additions & 13 deletions

File tree

.github/workflows/ci.yml

Lines changed: 53 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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

.github/workflows/pack-and-publish.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ jobs:
3434
uses: actions/setup-dotnet@v5
3535
with:
3636
dotnet-version: |
37-
6.0.x
3837
8.0.x
3938
9.0.x
4039
10.0.x

docker/docker-compose.ci.windows.db.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ services:
5656
oracle:
5757
container_name: nesci-oracle-1
5858
platform: linux
59-
image: gvenzl/oracle-xe:23
59+
image: gvenzl/oracle-xe
6060
restart: always
6161
environment:
6262
- ORACLE_ALLOW_REMOTE=true

0 commit comments

Comments
 (0)