reactive/azure-pipelines.rx.yml

302 строки
9.2 KiB
YAML

trigger:
branches:
include:
- main
- rel/*
paths:
include:
- Rx.NET/Source/*
- .editorconfig
- azure-pipelines.rx.yml
pr:
branches:
include:
- main
- rel/*
paths:
include:
- Rx.NET/Source/*
- .editorconfig
- azure-pipelines.rx.yml
stages:
- stage: Build
jobs:
- job: Build
pool:
vmImage: windows-latest
variables:
BuildConfiguration: Release
BuildPlatform: Any CPU
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
steps:
- task: UseDotNet@2
displayName: Use .NET 8.0.x SDK
inputs:
version: 8.0.x
performMultiLevelLookup: true
# We need .NET 7.0 and 6.0 to be able to run all tests.
# For .NET 7.0, the runtime package is sufficient because we don't need to build anything.
# That doesn't work for 6.0, because we need the desktop framework, and the only way to
# get that into a build agent seems to be to install the SDK.
- task: UseDotNet@2
displayName: Use .NET 7.0 runtime
inputs:
version: '7.0.x'
packageType: runtime
- task: UseDotNet@2
displayName: Use .NET 6.0 SDK
inputs:
version: '6.0.x'
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . nbgv
displayName: Install NBGV tool
- script: nbgv cloud -a -p Rx.NET/Source
displayName: Set Version
- task: MSBuild@1
displayName: Build System.Reactive.sln
inputs:
solution: Rx.NET/Source/System.Reactive.sln
msbuildArguments: /restore /t:build /p:CreatePackage=true /p:NoPackageAnalysis=true /p:PackageOutputPath=$(Build.ArtifactStagingDirectory)\artifacts
configuration: $(BuildConfiguration)
maximumCpuCount: false
- task: NuGetCommand@2
displayName: Pack compatibility package
inputs:
command: custom
arguments: pack Rx.NET/Source/facades/System.Reactive.Compatibility.nuspec -Version $(NBGV_NuGetPackageVersion) -MinClientVersion 2.12 -NoPackageAnalysis -outputdirectory $(Build.ArtifactStagingDirectory)\artifacts
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . dotnet-reportgenerator-globaltool
displayName: Install ReportGenerator tool
- task: DotNetCoreCLI@2
inputs:
command: test
projects: Rx.NET/Source/tests/Tests.System.Reactive/*.csproj
arguments: -c $(BuildConfiguration) --filter "TestCategory!=SkipCI" --settings Rx.NET/Source/CodeCoverage.runsettings --collect:"XPlat Code Coverage" -- RunConfiguration.DisableAppDomain=true
displayName: Run Unit Tests
- task: DotNetCoreCLI@2
inputs:
command: test
projects: Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Tests.System.Reactive.ApiApprovals.csproj
arguments: -c $(BuildConfiguration)
displayName: Run Api Approvals Tests
- script: reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/Rx.NET/Source/coverlet/reports -reporttypes:"Cobertura"
displayName: Create reports
- task: PublishCodeCoverageResults@1
displayName: 'Publish code coverage'
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(Build.SourcesDirectory)/Rx.NET/Source/coverlet/reports/Cobertura.xml
- publish: Rx.NET/Source/build
artifact: config
displayName: Publish signing config
- publish: $(Build.ArtifactStagingDirectory)\artifacts
displayName: Publish artifacts
artifact: BuildPackages
- publish: Rx.NET/Source/tests/Tests.System.Reactive.ApiApprovals/Api
displayName: Publish test artifiacts
artifact: ApprovalsTests
condition: always()
- stage: IntegrationTests
jobs:
- job: Linux
pool:
vmImage: ubuntu-latest
variables:
BuildConfiguration: Release
BuildPlatform: Any CPU
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
steps:
- task: UseDotNet@2
inputs:
version: 8.0.x
- task: UseDotNet@2
displayName: Use .NET 7.0 SDK
inputs:
version: '7.0.x'
packageType: runtime
- task: UseDotNet@2
displayName: Use .NET 6.0 SDK
inputs:
version: '6.0.x'
packageType: runtime
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . nbgv
displayName: Install NBGV tool
- script: ./nbgv cloud -a -p Rx.NET/Source
displayName: Set Version
- task: DownloadPipelineArtifact@2
displayName: Download Build Artifacts
inputs:
artifactName: BuildPackages
targetPath: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LocalPackages
- task: DotNetCoreCLI@2
displayName: Update Rx
inputs:
command: custom
projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LinuxTests/LinuxTests.csproj
custom: restore
arguments: --configfile $(System.DefaultWorkingDirectory)/Rx.NET/Integration/NuGet.Config
- task: DotNetCoreCLI@2
inputs:
command: test
projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LinuxTests/LinuxTests.csproj
arguments: -c $(BuildConfiguration) -f net8.0 --filter "TestCategory!=SkipCI"
displayName: Run 8.0 Tests on Linux
- task: DotNetCoreCLI@2
inputs:
command: test
projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LinuxTests/LinuxTests.csproj
arguments: -c $(BuildConfiguration) -f net7.0 --filter "TestCategory!=SkipCI"
displayName: Run 7.0 Tests on Linux
- task: DotNetCoreCLI@2
inputs:
command: test
projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LinuxTests/LinuxTests.csproj
arguments: -c $(BuildConfiguration) -f net6.0 --filter "TestCategory!=SkipCI"
displayName: Run 6.0 Tests on Linux
- job: WindowsDesktop
pool:
vmImage: windows-latest
variables:
BuildConfiguration: Release
BuildPlatform: Any CPU
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
steps:
- task: UseDotNet@2
inputs:
version: 8.0.x
performMultiLevelLookup: true
- task: UseDotNet@2
displayName: Use .NET 7.0 SDK
inputs:
version: '7.0.x'
- task: UseDotNet@2
displayName: Use .NET 6.0 SDK
inputs:
version: '6.0.x'
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . nbgv
displayName: Install NBGV tool
- script: nbgv cloud -a -p Rx.NET/Source
displayName: Set Version
- task: DownloadPipelineArtifact@2
displayName: Download Build Artifacts
inputs:
artifactName: BuildPackages
targetPath: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/LocalPackages
- task: DotNetCoreCLI@2
displayName: Update Rx
inputs:
command: custom
projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/WindowsDesktopTests/WindowsDesktopTests.csproj
custom: restore
arguments: --configfile $(System.DefaultWorkingDirectory)/Rx.NET/Integration/NuGet.Config
- task: DotNetCoreCLI@2
inputs:
command: test
projects: $(System.DefaultWorkingDirectory)/Rx.NET/Integration/WindowsDesktopTests/WindowsDesktopTests.csproj
arguments: -c $(BuildConfiguration) --filter "TestCategory!=SkipCI"
displayName: Run Tests on Window Desktop
- stage: CodeSign
condition: and(succeeded('IntegrationTests'), not(eq(variables['build.reason'], 'PullRequest')))
jobs:
- deployment: CodeSign
displayName: Code Signing
pool:
vmImage: windows-latest
environment: Code Sign
variables:
- group: SignClient Credentials
strategy:
runOnce:
deploy:
steps:
- task: UseDotNet@2
displayName: Use .NET 8.0.x SDK
inputs:
version: 8.0.x
performMultiLevelLookup: true
- task: DotNetCoreCLI@2
displayName: Install SignTool tool
inputs:
command: custom
custom: tool
arguments: install --tool-path . sign --version 0.9.1-beta.24406.1
# Run the signing command
- task: AzureCLI@2
inputs:
azureSubscription: 'Rx.NET Sign Service Connection'
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
.\sign code azure-key-vault `
"**/*.nupkg" `
--base-directory "$(Pipeline.Workspace)\BuildPackages" `
--publisher-name "Reactive Extensions for .NET (.NET Foundation)" `
--description "Rx.NET" `
--description-url "https://github.com/dotnet/reactive" `
--azure-key-vault-url "$(SignKeyVaultUrl)" `
--azure-key-vault-certificate "$(SignKeyVaultCertificateName)"
displayName: Sign packages
- publish: $(Pipeline.Workspace)/BuildPackages
displayName: Publish Signed Packages
artifact: SignedPackages