293 lines
9.6 KiB
YAML
293 lines
9.6 KiB
YAML
resources:
|
|
repositories:
|
|
- repository: release_tools
|
|
type: git
|
|
name: release-tools/release-tools
|
|
ref: refs/heads/master
|
|
|
|
pool:
|
|
vmImage: 'windows-latest'
|
|
|
|
variables:
|
|
- name: buildPlatform
|
|
value: 'Any CPU'
|
|
- name: buildConfiguration
|
|
value: 'Release'
|
|
- name: build.version.major
|
|
value: 1
|
|
- name: build.version.minor
|
|
value: 1
|
|
- name: build.version.revision
|
|
value: $[counter(format('{0}.{1}', variables['build.version.major'], variables['build.version.minor']), 0)]
|
|
- name: build.version.suffix
|
|
value:
|
|
- name: build.version
|
|
value: $(build.version.major).$(build.version.minor).$(build.version.revision)$(build.version.suffix)
|
|
- name: build.versionShort
|
|
value: $(build.version.major).$(build.version.minor).$(build.version.revision)
|
|
- name: build.date
|
|
value: $[format('{0:yyyy}-{0:MM}-{0:dd}T{0:HH}:{0:mm}:{0:ss}', pipeline.startTime)]
|
|
- name: azure.subscription
|
|
value: 'ProductionServices'
|
|
|
|
name: $(build.version.major).$(build.version.minor).$(build.version.revision)$(build.version.suffix)
|
|
|
|
# This pipeline is manual only. Repository pushes and pull requests must not start builds.
|
|
trigger: none
|
|
pr: none
|
|
|
|
stages:
|
|
- stage: test_provider
|
|
displayName: Test credential provider
|
|
dependsOn: []
|
|
jobs:
|
|
- job: test_windows
|
|
displayName: Test Windows
|
|
strategy:
|
|
matrix:
|
|
x64:
|
|
testArchitecture: x64
|
|
testImage: windows-latest
|
|
testProject: src/Lithnet.CredentialProvider.UnitTests.x64/Lithnet.CredentialProvider.UnitTests.x64.csproj
|
|
x86:
|
|
testArchitecture: x86
|
|
testImage: windows-latest
|
|
testProject: src/Lithnet.CredentialProvider.UnitTests.x86/Lithnet.CredentialProvider.UnitTests.x86.csproj
|
|
pool:
|
|
vmImage: $(testImage)
|
|
steps:
|
|
- task: UseDotNet@2
|
|
displayName: Install .NET 8 SDK
|
|
inputs:
|
|
packageType: sdk
|
|
version: 8.0.x
|
|
|
|
- task: UseDotNet@2
|
|
displayName: Install .NET 9 SDK
|
|
inputs:
|
|
packageType: sdk
|
|
version: 9.0.x
|
|
|
|
- task: UseDotNet@2
|
|
displayName: Install .NET 10 SDK
|
|
inputs:
|
|
packageType: sdk
|
|
version: 10.0.x
|
|
|
|
- task: PowerShell@2
|
|
displayName: Install x86 .NET runtimes
|
|
condition: eq(variables['testArchitecture'], 'x86')
|
|
inputs:
|
|
targetType: inline
|
|
script: |
|
|
$ErrorActionPreference = 'Stop'
|
|
$installScriptPath = "$(Agent.TempDirectory)\dotnet-install.ps1"
|
|
$runtimePath = "$(Agent.TempDirectory)\dotnet-x86"
|
|
|
|
Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -OutFile $installScriptPath
|
|
|
|
foreach ($channel in @('8.0', '9.0', '10.0'))
|
|
{
|
|
& $installScriptPath -Runtime dotnet -Channel $channel -Architecture x86 -InstallDir $runtimePath -NoPath
|
|
if (-not $?)
|
|
{
|
|
throw "Failed to install the .NET $channel x86 runtime"
|
|
}
|
|
}
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: Test $(testArchitecture)
|
|
env:
|
|
DOTNET_ROOT_X86: $(Agent.TempDirectory)\dotnet-x86
|
|
inputs:
|
|
command: test
|
|
projects: $(testProject)
|
|
arguments: '--configuration $(buildConfiguration) --arch $(testArchitecture)'
|
|
publishTestResults: true
|
|
testRunTitle: Credential Provider $(testArchitecture)
|
|
|
|
- template: templates/azure-vm-start.yaml@release_tools
|
|
parameters:
|
|
jobName: start_arm64_test_vm
|
|
vmNames: cpw1125a64-ci
|
|
deployEnvironment: CredentialProvider
|
|
distroType: win
|
|
resourceGroup: rg-ams-testhosts
|
|
azureSubscription: CredentialProviderAzureTestLab
|
|
agentMode: pool
|
|
targetPoolName: CredentialProvider
|
|
|
|
- job: test_windows_arm64
|
|
displayName: Test Windows ARM64
|
|
dependsOn: start_arm64_test_vm
|
|
pool:
|
|
name: CredentialProvider
|
|
demands:
|
|
- arch -equals arm64
|
|
- role -equals unittest
|
|
- product -equals credential-provider
|
|
steps:
|
|
- task: UseDotNet@2
|
|
displayName: Install .NET 8 SDK
|
|
inputs:
|
|
packageType: sdk
|
|
version: 8.0.x
|
|
|
|
- task: UseDotNet@2
|
|
displayName: Install .NET 9 SDK
|
|
inputs:
|
|
packageType: sdk
|
|
version: 9.0.x
|
|
|
|
- task: UseDotNet@2
|
|
displayName: Install .NET 10 SDK
|
|
inputs:
|
|
packageType: sdk
|
|
version: 10.0.x
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: Test ARM64
|
|
inputs:
|
|
command: test
|
|
projects: src/Lithnet.CredentialProvider.UnitTests.arm64/Lithnet.CredentialProvider.UnitTests.arm64.csproj
|
|
arguments: '--configuration $(buildConfiguration) --arch arm64'
|
|
publishTestResults: true
|
|
testRunTitle: Credential Provider ARM64
|
|
|
|
- template: templates/azure-vm-stop.yaml@release_tools
|
|
parameters:
|
|
jobName: stop_arm64_test_vm
|
|
vmNames: cpw1125a64-ci
|
|
deployEnvironment: CredentialProvider
|
|
distroType: win
|
|
resourceGroup: rg-ams-testhosts
|
|
azureSubscription: CredentialProviderAzureTestLab
|
|
dependsOn: test_windows_arm64
|
|
condition: always()
|
|
|
|
- stage: build_provider
|
|
displayName: Build credential provider
|
|
dependsOn: test_provider
|
|
jobs:
|
|
- job: "build_provider_job"
|
|
steps:
|
|
- template: templates/checkout.yaml@release_tools
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: dotnet build
|
|
inputs:
|
|
command: build
|
|
arguments: '-c $(buildConfiguration) -p:Version=$(build.version) -p:GeneratePackageOnBuild=false'
|
|
projects: 'src/Lithnet.CredentialProvider/Lithnet.CredentialProvider.csproj'
|
|
|
|
- template: templates/codesign.yaml@release_tools
|
|
parameters:
|
|
path:
|
|
- '$(Build.SourcesDirectory)/**/Lithnet.CredentialProvider.dll'
|
|
environment: 'prod'
|
|
azureSubscription: '$(azure.subscription)'
|
|
description: 'Lithnet Windows Credential Provider'
|
|
|
|
- task: DotNetCoreCLI@2
|
|
displayName: dotnet pack
|
|
inputs:
|
|
command: 'pack'
|
|
packagesToPack: 'src/Lithnet.CredentialProvider/Lithnet.CredentialProvider.csproj'
|
|
packDirectory: '$(Build.ArtifactStagingDirectory)\cp'
|
|
nobuild: true
|
|
includesymbols: true
|
|
versioningScheme: 'byEnvVar'
|
|
versionEnvVar: 'build.version'
|
|
|
|
- template: templates/codesign.yaml@release_tools
|
|
parameters:
|
|
path:
|
|
- '$(Build.ArtifactStagingDirectory)/cp/*.nupkg'
|
|
- '$(Build.ArtifactStagingDirectory)/cp/*.snupkg'
|
|
environment: 'prod'
|
|
azureSubscription: '$(azure.subscription)'
|
|
description: 'Lithnet Windows Credential Provider'
|
|
|
|
- task: PublishPipelineArtifact@1
|
|
displayName: Publish nuget artifact
|
|
inputs:
|
|
targetPath: '$(Build.ArtifactStagingDirectory)/cp'
|
|
publishLocation: 'pipeline'
|
|
artifact: cp
|
|
|
|
# Publish signed packages to Azure Artifacts only after the test and build stages succeed.
|
|
- stage: publish_internal
|
|
displayName: Publish to internal feed
|
|
dependsOn: build_provider
|
|
jobs:
|
|
- job: publish_internal_job
|
|
displayName: Publish packages to internal feed
|
|
steps:
|
|
- checkout: none
|
|
|
|
- download: current
|
|
artifact: cp
|
|
|
|
- template: templates/publish-nuget.yaml@release_tools
|
|
parameters:
|
|
nugetPackagePath: '$(Pipeline.Workspace)/cp/*.nupkg'
|
|
symbolPackagePath: '$(Pipeline.Workspace)/cp/*.snupkg'
|
|
publishInternal: true
|
|
publishExternal: false
|
|
|
|
# Public release is limited to main and waits for approval on the Public nuget feed environment.
|
|
- stage: publish_prod
|
|
displayName: Publish to nuget.org and GitHub
|
|
dependsOn: publish_internal
|
|
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'))
|
|
jobs:
|
|
- deployment: publish_nuget
|
|
displayName: Publish package to public nuget feed
|
|
environment: 'Public nuget feed'
|
|
pool:
|
|
vmImage: windows-2022
|
|
strategy:
|
|
runOnce:
|
|
deploy:
|
|
steps:
|
|
- checkout: none
|
|
|
|
- download: current
|
|
artifact: cp
|
|
|
|
- template: templates/publish-nuget.yaml@release_tools
|
|
parameters:
|
|
nugetPackagePath: '$(Pipeline.Workspace)/cp/*.nupkg'
|
|
publishInternal: false
|
|
publishExternal: true
|
|
externalFeedCredentials: 'WindowsCredentialProviderNuget'
|
|
|
|
# Create the GitHub release only after nuget.org accepts the package.
|
|
- job: publish_github
|
|
displayName: Publish package to GitHub releases
|
|
dependsOn: publish_nuget
|
|
condition: succeeded()
|
|
pool:
|
|
vmImage: windows-2022
|
|
steps:
|
|
- checkout: none
|
|
|
|
- download: current
|
|
artifact: cp
|
|
|
|
- task: GitHubRelease@1
|
|
displayName: Create GitHub release (v$(build.version))
|
|
inputs:
|
|
gitHubConnection: github.com_lithnet
|
|
repositoryName: '$(Build.Repository.Name)'
|
|
action: create
|
|
target: '$(Build.SourceVersion)'
|
|
tagSource: userSpecifiedTag
|
|
tag: v$(build.version)
|
|
title: v$(build.version)
|
|
assets: '$(Pipeline.Workspace)/cp/*.nupkg'
|
|
isPreRelease: false
|
|
addChangeLog: true
|
|
changeLogCompareToRelease: lastFullRelease
|
|
changeLogType: commitBased
|