Test SQL Servers Matrix #1295
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test SQL Servers Matrix | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ "master" ] | |
| schedule: | |
| - cron: "15 4 * * *" | |
| defaults: | |
| run: | |
| shell: powershell | |
| jobs: | |
| Pre-Build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: dotnet build tests for SqlServerStorage and Jam | |
| shell: bash | |
| run: | | |
| set -eu; set -o pipefail | |
| script=https://raw.githubusercontent.com/devizer/test-and-build/master/install-build-tools-bundle.sh; (wget -q -nv --no-check-certificate -O - $script 2>/dev/null || curl -ksSL $script) | bash >/dev/null | |
| Say --Reset-Stopwatch | |
| Say "CPU: $(Get-CpuName)" | |
| bindir="${{ github.workspace }}/bin" | |
| Say "Build fx-dependent [https://github.com/devizer/Universe.SqlInsights].Tests" | |
| try-and-retry git clone https://github.com/devizer/Universe.SqlInsights ~/Universe.SqlInsights-Sources | |
| pushd ~/Universe.SqlInsights-Sources/src/Universe.SqlInsights.SqlServerStorage.Tests | |
| time try-and-retry dotnet publish -c Release -o "$bindir/Universe.SqlInsights.SqlServerStorage.Tests" -f net6.0 -v:m | |
| popd | |
| Say "Build fx-dependent [https://github.com/devizer/Universe.SqlServerJam].Tests" | |
| try-and-retry git clone https://github.com/devizer/Universe.SqlServerJam ~/Universe.SqlServerJam-Sources | |
| pushd ~/Universe.SqlServerJam-Sources/src/Universe.SqlServerJam.Tests | |
| time try-and-retry dotnet publish -c Release -o "$bindir/Universe.SqlServerJam.Tests" -f net6.0 -v:m | |
| popd | |
| Say "Build fx-dependent [https://github.com/devizer/Universe.SqlServer.AdministrativeViews]" | |
| try-and-retry git clone https://github.com/devizer/Universe.SqlServer.AdministrativeViews ~/Universe.SqlServer.AdministrativeViews-Sources | |
| pushd ~/Universe.SqlServer.AdministrativeViews-Sources/Universe.SqlServer.AdministrativeViews.CLI | |
| time try-and-retry dotnet publish -c Release -o "$bindir/Universe.SqlServer.AdministrativeViews.CLI" -f net6.0 -v:m | |
| popd | |
| ls -lah "$bindir" | |
| echo "bindir=[$bindir]" | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: 'Binaries' | |
| path: bin | |
| # path: "${{ runner.temp }}/Artifacts/**/**" | |
| Test: | |
| timeout-minutes: 120 | |
| needs: Pre-Build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| SqlServers: [ | |
| # '2022 Developer, 2008 Core, 2005 Core', | |
| '2008R2-x64 Core Update', | |
| '2008-x64 Core Update', | |
| '2005-x86 Core', | |
| '2008R2-x64 Developer Update', | |
| '2008-x64 Developer Update', | |
| # '2022 Developer, 2019 Developer, 2017 Developer, 2016 Developer', | |
| # '2022 Developer Update, 2019 Developer Update, 2017 Developer Update, 2016 Developer Update', | |
| '2025 Developer Update, 2022 Developer Update, 2019 Developer Update, 2017 Developer Update, 2016 Developer Update, 2014 Developer Update, 2012 Developer Update', | |
| '2025 Developer Update, 2022 Developer Update, 2019 Developer Update, 2017 Developer Update, 2016 Developer Update, 2014 Developer Update', | |
| # '2025 Developer Update, 2022 Developer Update, 2019 Developer Update, 2017 Developer Update, 2016 Developer Update', | |
| # '2025 Developer, 2022 Developer, 2019 Developer, 2017 Developer, 2016 Developer, 2014 Developer', | |
| '2025 Developer Update', | |
| '2025 Developer', | |
| '2025 Core', | |
| '2025 LocalDB', | |
| '2022 Developer Update', | |
| '2022 Developer', | |
| '2022 Advanced Update', | |
| '2022 Advanced', | |
| '2022 Core Update', | |
| '2022 Core', | |
| '2022 LocalDB', | |
| '2019 Developer Update', | |
| '2019 Developer', | |
| '2019 Advanced Update', | |
| '2019 Advanced', | |
| '2019 Core Update', | |
| '2019 Core', | |
| '2019 LocalDB', | |
| '2017 Developer Update', | |
| '2017 Developer', | |
| '2017 Advanced Update', | |
| '2017 Advanced', | |
| '2017 Core Update', | |
| '2017 Core', | |
| '2017 LocalDB', | |
| '2016 Developer Update', | |
| '2016 Developer', | |
| '2016 Advanced Update', | |
| '2016 Advanced', | |
| '2016 Core Update', | |
| '2016 Core', | |
| '2016 LocalDB', | |
| '2014-x64 Developer', | |
| '2014-x64 Advanced', | |
| '2014-x64 Core', | |
| '2014-x64 LocalDB', | |
| '2014-x86 Developer', | |
| '2014-x86 Advanced', | |
| '2014-x86 Core', | |
| # '2014-x86 LocalDB', | |
| '2012-x64 Developer', | |
| '2012-x64 Advanced', | |
| '2012-x64 Core', | |
| '2012-x86 Developer', | |
| '2012-x86 Advanced', | |
| '2012-x86 Core', | |
| '2012-x64 LocalDB', | |
| # '2012-x86 LocalDB', | |
| '2008R2-x64 Advanced Update', | |
| '2008R2-x64 Advanced', | |
| '2008R2-x64 Core Update', | |
| '2008R2-x86 Developer', | |
| '2008R2-x86 Advanced Update', | |
| '2008R2-x86 Advanced', | |
| '2008R2-x86 Core Update', | |
| '2008R2-x86 Core', | |
| '2008-x64 Developer Update', | |
| '2008-x64 Advanced Update', | |
| '2008-x64 Advanced', | |
| '2008-x64 Core Update', | |
| '2008-x86 Developer Update', | |
| '2008-x86 Developer', | |
| '2008-x86 Advanced Update', | |
| '2008-x86 Advanced', | |
| '2008-x86 Core Update', | |
| '2008-x86 Core', | |
| '2005-x86 Advanced Update', | |
| '2005-x86 Advanced' | |
| ] | |
| runs-on: windows-2022 | |
| env: | |
| PS1_TROUBLE_SHOOT: On | |
| SQLSERVERS_MEDIA_FOLDER: 'C:\Sql-Media' | |
| SQLSERVERS_SETUP_FOLDER: 'C:\Sql-Setup' | |
| DEBUG_LOG_FOLDER: 'C:\Artifacts' | |
| steps: | |
| - name: Bootstrap | |
| uses: devizer/devops-library@main | |
| - name: Probe Core Module | |
| shell: pwsh | |
| if: always() | |
| run: 'Import-DevOps; Write-Line -TextYellow "[$($PSVersionTable.PSEdition)] $((Get-Memory-Info).Description)"; Write-Line -TextYellow PSModulePath; $env:PSModulePath -split [IO.Path]::PathSeparator | Sort-Object | % { " $_" }; Write-Line -TextYellow ENVIRONMENT; Get-ChildItem Env: | Sort-Object Name | ForEach-Object { "$($_.Name)=$($_.Value)" };' | |
| - name: Probe Desktop Module | |
| shell: powershell | |
| if: always() | |
| run: 'Import-DevOps; Write-Line -TextYellow "[$($PSVersionTable.PSEdition)] $((Get-Memory-Info).Description)"; Write-Line -TextYellow PSModulePath; $env:PSModulePath -split [IO.Path]::PathSeparator | Sort-Object | % { " $_" }; Write-Line -TextYellow ENVIRONMENT; Get-ChildItem Env: | Sort-Object Name | ForEach-Object { "$($_.Name)=$($_.Value)" };' | |
| - name: List Available Modules | |
| if: always() | |
| run: 'Get-Module -ListAvailable | ft -autosize | out-string -width 1234' | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 888888 | |
| - name: Download Pre-Build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: 'C:\Pre-Build' | |
| merge-multiple: true # just one artifact | |
| name: Binaries | |
| # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild | |
| - name: Setup MSBuild.exe | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Uninstall LocalDB | |
| shell: powershell | |
| run: | | |
| Uninstall-LocalDB-List "*" | |
| cd C:\Pre-Build | |
| ls | |
| - name: Measure Install-Module | |
| if: ${{ false }} | |
| run: | | |
| Import-DevOps | |
| Measure-Action "Install SqlServer-Version-Management Module" { Install-Module SqlServer-Version-Management -Force } | |
| Say "List Available Modules" | |
| Get-Module -ListAvailable | ft -autosize | out-string -width 1234 | |
| - name: ANSI Colors {{ }} | |
| run: | | |
| powershell -f "Scripts\[Test] Ansi Colors.ps1" | |
| - name: .NET 6 | |
| shell: bash | |
| run: | | |
| taskkill //T //F //IM dotnet.exe || true | |
| Run-Remote-Script https://dot.net/v1/dotnet-install.ps1 -Channel "6.0" -Runtime aspnetcore -InstallDir "C:\Program Files\dotnet" | |
| - name: Show Env | |
| run: | | |
| Import-DevOps | |
| Say "CPU: $(Get-CPU-Name -IncludeCoreCount)" | |
| Write-Host "OS: $((Select-WMI-Objects Win32_OperatingSystem | select -Property Caption | Select -First 1).Caption)" | |
| function Header() { $esc=[char]27; Write-Host "$esc[45;1m $($args) $esc[m" } | |
| Header "(Get-Host).PrivateData" | |
| (Get-Host).PrivateData | |
| Header "`$PSVersionTable" | |
| $PSVersionTable | ft -AutoSize | |
| Header "PRE-INSTALLED SQL SERVERS" | |
| Select-WMI-Objects win32_service | where {$_.Name -Like "MSSQL`$*" } | Format-Table -AutoSize | Out-String -Width 1111 | |
| Header "`$PROFILE" | |
| echo "Profile is [$PROFILE]" | |
| Get-Content $PROFILE -EA Continue | |
| Header "PSModulePath Environment Variable" | |
| Write-Host "`$env:PSModulePath"; $modules="$env:PSModulePath".Split([System.IO.Path]::PathSeparator); $modules | % { if (Test-Path $_) { $dirs=@((new-object System.IO.DirectoryInfo($_)).GetDirectories() | % { $_.Name }); $dirsString = $dirs -join ", "; "Module Path [$_] $($dirs.Count) modules: $($dirsString)"; } else { "MODULE PATH [$_] ***MISSING***"; }}; Write-Host "`$PSHOME: [$PSHOME]" | |
| Header "Environment" | |
| & cmd.exe /c "set|sort" | |
| - name: 'TLS 1.1 Force' | |
| if: ${{ always() }} | |
| run: | | |
| New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client" -Force | |
| New-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server" -Force | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client" -Name "Enabled" -Value 1 -PropertyType "DWord" -Force | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client" -Name "DisabledByDefault" -Value 0 -PropertyType "DWord" -Force | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server" -Name "Enabled" -Value 1 -PropertyType "DWord" -Force | |
| New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server" -Name "DisabledByDefault" -Value 0 -PropertyType "DWord" -Force | |
| # TLS 1.0 Client | |
| $path = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client" | |
| if (-not (Test-Path $path)) { New-Item -Path $path -Force } | |
| New-ItemProperty -Path $path -Name "Enabled" -Value 1 -PropertyType DWord -Force | |
| New-ItemProperty -Path $path -Name "DisabledByDefault" -Value 0 -PropertyType DWord -Force | |
| # TLS 1.0 Server | |
| $path = "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server" | |
| if (-not (Test-Path $path)) { New-Item -Path $path -Force } | |
| New-ItemProperty -Path $path -Name "Enabled" -Value 1 -PropertyType DWord -Force | |
| New-ItemProperty -Path $path -Name "DisabledByDefault" -Value 0 -PropertyType DWord -Force | |
| - name: SQL In Container | |
| if: startsWith(matrix.SqlServers, '2005') || startsWith(matrix.SqlServers, '2008') | |
| run: | | |
| Import-DevOps | |
| $sql="${{ matrix.SqlServers }}: MSSQLSERVER" | |
| echo "SQL: '$sql'" | |
| Say "Pull devizervlad/iis-net4x-net35:ltsc2022" | |
| Try-And-Retry "Pull devizervlad/iis-net4x-net35:ltsc2022" { & docker pull devizervlad/iis-net4x-net35:ltsc2022 | out-host } | |
| Say "Starting container sql-server" | |
| New-item C:\SQL -ItemType Directory -Force -EA SilentlyContinue | Out-Null | |
| New-item C:\Temp -ItemType Directory -Force -EA SilentlyContinue | Out-Null | |
| cd SQL-Server-in-Windows-Container | |
| $mnt="type=bind,source=$(Get-Location),target=C:\App" | |
| echo "--mount parameter is: [$mnt]" | |
| & docker run -d --name sql-server --memory 4g --cpus 4 "--isolation=hyperv" --mount "$mnt" --mount type=bind,source=C:\SQL,target=C:\SQL --mount type=bind,source=C:\Temp,target=C:\Temp -e SQL="$sql" ` | |
| -e PS1_TROUBLE_SHOOT="On" -e SQLSERVERS_SETUP_FOLDER="C:\SQL-Setup" ` | |
| -p 1433:1433 -p 1434:1434 --workdir=C:\App --entrypoint powershell devizervlad/iis-net4x-net35:ltsc2022 -Command "Sleep 2147482; Wait-Event;" | |
| Say "Starting Setup in Container" | |
| & docker exec sql-server powershell -Command "cd C:\App; . .\Setup-SQL-Server-in-Container.ps1;" | | |
| tee-object "$ENV:SYSTEM_ARTIFACTSDIRECTORY/OUTPUT ${{ matrix.SqlServers }}.txt" | |
| [System.IO.File]::AppendAllText($env:GITHUB_ENV, "SQLSERVER_WELLKNOWN_In_Docker=Server=localhost,1433;User ID=sa; Password=Meaga`$tr0ng;Encrypt=False; TrustServerCertificate=True; `r`n") | |
| - name: SETUP Sql Server (Host) | |
| env: | |
| SQL_SERVERS: ${{ matrix.SqlServers }} | |
| uses: nick-fields/retry@v3 | |
| if: (!startsWith(matrix.SqlServers, '2005')) && (!startsWith(matrix.SqlServers, '2008')) | |
| with: | |
| timeout_minutes: 25 | |
| max_attempts: 3 | |
| shell: powershell | |
| retry_wait_seconds: 1 | |
| command: | | |
| # - name: Setup Sql Server | |
| # env: | |
| # SQL_SERVERS: ${{ matrix.SqlServers }} | |
| # run: | | |
| # Scripts\Setup-SqlServers.ps1 -SqlServers "$($ENV:SQL_SERVERS)" "Collation=French_CI_AI" "Startup=Manual" "InstallTo=C:\SQL-Customized" "EmptyKey=" "Password=Meaga`$tr0ng" "/SQLUSERDBDIR=D:\DB {InstanceName} Data" "/SQLUSERDBLOGDIR=C:\SQL LOGS {InstanceName}" "/SQLBACKUPDIR=C:\Backups for {InstanceName}" | |
| $ENV:PS1_TROUBLE_SHOOT = "On" | |
| $ENV:SQLSERVERS_MEDIA_FOLDER = "D:\SQL-SETUP\Media" | |
| $ENV:SQLSERVERS_SETUP_FOLDER = "C:\SQL-SETUP\Installer" | |
| & setx.exe PS1_TROUBLE_SHOOT On | |
| & setx.exe SQLSERVERS_MEDIA_FOLDER "$ENV:SQLSERVERS_MEDIA_FOLDER" | |
| & setx.exe SQLSERVERS_SETUP_FOLDER "$ENV:SQLSERVERS_SETUP_FOLDER" | |
| $tryList = @("FIRST", "SECOND") | |
| if ("${{ matrix.SqlServers }}" -match "LocalDB") { $tryList = @("FIRST and Single"); } | |
| Say "DISKS" | |
| Select-WMI-Objects "Win32_LogicalDisk" | Out-Host | |
| $diskD = Select-WMI-Objects "Win32_LogicalDisk" | ? { $_.DeviceId -eq "D:" } | Select -First 1 | |
| $installToDisk = if ($null -eq ($diskD)) { "C:" } else { "D:" } | |
| Write-Host "installToDisk = [$installToDisk]" | |
| foreach($t in $tryList) { | |
| Say "SETUP $t" | |
| Setup-SqlServers -SqlServers "${{ matrix.SqlServers }}" ` | |
| "Collation=French_CI_AI" ` | |
| "Startup=Automatic" ` | |
| "InstallTo=$($installToDisk)\SQL" ` | |
| "EmptyKey=" ` | |
| "Password=Meaga`$tr0ng" ` | |
| "/SQLUSERDBDIR=$($installToDisk)\DB-{InstanceName}-Data" ` | |
| "/SQLUSERDBLOGDIR=$($installToDisk)\SQL-LOGS-{InstanceName}" ` | |
| "/SQLBACKUPDIR=C:\Backups-for-{InstanceName}" | |
| } | |
| Write-Line "Starting SQL Server(s)" | |
| $localSqlServers = @(Find-Local-SqlServers | % {$_.Service}) | |
| if ($localSqlServers) { | |
| Write-Line -TextDarkGreen "START SERVICES: $localSqlServers" | |
| Get-Service -Name @($localSqlServers) | % { if ($_.Status -ne "Running") { Write-Host "Starting $($_.Name)"; Start-Service "$($_.Name)" }} | |
| } | |
| Write-Line -TextDarkGreen "Starting SQL Server(s)" | |
| $servers = Parse-SqlServers-Input "${{ matrix.SqlServers }}" | |
| $servers | ? { "$($_.InstanceName)" -ne "" } | % { | |
| $instance = $_.InstanceName; | |
| $version = $_.Version | |
| $i = IIf ($instance -eq "MSSQLSERVER") "(local)" "(local)\$($instance)" | |
| Say "Configure instance `"$instance`" Server=$i"; | |
| Set-SQLServer-Options -Title "Instance $instance" -Instance "$i" -Options @{ | |
| "Min Server Memory (MB)" = 8 * 1024; | |
| "Max Server Memory (MB)" = 128 * 1024; | |
| XP_CmdShell = $true; | |
| "CLR Enabled" = $true; | |
| "Server Trigger Recursion" = $true; | |
| }; | |
| if ($version -match "2005") { | |
| $serviceName = IIf ($instance -eq "MSSQLSERVER") "MSSQLSERVER" "MSSQL`$$($instance)" | |
| Say "Switch SQL Server 2005 to Local System account. Service is '$serviceName'" | |
| & net.exe stop "$serviceName" | |
| & sc.exe config "$serviceName" obj= LocalSystem | |
| & net.exe start "$serviceName" | |
| } | |
| $instanceFull = "$((Find-Local-SqlServers | Select -First 1).Instance)" | |
| if ($instanceFull -and "$($ENV:SQL_SERVERS)" -match "2022") { | |
| # Problem is specific for 2022 without CU and MOT | |
| $InstanceKey = $instanceFull.Split([char]'\')[1] | |
| $instancePath = "SQLSERVER:\SQL\$([Environment]::MachineName)\$InstanceKey" | |
| Say "Enable Always On for instance [$instanceFull]: >$instancePath<" | |
| try { Enable-SqlAlwaysOn -Force -Path $instancePath -EA SilentlyContinue; echo ok; } | |
| catch { echo $_.Exception; } | |
| } | |
| Say "Stress by Stored Procedures" | |
| Try-And-Retry "Download SQL Server Stress" { & curl.exe "-kfSL" "-o" "Stress-SQL-Server-by-Stored-Procedure.ps1" "https://raw.githubusercontent.com/devizer/Universe.SqlInsights/main/scripts/Stress-SQL-Server-by-Stored-Procedure.ps1" } | |
| $ENV:STRESS_CONNECTION_STRING="Encrypt=False;Data Source=$instanceFull;Integrated Security=SSPI;" | |
| .\Stress-SQL-Server-by-Stored-Procedure.ps1 | |
| Write-Host "$((Get-Memory-Info).Description)" | |
| } | |
| Say "Installed Versions" | |
| @(Find-Local-SqlServers) + @(Find-LocalDb-SqlServers) | ft -AutoSize | Out-String -Width 1234 | Out-Host | |
| Say "Query Versions" | |
| @(Find-Local-SqlServers) + @(Find-LocalDb-SqlServers) | Populate-Local-SqlServer-Version | Select -Property Instance, Version | ft -AutoSize | Out-String -Width 1234 | Out-Host | |
| @("$ENV:SQLSERVERS_MEDIA_FOLDER", "$ENV:SQLSERVERS_SETUP_FOLDER") | ? { "$_" } | % { Write-Host "Removing $_"; Remove-Item -Path "$_" -Recurse -Force -EA SilentlyContinue; } | |
| - name: Pack SQL Server Setup Logs | |
| if: always() | |
| shell: powershell | |
| run: | | |
| Import-DevOps | |
| Publish-SQLServer-SetupLogs "C:\Temp\SQL Server Setup Logs" | |
| - name: Show SQL Servers | |
| shell: pwsh | |
| if: always() | |
| run: | | |
| Import-DevOps | |
| Say "Installed Versions" | |
| @(Find-Local-SqlServers) + @(Find-LocalDb-SqlServers) | ft -AutoSize | Out-String -Width 1234 | Out-Host | |
| Say "Query Versions" | |
| @(Find-Local-SqlServers) + @(Find-LocalDb-SqlServers) | Populate-Local-SqlServer-Version | Select -Property Instance, Version | ft -AutoSize | Out-String -Width 1234 | Out-Host | |
| - name: Upload SQL Server Setup Logs artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: 'SQL Server Setup Logs ${{ matrix.SqlServers }}' | |
| path: | | |
| C:\Temp\SQL Server Setup Logs | |
| - name: SHOW SQL Servers | |
| env: | |
| SQL_SERVERS: ${{ matrix.SqlServers }} | |
| run: | | |
| $ENV:SYSTEM_ARTIFACTSDIRECTORY="C:\Temp" | |
| if (-not ("$($ENV:SQL_SERVERS)" -match "LocalDB")) { | |
| Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server Local DB\Installed Versions" -Recurse -Force -EA SilentlyContinue | |
| } | |
| cd Scripts | |
| & 7z.exe x LocalSqlDiscovery-net4.5.7z -oc:\Temp\ > $null | |
| cd c:\Temp\LocalSqlDiscovery-net4.5 | |
| $outputFile = "SHOW-SQL-Servers.log" | |
| & .\SHOW-SQL-Servers.cmd *| tee "$outputFile" | |
| $mediumVersion = Get-Content "$outputFile" | ? {$_ -match "Medium Version"} | % {$_.Split(":") | Select -Last 1} | |
| $mediumVersion = "$mediumVersion".Trim() | |
| $Utf8 = New-Object System.Text.UTF8Encoding $False | |
| $sqlDef = "{0,-33}" -f "$($ENV:SQL_SERVERS)" | |
| $mediumVersionFormatted = "{0,-77}" -f "$mediumVersion" | |
| [System.IO.File]::WriteAllLines("$($ENV:SYSTEM_ARTIFACTSDIRECTORY)\VERSION.LOG", "| $sqlDef | $mediumVersionFormatted |", $utf8) | |
| [System.IO.File]::WriteAllLines("$($ENV:SYSTEM_ARTIFACTSDIRECTORY)\Medium Version.txt", "$mediumVersion", $utf8) | |
| Get-WmiObject -class "Win32_PageFileUsage" -namespace "root\CIMV2" -computername localhost | Format-Table Caption, Name, PeakUsage, AllocatedBaseSize, CurrentUsage -AutoSize | Out-String -Width 256 | |
| echo "### SQL Medium Version: [$mediumVersion]" > $GITHUB_STEP_SUMMARY | |
| if ($mediumVersion) { $mediumVersion > "$($ENV:DEBUG_LOG_FOLDER)\Medium Version.txt"; } | |
| if (-not $mediumVersion) { throw "SQL Server [$($ENV:SQL_SERVERS)] is missing or not responding"; } | |
| # Put $mediumVersion into json file | |
| $jsonFile = "$($ENV:DEBUG_LOG_FOLDER)\SQL Setup Benchmark.json" | |
| $jsonString=[System.IO.File]::ReadAllText($jsonFile) | |
| $jsonObject = @($jsonString | ConvertFrom-Json) | Select -First 1 | |
| $jsonObject | Add-Member -MemberType NoteProperty -Name "MediumVersion" -Value $mediumVersion | |
| $jsonObject | ConvertTo-Json > "$jsonFile" | |
| - name: TEST JAM (latest) | |
| run: | | |
| cd C:\Pre-Build\Universe.SqlServerJam.Tests | |
| $ENV:SENSORSAPP_STRESS_DURATION="30000" | |
| dotnet test --filter "FullyQualifiedName !~ Z_Log & FullyQualifiedName !~ ShowAPI" Universe.SqlServerJam.Tests.dll | |
| if (-not $?) { throw "FAIL"; } | |
| - name: TEST SqlStorage of SqlInsights | |
| run: | | |
| $sqlServers = "${{ matrix.SqlServers }}"; | |
| if (($sqlServers -eq "2022 Core" -or $sqlServers -eq "2022 Advanced")) { | |
| $ENV:TESTS_FOR_MOT_DISABLED="True" | |
| Say "Disabling MOT Tests (weird behaviour) for [$sqlServers]" | |
| } | |
| $instance = "$((Find-Local-SqlServers | Select -First 1).Instance)" | |
| Say "INSTANCE: [$instance]" | |
| if (-not $instance) { exit 0; } | |
| $ENV:SQLINSIGHTS_CONNECTION_STRING="TrustServerCertificate=True;Data Source=lpc:$instance;Integrated Security=SSPI;Encrypt=false" | |
| Say "CONNECTION STRING: [$($ENV:SQLINSIGHTS_CONNECTION_STRING)]" | |
| $ENV:NUNIT_PIPELINE_KEEP_TEMP_TEST_DATABASES="True" | |
| $ENV:TEST_CONFIGURATION="DISK"; | |
| $ENV:TEST_CPU_NAME="$(Get-Cpu-Name)" | |
| cd C:\Pre-Build\Universe.SqlInsights.SqlServerStorage.Tests | |
| dotnet test Universe.SqlInsights.SqlServerStorage.Tests.dll | |
| - name: SHOW Administrative Views by Tool | |
| run: | | |
| $ENV:SQL_ADMINISTRATIVE_VIEWS_SUMMARY_1_Cpu_Title="CPU" | |
| $ENV:SQL_ADMINISTRATIVE_VIEWS_SUMMARY_1_Cpu_Kind="String" | |
| $ENV:SQL_ADMINISTRATIVE_VIEWS_SUMMARY_1_Cpu_Value="$(Get-Cpu-Name)" | |
| $ENV:SQL_ADMINISTRATIVE_VIEWS_SUMMARY_1_Cpu_Position="Header" | |
| & dotnet tool install --global SqlServer.AdministrativeViews | |
| & SqlServer.AdministrativeViews -h | |
| & SqlServer.AdministrativeViews -all -o "C:\Administrative Views\{InstanceName}" -av | |
| if (-not $?) { throw "Fail" } | |
| ls "C:\Administrative Views" | ft -AutoSize | Out-String -Width 1234 | Out-Host | |
| - name: SHOW Administrative Views by Source | |
| run: | | |
| $ENV:SQL_ADMINISTRATIVE_VIEWS_SUMMARY_1_Cpu_Title="CPU" | |
| $ENV:SQL_ADMINISTRATIVE_VIEWS_SUMMARY_1_Cpu_Kind="String" | |
| $ENV:SQL_ADMINISTRATIVE_VIEWS_SUMMARY_1_Cpu_Value="$(Get-Cpu-Name)" | |
| $ENV:SQL_ADMINISTRATIVE_VIEWS_SUMMARY_1_Cpu_Position="Header" | |
| cd C:\Pre-Build\Universe.SqlServer.AdministrativeViews.CLI | |
| & dotnet Universe.SqlServer.AdministrativeViews.CLI.dll -h | |
| & dotnet Universe.SqlServer.AdministrativeViews.CLI.dll -all -av -o "C:\Artifacts\Administrative Views Reports\{InstanceName}" | |
| Say "Done" | |
| - name: New SHOW SQL Servers | |
| env: | |
| SQL_SERVERS: ${{ matrix.SqlServers }} | |
| run: '& powershell -f "Scripts\[Test] SQL Discovery.ps1"; Test-Create-Delete-LocalDB-Instance' | |
| # it restarts sql server, so can be invoked after 'Show Query Cache Report' step | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: 'Summary ${{ matrix.SqlServers }}' | |
| path: | | |
| C:\Artifacts | |
| Combine: | |
| runs-on: windows-latest | |
| needs: Test | |
| if: always() | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Download all workflow run artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: 'C:\Artifacts' | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: 'Combined SQL Server Setup Summary' | |
| path: | | |
| C:\Artifacts | |