Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 87 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -180,17 +197,84 @@ 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
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
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: ${{ 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'
$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
}
# 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
}
- name: Upload SQL Server logs
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/
Expand Down