Skip to content

Conversation

@gargsaumya
Copy link
Contributor

@gargsaumya gargsaumya commented Dec 23, 2025

Work Item / Issue Reference

AB#40316

GitHub Issue: #<ISSUE_NUMBER>


Summary

This pull request updates the CI pipeline to add support for SQL Server 2025 in both Windows and macOS/Linux test jobs. The changes ensure that automated tests and performance benchmarks can run against SQL Server 2025 in addition to existing support for SQL Server 2022. Key updates include new installation steps, environment setup, and test execution for SQL Server 2025.

Windows Pipeline Enhancements:

  • Added a new matrix entry for SQLServer2025 to test against SQL Server 2025 with Python 3.13.
  • Implemented steps to download, install, and configure SQL Server 2025, including database and user setup. [1] [2]
  • Added test execution and performance benchmarking steps for SQL Server 2025, mirroring the existing SQL Server 2022 flow. [1] [2] [3]

macOS/Linux Pipeline Enhancements:

  • Expanded the matrix to include both SQL Server 2022 and 2025 Docker images for cross-platform testing.
  • Updated Docker commands and display names to dynamically use the selected SQL Server version from the matrix. [1] [2] [3]

Copilot AI review requested due to automatic review settings December 23, 2025 07:09
Write-Host "Waiting for SQL Server 2025 to start..."
while (-not $connected -and $attempt -lt $maxAttempts) {
try {
sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "SELECT 1" -C

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production
}
# Create database and user
sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE DATABASE TestDB" -C

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production
# Create database and user
sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE DATABASE TestDB" -C
sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE LOGIN testuser WITH PASSWORD = '$(DB_PASSWORD)'" -C

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production
# Create database and user
sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE DATABASE TestDB" -C
sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE LOGIN testuser WITH PASSWORD = '$(DB_PASSWORD)'" -C
sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -d TestDB -Q "CREATE USER testuser FOR LOGIN testuser" -C

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production
sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE DATABASE TestDB" -C
sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "CREATE LOGIN testuser WITH PASSWORD = '$(DB_PASSWORD)'" -C
sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -d TestDB -Q "CREATE USER testuser FOR LOGIN testuser" -C
sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -d TestDB -Q "ALTER ROLE db_owner ADD MEMBER testuser" -C

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production
displayName: 'Run tests with coverage on SQL Server 2025'
condition: eq(variables['sqlVersion'], 'SQL2025')
env:
DB_CONNECTION_STRING: 'Server=localhost;Database=TestDB;Uid=testuser;Pwd=$(DB_PASSWORD);TrustServerCertificate=yes'

Check notice

Code scanning / devskim

Accessing localhost could indicate debug code, or could hinder scaling. Note

Do not leave debug code in production
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds SQL Server 2025 support to the CI/CD testing pipeline, enabling automated tests and performance benchmarks to run against both SQL Server 2022 and SQL Server 2025. However, there is a critical issue where SQL Server 2022 benchmarking steps were replaced instead of being duplicated for SQL Server 2025.

Key Changes:

  • Added SQL Server 2025 matrix entry to Windows test job with installation, database setup, and test execution steps
  • Expanded macOS and Linux test matrices to include both SQL Server 2022 and 2025 Docker images
  • Updated benchmark configuration (though incorrectly removed SQL Server 2022 benchmarking)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 294 to +295
displayName: 'Download and restore AdventureWorks2022 database'
condition: eq(variables['sqlVersion'], 'SQL2022')
condition: eq(variables['sqlVersion'], 'SQL2025')
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AdventureWorks database download and restore step condition was changed from SQL2022 to SQL2025, which removes benchmarking capability for SQL Server 2022. Since the PR adds SQL Server 2025 support without removing SQL Server 2022, both versions should have their own benchmark steps. The condition should remain as SQL2022 for this step, and a separate identical step should be added for SQL2025.

Copilot uses AI. Check for mistakes.
pip install pyodbc
Write-Host "`nRunning performance benchmarks..."
python benchmarks/perf-benchmarking.py
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The performance benchmark step condition was changed from SQL2022 to SQL2025, which removes benchmarking capability for SQL Server 2022. Since the PR adds SQL Server 2025 support without removing SQL Server 2022, both versions should have their own benchmark steps. The condition should remain as SQL2022 for this step, and a separate identical step should be added for SQL2025.

Suggested change
python benchmarks/perf-benchmarking.py
python benchmarks/perf-benchmarking.py
displayName: 'Run performance benchmarks on SQL Server 2022'
condition: eq(variables['sqlVersion'], 'SQL2022')
continueOnError: true
env:
DB_CONNECTION_STRING: 'Server=localhost;Database=AdventureWorks2022;Uid=sa;Pwd=$(DB_PASSWORD);TrustServerCertificate=yes'
- powershell: |
Write-Host "Checking and installing ODBC Driver 18 for SQL Server..."
# Check if ODBC Driver 18 is registered in Windows registry
$odbcDriverKey = "HKLM:\SOFTWARE\ODBC\ODBCINST.INI\ODBC Driver 18 for SQL Server"
$driverExists = Test-Path $odbcDriverKey
if ($driverExists) {
Write-Host "✓ ODBC Driver 18 for SQL Server is already installed and registered"
$driverPath = (Get-ItemProperty -Path $odbcDriverKey -Name "Driver" -ErrorAction SilentlyContinue).Driver
if ($driverPath) {
Write-Host " Driver location: $driverPath"
}
} else {
Write-Host "ODBC Driver 18 for SQL Server is not installed. Installing now..."
# Ensure temp directory exists
$tempDir = "$env:TEMP\ODBCDriver18"
if (-Not (Test-Path $tempDir)) {
New-Item -ItemType Directory -Path $tempDir | Out-Null
}
$installerPath = "$tempDir\msodbcsql18.msi"
# Download ODBC Driver 18 installer if not already downloaded
if (-Not (Test-Path $installerPath)) {
Write-Host "Downloading ODBC Driver 18 installer..."
$downloadUrl = "https://go.microsoft.com/fwlink/?linkid=2249004"
Invoke-WebRequest -Uri $downloadUrl -OutFile $installerPath -UseBasicParsing
} else {
Write-Host "Installer already downloaded at $installerPath"
}
# Install ODBC Driver 18 silently
Write-Host "Installing ODBC Driver 18..."
$msiArgs = "/i `"$installerPath`" /qn IACCEPTMSODBCSQLLICENSETERMS=YES"
$process = Start-Process "msiexec.exe" -ArgumentList $msiArgs -Wait -PassThru
if ($process.ExitCode -eq 0) {
Write-Host "✓ ODBC Driver 18 installation completed successfully"
} else {
Write-Error "ODBC Driver 18 installation failed with exit code $($process.ExitCode)"
exit 1
}
}
# Verify presence of ODBC Driver 18 in the filesystem
Write-Host "`nVerifying ODBC Driver 18 files..."
$possiblePaths = @(
"C:\Program Files\Microsoft ODBC Driver 18 for SQL Server\msodbcsql18.dll",
"C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\msodbcsql18.dll"
)
$driverFound = $false
foreach ($path in $possiblePaths) {
if (Test-Path $path) {
Write-Host "✓ Found ODBC Driver 18 DLL at: $path"
$driverFound = $true
}
}
if (-Not $driverFound) {
Write-Host "ODBC Driver 18 DLL not found in default locations, but installation may still be valid."
}
# Final verification using registry
Write-Host "`nVerifying ODBC Driver 18 installation..."
$verifyKey = Test-Path "HKLM:\SOFTWARE\ODBC\ODBCINST.INI\ODBC Driver 18 for SQL Server"
if ($verifyKey) {
$driverInfo = Get-ItemProperty -Path "HKLM:\SOFTWARE\ODBC\ODBCINST.INI\ODBC Driver 18 for SQL Server" -ErrorAction SilentlyContinue
Write-Host "✓ SUCCESS: ODBC Driver 18 for SQL Server is registered"
Write-Host " Driver: $($driverInfo.Driver)"
Write-Host " Setup: $($driverInfo.Setup)"
} else {
Write-Error "ODBC Driver 18 for SQL Server is not registered in ODBC"
Write-Host "`nListing all installed ODBC drivers from registry:"
Get-ChildItem "HKLM:\SOFTWARE\ODBC\ODBCINST.INI" -ErrorAction SilentlyContinue | ForEach-Object { Write-Host " - $($_.PSChildName)" }
exit 1
}
Write-Host "`nInstalling pyodbc..."
pip install pyodbc
Write-Host "`nRunning performance benchmarks..."
python benchmarks/perf-benchmarking.py

Copilot uses AI. Check for mistakes.
condition: eq(variables['sqlVersion'], 'SQL2025')
env:
DB_CONNECTION_STRING: 'Server=localhost;Database=TestDB;Uid=testuser;Pwd=$(DB_PASSWORD);TrustServerCertificate=yes'
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment was updated to indicate SQL Server 2025, but this step's condition was changed from SQL2022 to SQL2025 (line 295). This suggests the original SQL Server 2022 benchmarking step was replaced rather than duplicated. The comment should be reverted to reference SQL Server 2022, and a separate step should be added for SQL Server 2025.

Suggested change
# Download and restore AdventureWorks2022 database for benchmarking on SQL Server 2022
- powershell: |
Write-Host "Downloading AdventureWorks2022.bak..."
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri "https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2022.bak" -OutFile "$env:TEMP\AdventureWorks2022.bak"
Write-Host "Restoring AdventureWorks2022 database..."
# Get the default data and log paths
$dataPath = sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "SET NOCOUNT ON; SELECT SERVERPROPERTY('InstanceDefaultDataPath') AS DataPath" -h -1 -C | Out-String
$logPath = sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -Q "SET NOCOUNT ON; SELECT SERVERPROPERTY('InstanceDefaultLogPath') AS LogPath" -h -1 -C | Out-String
$dataPath = $dataPath.Trim()
$logPath = $logPath.Trim()
Write-Host "Data path: $dataPath"
Write-Host "Log path: $logPath"
# Restore the database
sqlcmd -S "localhost" -U "sa" -P "$(DB_PASSWORD)" -C -Q @"
RESTORE DATABASE AdventureWorks2022
FROM DISK = '$env:TEMP\AdventureWorks2022.bak'
WITH
MOVE 'AdventureWorks2022' TO '${dataPath}AdventureWorks2022.mdf',
MOVE 'AdventureWorks2022_log' TO '${logPath}AdventureWorks2022_log.ldf',
REPLACE
"@
if ($LASTEXITCODE -eq 0) {
Write-Host "AdventureWorks2022 database restored successfully"
} else {
Write-Error "Failed to restore AdventureWorks2022 database"
exit 1
}
displayName: 'Download and restore AdventureWorks2022 database'
condition: eq(variables['sqlVersion'], 'SQL2022')
env:
DB_PASSWORD: $(DB_PASSWORD)

Copilot uses AI. Check for mistakes.
DB_PASSWORD: $(DB_PASSWORD)
# Run performance benchmarks on SQL Server 2022
# Run performance benchmarks on SQL Server 2025
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment was updated to indicate SQL Server 2025, but this step's condition was changed from SQL2022 to SQL2025 (line 388). This suggests the original SQL Server 2022 benchmarking step was replaced rather than duplicated. The comment should be reverted to reference SQL Server 2022, and a separate step should be added for SQL Server 2025.

Suggested change
# Run performance benchmarks on SQL Server 2025
# Run performance benchmarks on SQL Server 2022

Copilot uses AI. Check for mistakes.
@gargsaumya gargsaumya closed this Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant