diff --git a/.github/actions/setup-sql-server/Initialize-SqlServer.ps1 b/.github/actions/setup-sql-server/Initialize-SqlServer.ps1 index 2d69aad71..d90db5ce1 100644 --- a/.github/actions/setup-sql-server/Initialize-SqlServer.ps1 +++ b/.github/actions/setup-sql-server/Initialize-SqlServer.ps1 @@ -1,18 +1,25 @@ +param ( + [string]$sqlServerVersion = '2022' +) + if ($Env:RUNNER_OS -eq 'Windows') { - choco install sql-server-express --no-progress + choco install sql-server-$sqlServerVersion --no-progress } else { + $containerName = 'uitt-sqlserver' + $sqlServerLink = "mcr.microsoft.com/mssql/server:${sqlServerVersion}-latest" + $dockerRunSwitches = @( - '--name', 'sql2019' + '--name', $containerName '--env', 'ACCEPT_EULA=Y' '--env', 'SA_PASSWORD=Password1!' '--publish', '1433:1433' - '--detach', 'mcr.microsoft.com/mssql/server:2019-latest' + '--detach', $sqlServerLink ) - docker pull mcr.microsoft.com/mssql/server && + docker pull $sqlServerLink && docker run @dockerRunSwitches && - docker exec --user 0 sql2019 bash -c 'mkdir /data; chmod 777 /data --recursive; chown mssql:root /data' + docker exec --user 0 $containerName bash -c 'mkdir /data; chmod 777 /data --recursive; chown mssql:root /data' } diff --git a/.github/actions/setup-sql-server/Wait-SqlServer.ps1 b/.github/actions/setup-sql-server/Wait-SqlServer.ps1 index 61a26a968..61b6a57ff 100644 --- a/.github/actions/setup-sql-server/Wait-SqlServer.ps1 +++ b/.github/actions/setup-sql-server/Wait-SqlServer.ps1 @@ -6,7 +6,7 @@ for ($i = 1; $i -le $maxTryCount; $i++) if ($Env:RUNNER_OS -eq 'Windows') { - sqlcmd -b -S .\SQLEXPRESS -Q 'SELECT @@SERVERNAME as ServerName' 2>&1>$null + sqlcmd -b -Q 'SELECT @@SERVERNAME as ServerName' 2>&1>$null } else { diff --git a/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 b/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 index a5b9b79a0..5ba41527c 100644 --- a/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 +++ b/.github/actions/test-dotnet/Invoke-SolutionTests.ps1 @@ -16,13 +16,13 @@ $connectionStringSuffix = @( ) -join '' if ($Env:RUNNER_OS -eq 'Windows') { - $connectionStringStem = 'Server=.\SQLEXPRESS;Database=LombiqUITestingToolbox_{{id}};Integrated Security=True' + $connectionStringStem = 'Server=.;Database=LombiqUITestingToolbox_{{id}};Integrated Security=True' } else { $connectionStringStem = 'Server=.;Database=LombiqUITestingToolbox_{{id}};User Id=sa;Password=Password1!' - $Env:Lombiq_Tests_UI__DockerConfiguration__ContainerName = 'sql2019' + $Env:Lombiq_Tests_UI__DockerConfiguration__ContainerName = 'uitt-sqlserver' } $Env:Lombiq_Tests_UI__SqlServerDatabaseConfiguration__ConnectionStringTemplate = $connectionStringStem + $connectionStringSuffix