WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 0d60dc4

Browse files
committed
separate stage
1 parent 7e16abb commit 0d60dc4

File tree

3 files changed

+62
-105
lines changed

3 files changed

+62
-105
lines changed

azure-pipelines/build-and-release.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ variables:
1313
value: '0'
1414

1515
stages:
16+
- stage: IntegrationTests
17+
jobs:
18+
- job: IntegrationTests
19+
pool:
20+
vmImage: 'ubuntu-latest'
21+
steps:
22+
- template: integration-tests.yml
23+
timeoutInMinutes: 60
24+
1625
- stage: Build
1726
variables:
1827
- name: buildConfiguration
@@ -32,4 +41,4 @@ stages:
3241
- ImageOverride -equals ADS-Windows_Image
3342
steps:
3443
- template: build.yml
35-
timeoutInMinutes: 90
44+
timeoutInMinutes: 90

azure-pipelines/build.yml

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -77,110 +77,6 @@ steps:
7777
displayName: 'CodeQL Initialize'
7878
condition: eq(variables['Codeql.enabled'], 'True')
7979

80-
- pwsh: |
81-
# setup docker image for SQL 2025
82-
83-
# Switch to Linux containers if currently on Windows
84-
$currentOs = docker version --format '{{.Server.Os}}'
85-
Write-Host "Current Docker OS: $currentOs"
86-
87-
if ($currentOs -match "windows") {
88-
Write-Host "Switching to Linux containers..."
89-
90-
$dockerCli = "DockerCli.exe"
91-
$found = $false
92-
93-
# Check PATH
94-
Write-Host "Checking for DockerCli.exe in PATH..."
95-
if (Get-Command $dockerCli -ErrorAction SilentlyContinue) {
96-
Write-Host "Found DockerCli.exe in PATH."
97-
$found = $true
98-
} else {
99-
Write-Host "DockerCli.exe not found in PATH."
100-
}
101-
102-
# Check standard installation path
103-
if (-not $found) {
104-
$standardPath = "C:\Program Files\Docker\Docker\DockerCli.exe"
105-
Write-Host "Checking for DockerCli.exe at: $standardPath"
106-
if (Test-Path $standardPath) {
107-
Write-Host "Found DockerCli.exe at $standardPath"
108-
$dockerCli = $standardPath
109-
$found = $true
110-
} else {
111-
Write-Host "DockerCli.exe not found at $standardPath"
112-
}
113-
}
114-
115-
# Check relative to docker.exe
116-
if (-not $found) {
117-
$dockerPath = (Get-Command docker).Source
118-
Write-Host "docker.exe found at: $dockerPath"
119-
$dockerDir = Split-Path $dockerPath
120-
121-
# Check same directory
122-
$sameDirPath = Join-Path $dockerDir "DockerCli.exe"
123-
Write-Host "Checking for DockerCli.exe at: $sameDirPath"
124-
if (Test-Path $sameDirPath) {
125-
Write-Host "Found DockerCli.exe at $sameDirPath"
126-
$dockerCli = $sameDirPath
127-
$found = $true
128-
}
129-
130-
# Check 2 levels up
131-
if (-not $found) {
132-
$potentialPath = Join-Path (Split-Path (Split-Path $dockerDir)) "DockerCli.exe"
133-
134-
Write-Host "Checking for DockerCli.exe at: $potentialPath"
135-
if (Test-Path $potentialPath) {
136-
Write-Host "Found DockerCli.exe at $potentialPath"
137-
$dockerCli = $potentialPath
138-
$found = $true
139-
} else {
140-
Write-Host "DockerCli.exe not found at $potentialPath"
141-
}
142-
}
143-
}
144-
145-
if ($found) {
146-
& $dockerCli -SwitchDaemon
147-
Start-Sleep -Seconds 10
148-
Write-Host "New Docker OS: $(docker version --format '{{.Server.Os}}')"
149-
} else {
150-
Write-Error "Could not find DockerCli.exe to switch to Linux containers."
151-
}
152-
}
153-
154-
# generate random password of 24 characters, save to a script variable
155-
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#%^&*()'
156-
$password = -join (1..24 | ForEach-Object { $chars[(Get-Random -Maximum $chars.Length)] })
157-
158-
# pull docker image for SQL 2025
159-
docker pull mcr.microsoft.com/mssql/server:2025-latest
160-
161-
# set up docker container for SQL 2025 using that password
162-
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=$password" -p 1433:1433 --name sql2025 -d mcr.microsoft.com/mssql/server:2025-latest
163-
164-
# Wait for SQL Server to be ready
165-
$start = Get-Date
166-
$timeout = New-TimeSpan -Seconds 60
167-
do {
168-
Start-Sleep -Seconds 2
169-
$logs = docker logs sql2025 2>&1
170-
if ($logs -match "SQL Server is now ready for client connections") {
171-
Write-Host "SQL Server is ready."
172-
break
173-
}
174-
if ((Get-Date) - $start -gt $timeout) {
175-
Write-Error "Timeout waiting for SQL Server to start."
176-
exit 1
177-
}
178-
} while ($true)
179-
180-
# Verify connection and print version
181-
docker exec sql2025 /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$password" -Q "SELECT @@VERSION"
182-
displayName: 'Setup Docker image for integration tests'
183-
18480
- task: BatchScript@1
18581
displayName: 'Run script build.cmd'
18682
inputs:
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
steps:
2+
- task: UseDotNet@2
3+
displayName: 'Use .NET sdk'
4+
inputs:
5+
useGlobalJson: true
6+
7+
- pwsh: |
8+
# setup docker image for SQL 2025
9+
# generate random password of 24 characters, save to a script variable
10+
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#%^&*()'
11+
$password = -join (1..24 | ForEach-Object { $chars[(Get-Random -Maximum $chars.Length)] })
12+
Write-Host "##vso[task.setvariable variable=SqlPassword;issecret=true]$password"
13+
14+
# pull docker image for SQL 2025
15+
docker pull mcr.microsoft.com/mssql/server:2025-latest
16+
17+
# set up docker container for SQL 2025 using that password
18+
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=$password" -p 1433:1433 --name sql2025 -d mcr.microsoft.com/mssql/server:2025-latest
19+
20+
# Wait for SQL Server to be ready
21+
$start = Get-Date
22+
$timeout = New-TimeSpan -Seconds 60
23+
do {
24+
Start-Sleep -Seconds 2
25+
$logs = docker logs sql2025 2>&1
26+
if ($logs -match "SQL Server is now ready for client connections") {
27+
Write-Host "SQL Server is ready."
28+
break
29+
}
30+
if ((Get-Date) - $start -gt $timeout) {
31+
Write-Error "Timeout waiting for SQL Server to start."
32+
exit 1
33+
}
34+
} while ($true)
35+
36+
# Verify connection and print version
37+
docker exec sql2025 /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P "$password" -Q "SELECT @@VERSION"
38+
displayName: 'Setup Docker image for integration tests'
39+
40+
- task: DotNetCoreCLI@2
41+
displayName: 'dotnet restore test/Microsoft.SqlTools.ServiceLayer.IntegrationTests'
42+
inputs:
43+
command: restore
44+
projects: test/Microsoft.SqlTools.ServiceLayer.IntegrationTests
45+
46+
- task: DotNetCoreCLI@2
47+
displayName: 'dotnet test test/Microsoft.SqlTools.ServiceLayer.IntegrationTests'
48+
inputs:
49+
command: test
50+
projects: test/Microsoft.SqlTools.ServiceLayer.IntegrationTests
51+
testRunTitle: SqlTools.ServiceLayer.IntegrationTests
52+
arguments: '--configuration $(buildConfiguration) --collect "XPlat Code Coverage"'

0 commit comments

Comments
 (0)