mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-13 17:23:02 -05:00
391 lines
13 KiB
YAML
391 lines
13 KiB
YAML
parameters:
|
|
- name: platforms
|
|
type: object
|
|
default:
|
|
- name: 'osx.10.11-x64'
|
|
displayName: 'osx'
|
|
archiveName: 'osx-x64'
|
|
archiveFileFormat: 'tar.gz'
|
|
archiveType: 'tar'
|
|
- name: 'osx-arm64'
|
|
displayName: 'osx arm'
|
|
archiveName: 'osx-arm64-unsigned'
|
|
archiveFileFormat: 'tar.gz'
|
|
archiveType: 'tar'
|
|
- name: 'rhel.7.2-x64'
|
|
displayName: 'rhel'
|
|
archiveName: 'rhel-x64'
|
|
archiveFileFormat: 'tar.gz'
|
|
archiveType: 'tar'
|
|
- name: 'win-x64'
|
|
displayName: 'Windows 64 bit'
|
|
archiveName: 'win-x64'
|
|
archiveFileFormat: 'zip'
|
|
archiveType: 'zip'
|
|
- name: 'win-x86'
|
|
displayName: 'Windows 32 bit'
|
|
archiveName: 'win-x86'
|
|
archiveFileFormat: 'zip'
|
|
archiveType: 'zip'
|
|
- name: 'win-arm64'
|
|
archiveName: 'win-arm64'
|
|
displayName: 'Windows ARM 64 bit'
|
|
archiveFileFormat: 'zip'
|
|
archiveType: 'zip'
|
|
- name: 'linux-arm64'
|
|
archiveName: 'linux-arm64'
|
|
displayName: 'Linux ARM 64 bit'
|
|
archiveFileFormat: 'tar.gz'
|
|
archiveType: 'tar'
|
|
- name: projects
|
|
type: object
|
|
default:
|
|
- 'Microsoft.SqlTools.ServiceLayer'
|
|
- 'Microsoft.SqlTools.Migration'
|
|
|
|
steps:
|
|
# .NET Core 2.1 SDK is installed for ESRP Code signing task,
|
|
# ESRP currently uses DLL from this path: ~\1.9.111\netcoreapp2.1\esrpcli.dll (found in logs)
|
|
# Can be removed once ESRP codesigning task gets an upgrade and a newer SDK DLL is used.
|
|
- task: UseDotNet@2
|
|
displayName: 'Use .NET Core 2 sdk'
|
|
inputs:
|
|
useGlobalJson: false
|
|
version: 2.x
|
|
|
|
- task: UseDotNet@2
|
|
displayName: 'Use defined .NET sdk'
|
|
inputs:
|
|
useGlobalJson: true
|
|
|
|
- task: PowerShell@2
|
|
displayName: 'Add version number to SqlCore project for packaging'
|
|
inputs:
|
|
targetType: 'inline'
|
|
script: |
|
|
$projectFile = '$(Build.SourcesDirectory)\src\Microsoft.SqlTools.SqlCore\Microsoft.SqlTools.SqlCore.csproj'
|
|
$props = New-Object XML
|
|
$props.Load($projectFile)
|
|
$version = ($(Major)).ToString() + '.' + ($(Minor)).ToString() + '.' + $(Patch) + $(Build.BuildNumber);
|
|
$props.Project.PropertyGroup.Version = $version;
|
|
$props.Save($projectFile)
|
|
|
|
- task: BatchScript@1
|
|
displayName: 'Run script build.cmd'
|
|
inputs:
|
|
filename: build.cmd
|
|
arguments: '-target=all -mono'
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: 'dotnet restore test/Microsoft.SqlTools.ServiceLayer.UnitTests'
|
|
inputs:
|
|
command: restore
|
|
projects: test/Microsoft.SqlTools.ServiceLayer.UnitTests
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: 'dotnet restore test/Microsoft.Kusto.ServiceLayer.UnitTests'
|
|
inputs:
|
|
command: restore
|
|
projects: test/Microsoft.Kusto.ServiceLayer.UnitTests
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: 'dotnet restore test/Microsoft.SqlTools.Authentication.UnitTests'
|
|
inputs:
|
|
command: restore
|
|
projects: test/Microsoft.SqlTools.Authentication.UnitTests
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: 'dotnet test test/Microsoft.SqlTools.ServiceLayer.UnitTests'
|
|
inputs:
|
|
command: test
|
|
projects: test/Microsoft.SqlTools.ServiceLayer.UnitTests
|
|
testRunTitle: SqlTools.ServiceLayer.UnitTests
|
|
arguments: '--configuration $(buildConfiguration) --collect "XPlat Code Coverage"'
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: 'dotnet test test/Microsoft.Kusto.ServiceLayer.UnitTests'
|
|
inputs:
|
|
command: test
|
|
projects: test/Microsoft.Kusto.ServiceLayer.UnitTests
|
|
testRunTitle: Kusto.ServiceLayer.UnitTests
|
|
arguments: '--configuration $(buildConfiguration) --collect "XPlat Code Coverage"'
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: 'dotnet test test/Microsoft.SqlTools.Authentication.UnitTests'
|
|
inputs:
|
|
command: test
|
|
projects: test/Microsoft.SqlTools.Authentication.UnitTests
|
|
testRunTitle: SqlTools.Authentication.UnitTests
|
|
arguments: '--configuration $(buildConfiguration) --collect "XPlat Code Coverage"'
|
|
|
|
- script: |
|
|
dotnet tool install -g dotnet-reportgenerator-globaltool
|
|
reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Agent.TempDirectory)/coverlet/reports -reporttypes:"Cobertura"
|
|
displayName: Create Code coverage report
|
|
|
|
- task: PublishCodeCoverageResults@1
|
|
displayName: 'Publish code coverage report'
|
|
inputs:
|
|
codeCoverageTool: 'Cobertura'
|
|
summaryFileLocation: '$(Agent.TempDirectory)/coverlet/reports/Cobertura.xml'
|
|
|
|
- task: PowerShell@2
|
|
displayName: 'Generate ManagedBatchParser Nuspec Version'
|
|
inputs:
|
|
targetType: 'inline'
|
|
script: |
|
|
$projectFile = '$(Build.SourcesDirectory)\src\Microsoft.SqlTools.ManagedBatchParser\Microsoft.SqlTools.ManagedBatchParser.csproj'
|
|
$props = New-Object XML
|
|
$props.Load($projectFile)
|
|
$propGroup = $props.Project.PropertyGroup;
|
|
$versionPre = $env:ManagedBatchParserMajor + '.' + $env:ManagedBatchParserMinor + '.'
|
|
if($env:StableRelease.Equals('true')) {
|
|
$version = $versionPre + '0';
|
|
} else {
|
|
$version = $versionPre + $(Build.BuildNumber) + '-' + $propGroup.VersionSuffix.'#text'
|
|
}
|
|
$nuspecFile = '$(Build.SourcesDirectory)\packages\Microsoft.SqlTools.ManagedBatchParser\Microsoft.SqlTools.ManagedBatchParser.nuspec'
|
|
$nuspec = New-Object XML
|
|
$nuspec.Load($nuspecFile)
|
|
$nuspec.package.metadata.version = $version;
|
|
$nuspec.Save($nuspecFile)
|
|
|
|
- task: Npm@1
|
|
displayName: 'npm install -g gulp-cli'
|
|
inputs:
|
|
command: custom
|
|
verbose: false
|
|
customCommand: 'install -g gulp-cli'
|
|
|
|
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
|
displayName: 'ESRP CodeSigning - SNK only'
|
|
inputs:
|
|
ConnectedServiceName: 'Code Signing'
|
|
FolderPath: '$(Build.SourcesDirectory)/artifacts/publish/Microsoft.SqlTools.ServiceLayer/default/net472/'
|
|
Pattern: 'Microsoft.SqlTools.ManagedBatchParser.dll'
|
|
signConfigType: inlineSignParams
|
|
inlineOperation: |
|
|
[
|
|
{
|
|
"KeyCode" : "CP-235847-SN",
|
|
"operationSetCode" : "StrongNameSign",
|
|
"Parameters" : [],
|
|
"ToolName" : "sign",
|
|
"ToolVersion" : "1.0"
|
|
},
|
|
{
|
|
"KeyCode" : "CP-235847-SN",
|
|
"operationSetCode" : "StrongNameVerify",
|
|
"Parameters" : [],
|
|
"ToolName" : "sign",
|
|
"ToolVersion" : "1.0"
|
|
}
|
|
]
|
|
SessionTimeout: 600
|
|
MaxConcurrency: 5
|
|
|
|
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
|
displayName: 'ESRP CodeSigning - sha256 only'
|
|
inputs:
|
|
ConnectedServiceName: 'Code Signing'
|
|
FolderPath: '$(Build.SourcesDirectory)/artifacts/publish'
|
|
Pattern: 'Microsoft.SqlTools.ManagedBatchParser.dll,MicrosoftSqlToolsCredentials.exe,MicrosoftSqlToolsServiceLayer.exe,SqlSerializationService.exe,SqlToolsResourceProviderService.exe,Microsoft.SqlTools.Hosting.dll,Microsoft.SqlTools.ResourceProvider.Core.dll,Microsoft.SqlTools.ResourceProvider.DefaultImpl.dll,MicrosoftSqlToolsCredentials.dll,MicrosoftSqlToolsServiceLayer.dll,Newtonsoft.Json.dll,SqlSerializationService.dll,SqlToolsResourceProviderService.dll,System.Data.SqlClient.dll,System.Net.Sockets.dll,MicrosoftSqlToolsMigration.exe,MicrosoftSqlToolsMigration.dll,Microsoft.SqlTools.SqlCore.dll'
|
|
signConfigType: inlineSignParams
|
|
inlineOperation: |
|
|
[
|
|
{
|
|
"keyCode": "CP-230012",
|
|
"operationSetCode": "SigntoolSign",
|
|
"parameters": [
|
|
{
|
|
"parameterName": "OpusName",
|
|
"parameterValue": "SQL Tools Service"
|
|
},
|
|
{
|
|
"parameterName": "OpusInfo",
|
|
"parameterValue": "https://github.com/microsoft/sqltoolsservice"
|
|
},
|
|
{
|
|
"parameterName": "PageHash",
|
|
"parameterValue": "/NPH"
|
|
},
|
|
{
|
|
"parameterName": "FileDigest",
|
|
"parameterValue": "/fd sha256"
|
|
},
|
|
{
|
|
"parameterName": "TimeStamp",
|
|
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
|
|
}
|
|
],
|
|
"toolName": "signtool.exe",
|
|
"toolVersion": "6.2.9304.0"
|
|
},
|
|
{
|
|
"keyCode": "CP-230012",
|
|
"operationSetCode": "SigntoolVerify",
|
|
"parameters": [
|
|
{
|
|
"parameterName": "VerifyAll",
|
|
"parameterValue": "/all"
|
|
}
|
|
],
|
|
"toolName": "signtool.exe",
|
|
"toolVersion": "6.2.9304.0"
|
|
}
|
|
]
|
|
SessionTimeout: 600
|
|
MaxConcurrency: 5
|
|
|
|
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
|
displayName: 'ESRP SqlCore CodeSigning - sha256 only'
|
|
inputs:
|
|
ConnectedServiceName: 'Code Signing'
|
|
FolderPath: '$(Build.SourcesDirectory)/src/Microsoft.SqlTools.SqlCore/bin/$(buildConfiguration)/netstandard2.0'
|
|
Pattern: 'Microsoft.SqlTools.*.dll'
|
|
signConfigType: inlineSignParams
|
|
inlineOperation: |
|
|
[
|
|
{
|
|
"keyCode": "CP-230012",
|
|
"operationSetCode": "SigntoolSign",
|
|
"parameters": [
|
|
{
|
|
"parameterName": "OpusName",
|
|
"parameterValue": "SQL Tools Service"
|
|
},
|
|
{
|
|
"parameterName": "OpusInfo",
|
|
"parameterValue": "https://github.com/microsoft/sqltoolsservice"
|
|
},
|
|
{
|
|
"parameterName": "PageHash",
|
|
"parameterValue": "/NPH"
|
|
},
|
|
{
|
|
"parameterName": "FileDigest",
|
|
"parameterValue": "/fd sha256"
|
|
},
|
|
{
|
|
"parameterName": "TimeStamp",
|
|
"parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
|
|
}
|
|
],
|
|
"toolName": "signtool.exe",
|
|
"toolVersion": "6.2.9304.0"
|
|
},
|
|
{
|
|
"keyCode": "CP-230012",
|
|
"operationSetCode": "SigntoolVerify",
|
|
"parameters": [
|
|
{
|
|
"parameterName": "VerifyAll",
|
|
"parameterValue": "/all"
|
|
}
|
|
],
|
|
"toolName": "signtool.exe",
|
|
"toolVersion": "6.2.9304.0"
|
|
}
|
|
]
|
|
SessionTimeout: 600
|
|
MaxConcurrency: 5
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: 'dotnet pack sqlcore'
|
|
inputs:
|
|
command: custom
|
|
custom: pack
|
|
arguments: '--output $(Build.SourcesDirectory)\artifacts\nugetPackages --no-build --configuration $(buildConfiguration) -v n src\Microsoft.SqlTools.SqlCore\Microsoft.SqlTools.SqlCore.csproj'
|
|
|
|
- task: BatchScript@1
|
|
displayName: 'Package nuspec projects'
|
|
inputs:
|
|
filename: build.cmd
|
|
arguments: '-target=DotnetPackNuspec -mono'
|
|
|
|
- task: BatchScript@1
|
|
displayName: "Build and Package service tool projects"
|
|
env:
|
|
BUILD_DOTNET_TOOL: "true"
|
|
inputs:
|
|
filename: build.cmd
|
|
arguments: "-target=dotnetpackservicetools -mono"
|
|
|
|
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
|
|
displayName: 'ESRP Code Signing - Nuget Package'
|
|
inputs:
|
|
ConnectedServiceName: 'Code Signing'
|
|
FolderPath: '$(Build.SourcesDirectory)/artifacts/nugetPackages'
|
|
Pattern: '*.nupkg'
|
|
signConfigType: 'inlineSignParams'
|
|
inlineOperation: |
|
|
[
|
|
{
|
|
"keyCode": "CP-401405",
|
|
"operationSetCode": "NuGetSign",
|
|
"parameters": [ ],
|
|
"toolName": "sign",
|
|
"toolVersion": "1.0"
|
|
},
|
|
{
|
|
"keyCode": "CP-401405",
|
|
"operationSetCode": "NuGetVerify",
|
|
"parameters": [ ],
|
|
"toolName": "sign",
|
|
"toolVersion": "1.0"
|
|
}
|
|
]
|
|
SessionTimeout: '60'
|
|
MaxConcurrency: '50'
|
|
MaxRetryAttempts: '5'
|
|
|
|
- ${{ each project in parameters.projects }}:
|
|
- ${{ each platform in parameters.platforms }}:
|
|
- task: ArchiveFiles@1
|
|
displayName: 'Archive ${{ platform.displayName }} ${{ project }} build'
|
|
inputs:
|
|
rootFolder: '$(Build.SourcesDirectory)/artifacts/publish/${{ project }}/${{ platform.name }}/net7.0'
|
|
includeRootFolder: false
|
|
archiveType: ${{ platform.archiveType }}
|
|
archiveFile: '$(Build.SourcesDirectory)/artifacts/package/${{ project }}-${{ platform.archiveName }}-net7.0.${{ platform.archiveFileFormat }}'
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: 'Publish Artifact: build archives'
|
|
inputs:
|
|
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/package'
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: 'Publish Artifact: nuget packages'
|
|
inputs:
|
|
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/nugetPackages'
|
|
ArtifactName: 'packages'
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: 'Publish Artifact: logs'
|
|
inputs:
|
|
PathtoPublish: '$(Build.SourcesDirectory)/artifacts/logs'
|
|
ArtifactName: 'logs'
|
|
condition: true
|
|
|
|
- task: NuGetCommand@2
|
|
displayName: 'NuGet push'
|
|
condition: eq(variables['PUSH_SYMBOLS'], 'true')
|
|
inputs:
|
|
command: push
|
|
packagesToPush: '$(Build.SourcesDirectory)/artifacts/nugetPackages/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
|
|
publishVstsFeed: '2191dd5f-4aec-491b-ac50-568bbc331c8a'
|
|
allowPackageConflicts: true
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: 'NuGet push SqlCore'
|
|
condition: eq(variables['RELEASE_SQLCORE'], 'true')
|
|
inputs:
|
|
command: push
|
|
packagesToPush: '$(Build.SourcesDirectory)/artifacts/nugetPackages/**/Microsoft.SqlTools.SqlCore.*.nupkg'
|
|
feedPublish: 'mssqltools'
|
|
allowPackageConflicts: true
|
|
|
|
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
|
|
displayName: 'Component Detection'
|
|
inputs:
|
|
failOnAlert: true |