-
Notifications
You must be signed in to change notification settings - Fork 0
547 lines (461 loc) · 24.6 KB
/
setup-sqlservers.yml
File metadata and controls
547 lines (461 loc) · 24.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
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