From 5afaa0f3534536731614c6b9731a806ab17fe69e Mon Sep 17 00:00:00 2001 From: Dan Hensby Date: Fri, 20 Nov 2026 20:50:57 +0000 Subject: [PATCH 1/3] ci: check that the installed instance accepts the sa-password output over TCP When setup exits 0, the action only warns if the database doesn't become ready, and no step after it used the result. A change that broke the SA login or TCP would therefore leave CI green. Add a step after the action that logs in as sa over TCP with the sa-password output, retrying for about a minute. It checks that the instance-name output is MSSQLSERVER, that SQL Server reports the major version for the matrix entry and the default collation, and that the requested ODBC driver is registered. A failure here also uploads the SQL Server logs. The readiness check in the action uses `-S (local)`, which connects through shared memory, so it doesn't prove that TCP is enabled. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cd58440..c97a237 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -180,12 +180,65 @@ jobs: fsutil fsinfo sectorinfo "$($volume.DriveLetter):" } - name: Install sql server + id: install uses: ./ with: sqlserver-version: ${{ matrix.sqlserver }} native-client-version: 11 odbc-version: 17 install-updates: true + # the action only warns when the database isn't ready, so check that the instance it reports really works: + # log in over TCP with its sa-password output and compare what the server reports with what was asked for + - name: Check the installed instance + shell: pwsh + env: + # sqlcmd reads the password from SQLCMDPASSWORD, so it stays off the command line + SQLCMDPASSWORD: ${{ steps.install.outputs.sa-password }} + INSTANCE_NAME: ${{ steps.install.outputs.instance-name }} + SQLSERVER_VERSION: ${{ matrix.sqlserver }} + ODBC_VERSION: '17' + run: | + # handle failures here instead of stopping at the first error, so every check reports + $ErrorActionPreference = 'Continue' + $failed = $false + if ($env:INSTANCE_NAME -ne 'MSSQLSERVER') { + Write-Host "::error::The instance-name output is '$env:INSTANCE_NAME', expected 'MSSQLSERVER'" + $failed = $true + } + $query = "SET NOCOUNT ON; SELECT CAST(SERVERPROPERTY('ProductMajorVersion') AS nvarchar(128)), CAST(SERVERPROPERTY('ProductLevel') AS nvarchar(128)), ISNULL(CAST(SERVERPROPERTY('ProductUpdateLevel') AS nvarchar(128)), ''), CAST(SERVERPROPERTY('Collation') AS nvarchar(128))" + $row = $null + for ($attempt = 1; $attempt -le 12; $attempt++) { + $output = sqlcmd -S 'tcp:127.0.0.1,1433' -U sa -b -l 5 -h -1 -W -s '|' -Q $query 2>&1 + if ($LASTEXITCODE -eq 0) { + $row = $output | Where-Object { "$_" -match '\|' } | Select-Object -Last 1 + break + } + Write-Host "Login attempt $attempt over TCP failed: $output" + Start-Sleep -Seconds 5 + } + if (-not $row) { + Write-Host "::error::Could not log in as sa over TCP with the sa-password output" + exit 1 + } + $major, $level, $updateLevel, $collation = "$row".Trim().Split('|') + Write-Host "SQL Server major version $major, level $level, update level '$updateLevel', collation $collation" + $expectedMajor = @{ 'sql-latest' = '17'; 'sql-2025' = '17'; 'sql-2022' = '16'; 'sql-2019' = '15'; 'sql-2017' = '14'; 'sql-2016' = '13' }[$env:SQLSERVER_VERSION] + if ($major -ne $expectedMajor) { + Write-Host "::error::SQL Server reports major version $major, expected $expectedMajor for $env:SQLSERVER_VERSION" + $failed = $true + } + if ($collation -ne 'SQL_Latin1_General_CP1_CI_AS') { + Write-Host "::error::SQL Server reports collation $collation, expected the default SQL_Latin1_General_CP1_CI_AS" + $failed = $true + } + $driver = "ODBC Driver $env:ODBC_VERSION for SQL Server" + if (-not (Test-Path "HKLM:\SOFTWARE\ODBC\ODBCINST.INI\$driver")) { + Write-Host "::error::$driver is not registered" + $failed = $true + } + if ($failed) { + exit 1 + } - name: Upload SQL Server logs if: failure() uses: actions/upload-artifact@v7 From 54356c4877b63cf431d4ceb07a7b0ccb61e70810 Mon Sep 17 00:00:00 2001 From: Dan Hensby Date: Fri, 20 Nov 2026 20:51:17 +0000 Subject: [PATCH 2/3] ci: warn when the installed update level doesn't match install-updates A failed cumulative update download is only a warning in the action, so a change that always skipped the update would leave CI green. After the login check, compare the level that SQL Server reports with install-updates. 2016 is updated with a service pack, so expect a level above SP2. The other versions are updated with a cumulative update, so expect a CU update level. Write a warning when they don't match, in either direction. It is only a warning, because a Microsoft download outage makes the action install without updates, and that shouldn't fail unrelated changes. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c97a237..505ef04 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -197,6 +197,7 @@ jobs: INSTANCE_NAME: ${{ steps.install.outputs.instance-name }} SQLSERVER_VERSION: ${{ matrix.sqlserver }} ODBC_VERSION: '17' + INSTALL_UPDATES: 'true' run: | # handle failures here instead of stopping at the first error, so every check reports $ErrorActionPreference = 'Continue' @@ -236,6 +237,18 @@ jobs: Write-Host "::error::$driver is not registered" $failed = $true } + # only warn about the update level: a Microsoft download outage makes the action install without updates, + # and that shouldn't fail unrelated changes. 2016 is updated with a service pack, the others with a CU. + if ($major -eq '13') { + $updated = $level -ne 'SP2' + } else { + $updated = $updateLevel -like 'CU*' + } + if ($env:INSTALL_UPDATES -eq 'true' -and -not $updated) { + Write-Host "::warning::install-updates is true, but SQL Server reports level $level and update level '$updateLevel'" + } elseif ($env:INSTALL_UPDATES -ne 'true' -and $updated) { + Write-Host "::warning::install-updates is false, but SQL Server reports level $level and update level '$updateLevel'" + } if ($failed) { exit 1 } From 3fedebff37f73261f98ae57a05a23e98eafdbbe3 Mon Sep 17 00:00:00 2001 From: Dan Hensby Date: Fri, 20 Nov 2026 20:52:05 +0000 Subject: [PATCH 3/3] ci: run the action with ODBC 18, without the readiness check and without updates Every runaction job used the same inputs, so CI never ran the action with ODBC 18, with the readiness check turned off or with updates turned off. Add three jobs, each changing one input: ODBC 18 with SQL Server 2022 on windows-2025, wait-for-ready set to false with the latest version on windows-2025 (which also runs the reboot-requested path without the readiness check), and install-updates set to false with 2019 on windows-2022. A new matrix key, variant, is empty for the existing jobs, so each include entry adds a job instead of changing one, and the existing job names stay the same. The check step reads the same inputs, and the log artifact name includes the variant so that the names stay unique. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 505ef04..cdc7d57 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -151,6 +151,23 @@ jobs: matrix: os: [ 'windows-2022', 'windows-2025' ] sqlserver: [ 'sql-latest', 'sql-2025', 'sql-2022', 'sql-2019', 'sql-2017', 'sql-2016' ] + # the jobs above use the default inputs; each entry below sets its own variant, so it adds a separate job + # that changes one input (quote the values: an unquoted false would fall back to the default below) + variant: [ '' ] + include: + - os: windows-2025 + sqlserver: sql-2022 + variant: odbc-18 + odbc-version: '18' + - os: windows-2025 + sqlserver: sql-latest + variant: no-wait + wait-for-ready: 'false' + - os: windows-2022 + sqlserver: sql-2019 + variant: no-updates + install-updates: 'false' + name: runaction (${{ matrix.os }}, ${{ matrix.sqlserver }}${{ matrix.variant && format(', {0}', matrix.variant) || '' }}) runs-on: ${{ matrix.os }} timeout-minutes: 30 steps: @@ -185,8 +202,9 @@ jobs: with: sqlserver-version: ${{ matrix.sqlserver }} native-client-version: 11 - odbc-version: 17 - install-updates: true + odbc-version: ${{ matrix.odbc-version || '17' }} + install-updates: ${{ matrix.install-updates || 'true' }} + wait-for-ready: ${{ matrix.wait-for-ready || 'true' }} # the action only warns when the database isn't ready, so check that the instance it reports really works: # log in over TCP with its sa-password output and compare what the server reports with what was asked for - name: Check the installed instance @@ -196,8 +214,8 @@ jobs: SQLCMDPASSWORD: ${{ steps.install.outputs.sa-password }} INSTANCE_NAME: ${{ steps.install.outputs.instance-name }} SQLSERVER_VERSION: ${{ matrix.sqlserver }} - ODBC_VERSION: '17' - INSTALL_UPDATES: 'true' + ODBC_VERSION: ${{ matrix.odbc-version || '17' }} + INSTALL_UPDATES: ${{ matrix.install-updates || 'true' }} run: | # handle failures here instead of stopping at the first error, so every check reports $ErrorActionPreference = 'Continue' @@ -256,7 +274,7 @@ jobs: if: failure() uses: actions/upload-artifact@v7 with: - name: sqlserver-logs-${{ matrix.os }}-${{ matrix.sqlserver }}-${{ github.run_attempt }} + name: sqlserver-logs-${{ matrix.os }}-${{ matrix.sqlserver }}${{ matrix.variant && format('-{0}', matrix.variant) || '' }}-${{ github.run_attempt }} path: | C:/Program Files/Microsoft SQL Server/*/Setup Bootstrap/Log/ C:/Program Files/Microsoft SQL Server/MSSQL*/MSSQL/Log/