Skip to content

Bump NUnit from 4.3.2 to 4.4.0 #53

Bump NUnit from 4.3.2 to 4.4.0

Bump NUnit from 4.3.2 to 4.4.0 #53

Workflow file for this run

name: Run DB Integration Tests
on:
workflow_dispatch:
push:
paths:
- 'DatabaseTests/**'
schedule:
- cron: '0 3 1 * *' # At 03:00 UTC on the 1st of every month
jobs:
db-tests:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: DatabaseTests
steps:
- uses: actions/checkout@v4
- name: Start SQL Server
run: |
#Prepare mount dir with limited access
mkdir init_output
chmod 700 init_output
docker run -d \
--name sql_server \
-e "ACCEPT_EULA=Y" \
-e "SA_PASSWORD=Password1" \
-v "./scripts:/scripts:ro" \
-v "./init_output:/init_output" \
-p 1433:1433 \
mcr.microsoft.com/mssql/server:2022-latest
- name: Wait for SQL Server to be ready
run: |
sql_ready=false
for i in {1..30}; do
docker exec sql_server /opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P Password1 -Q "SELECT 1" -C && {
sql_ready=true
break
}
echo "Waiting for SQL Server..."
sleep 2
done
echo
echo "******Summary****"
if [ "$sql_ready" = false ]; then
echo "❌ SQL Server is not responding after 30 attempts"
exit 1
fi
echo "✅ SQL Server is ready"
- name: Run DB init script
run: |
echo "📄 Running DB initialization script and capturing output..."
chmod 703 init_output
docker exec sql_server /opt/mssql-tools18/bin/sqlcmd \
-S localhost \
-U sa \
-P Password1 \
-i /scripts/CreateDbStructure.sql \
-o /init_output/output.txt \
-C
chmod 700 init_output
echo "📤 Output from sqlcmd:"
echo "────────────────────────────"
cat ./init_output/output.txt
echo "────────────────────────────"
echo "🔍 Checking for SQL errors..."
if grep -q "^Msg " ./init_output/output.txt; then
echo "❌ Database initialization script contains SQL errors"
exit 1
fi
echo "✅ Database initialization script executed successfully"
- name: Cache NuGet packages
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-db-tests-nuget-${{ hashFiles('DatabaseTests/DatabaseTestsAdoNet/DatabaseTestsAdoNet.csproj') }}
restore-keys: |
${{ runner.os }}-db-tests-nuget-
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore ./DatabaseTestsAdoNet
- name: Build
run: dotnet build ./DatabaseTestsAdoNet
- name: Run db tests
run: dotnet test --logger "console;verbosity=detailed" ./DatabaseTestsAdoNet
- name: Collect artifacts
if: always()
run: |
mkdir artifacts
echo "📥 Saving Docker logs from sql_server container..."
docker logs sql_server > artifacts/sql_server.log 2>&1 || echo "⚠️ Could not get docker logs"
echo "📥 Copying DB initialization output..."
if [ -f ./init_output/output.txt ]; then
cp ./init_output/output.txt artifacts/db_init_output.txt
else
echo "⚠️ DB init output not found" > artifacts/db_init_output.txt
fi
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: db-debug-artifacts
path: DatabaseTests/artifacts/