Merge build pipelines

pull/524/head
NextTurn 2019-11-23 00:00:00 +08:00
parent 5881e8eccd
commit 68415dfbe9
No known key found for this signature in database
GPG Key ID: 17A0D50ADDE1A0C4
3 changed files with 81 additions and 141 deletions

View File

@ -1,3 +1,5 @@
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
name: $(Major).$(Minor).$(Patch).$(Revision)
trigger:
@ -10,46 +12,85 @@ variables:
- group: Version
- name: Revision
value: $[counter(format('{0}.{1}.{2}', variables.Major, variables.Minor, variables.Patch), 1)]
- name: AssemblyVersion
- name: BuildVersion
value: $(Major).$(Minor).$(Patch)
- name: PackageVersion
value: $(Major).$(Minor).$(Patch).$(Revision)
- name: InformationalVersion # do not rename (MSBuild property)
value: $(Major).$(Minor).$(Patch)+$(Build.SourceVersion)
jobs:
- template: template.yml
parameters:
strategy:
matrix:
Debug:
BuildConfiguration: Debug
Release:
BuildConfiguration: Release
artifacts:
- displayName: Publish .NET 2.0
inputs:
Path: artifacts\WinSW.NET2.exe
Name: WinSW.NET2.exe_$(BuildConfiguration)
- displayName: Publish .NET 4.0
inputs:
Path: artifacts\WinSW.NET4.exe
Name: WinSW.NET4.exe_$(BuildConfiguration)
- displayName: Publish .NET 4.6.1
inputs:
Path: artifacts\WinSW.NET461.exe
Name: WinSW.NET461.exe_$(BuildConfiguration)
- displayName: Publish .NET Core 3.1
inputs:
Path: artifacts\WinSW.NETCore31.zip
Name: WinSW.NETCore31.zip_$(BuildConfiguration)
- displayName: Publish .NET Core 3.1 x64
inputs:
Path: artifacts\WinSW.NETCore31.x64.exe
Name: WinSW.NETCore31.x64.exe_$(BuildConfiguration)
- displayName: Publish .NET Core 3.1 x86
inputs:
Path: artifacts\WinSW.NETCore31.x86.exe
Name: WinSW.NETCore31.x86.exe_$(BuildConfiguration)
- displayName: Publish Nuget
inputs:
Path: $(Build.ArtifactStagingDirectory)\WinSW.$(PackageVersion).nupkg
Name: WinSW.nupkg_$(BuildConfiguration)
- job: Build
pool:
vmImage: windows-latest
strategy:
matrix:
Debug:
BuildConfiguration: Debug
Release:
BuildConfiguration: Release
steps:
- script: |
dotnet build -c $(BuildConfiguration) src\winsw.sln -p:Version=$(BuildVersion)
dotnet publish -c $(BuildConfiguration) -f netcoreapp3.1 src\Core\ServiceWrapper\winsw.csproj -p:Version=$(BuildVersion)
dotnet publish -c $(BuildConfiguration) -f netcoreapp3.1 -r win-x64 src\Core\ServiceWrapper\winsw.csproj -p:PublishSingleFile=true -p:PublishTrimmed=true -p:Version=$(BuildVersion)
dotnet publish -c $(BuildConfiguration) -f netcoreapp3.1 -r win-x86 src\Core\ServiceWrapper\winsw.csproj -p:PublishSingleFile=true -p:PublishTrimmed=true -p:Version=$(BuildVersion)
displayName: Build
- task: NuGetToolInstaller@1
displayName: Install Nuget
inputs:
checkLatest: true
- task: NuGetCommand@2
displayName: Pack
inputs:
command: pack
packagesToPack: WinSW.nuspec
versioningScheme: byEnvVar
versionEnvVar: BuildVersion
- script: dotnet test -c $(BuildConfiguration) --no-build src\Test\winswTests\winswTests.csproj
displayName: Test
- task: PublishBuildArtifacts@1
displayName: Publish .NET 2.0
inputs:
PathtoPublish: artifacts\WinSW.NET2.exe
ArtifactName: WinSW.NET2.exe_$(BuildConfiguration)
- task: PublishBuildArtifacts@1
displayName: Publish .NET 4.0
inputs:
PathtoPublish: artifacts\WinSW.NET4.exe
ArtifactName: WinSW.NET4.exe_$(BuildConfiguration)
- task: PublishBuildArtifacts@1
displayName: Publish .NET 4.6.1
inputs:
PathtoPublish: artifacts\WinSW.NET461.exe
ArtifactName: WinSW.NET461.exe_$(BuildConfiguration)
- task: PublishBuildArtifacts@1
displayName: Publish .NET Core 3.1
inputs:
PathtoPublish: artifacts\WinSW.NETCore31.zip
ArtifactName: WinSW.NETCore31.zip_$(BuildConfiguration)
- task: PublishBuildArtifacts@1
displayName: Publish .NET Core 3.1 x64
inputs:
PathtoPublish: artifacts\WinSW.NETCore31.x64.exe
ArtifactName: WinSW.NETCore31.x64.exe_$(BuildConfiguration)
- task: PublishBuildArtifacts@1
displayName: Publish .NET Core 3.1 x86
inputs:
PathtoPublish: artifacts\WinSW.NETCore31.x86.exe
ArtifactName: WinSW.NETCore31.x86.exe_$(BuildConfiguration)
- task: PublishBuildArtifacts@1
displayName: Publish Nuget
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)\WinSW.$(BuildVersion).nupkg
ArtifactName: WinSW.nupkg_$(BuildConfiguration)
- task: PublishBuildArtifacts@1
displayName: Publish full sample
condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Release'))
inputs:
PathtoPublish: examples\sample-allOptions.xml
ArtifactName: sample-allOptions.xml
- task: PublishBuildArtifacts@1
displayName: Publish minimal sample
condition: and(succeeded(), eq(variables['BuildConfiguration'], 'Release'))
inputs:
PathtoPublish: examples\sample-minimal.xml
ArtifactName: sample-minimal.xml

View File

@ -1,57 +0,0 @@
name: $(Major).$(Minor).$(Patch).$(Revision)
trigger: none
pr: none
variables:
- group: Version
- name: Revision
value: $[counter(format('{0}.{1}.{2}', variables.Major, variables.Minor, variables.Patch), 1)]
- name: AssemblyVersion
value: $(Major).$(Minor).$(Patch)
- name: PackageVersion
value: $(Major).$(Minor).$(Patch)
- name: BuildConfiguration
value: Release
jobs:
- template: template.yml
parameters:
artifacts:
- displayName: Publish .NET 2.0
inputs:
Path: artifacts\WinSW.NET2.exe
Name: WinSW.NET2.exe
- displayName: Publish .NET 4.0
inputs:
Path: artifacts\WinSW.NET4.exe
Name: WinSW.NET4.exe
- displayName: Publish .NET 4.6.1
inputs:
Path: artifacts\WinSW.NET461.exe
Name: WinSW.NET461.exe
- displayName: Publish .NET Core 3.1
inputs:
Path: artifacts\WinSW.NETCore31.zip
Name: WinSW.NETCore31.zip
- displayName: Publish .NET Core 3.1 x64
inputs:
Path: artifacts\WinSW.NETCore31.x64.exe
Name: WinSW.NETCore31.x64.exe
- displayName: Publish .NET Core 3.1 x86
inputs:
Path: artifacts\WinSW.NETCore31.x86.exe
Name: WinSW.NETCore31.x86.exe
- displayName: Publish Nuget
inputs:
Path: $(Build.ArtifactStagingDirectory)\WinSW.$(PackageVersion).nupkg
Name: WinSW.nupkg
- displayName: Publish full sample
inputs:
Path: examples\sample-allOptions.xml
Name: sample-allOptions.xml
- displayName: Publish minimal sample
inputs:
Path: examples\sample-minimal.xml
Name: sample-minimal.xml

View File

@ -1,44 +0,0 @@
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
parameters:
- name: strategy
type: object
default: ''
- name: artifacts
type: object
default: []
jobs:
- job: Build
pool:
vmImage: windows-latest
${{ if ne(parameters.strategy, '') }}:
strategy: ${{ parameters.strategy }}
steps:
- script: '"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe" -k winsw_key.snk'
displayName: Generate key
- script: |
dotnet build -c $(BuildConfiguration) src\winsw.sln -p:Version=$(AssemblyVersion)
dotnet publish -c $(BuildConfiguration) -f netcoreapp3.1 src\Core\ServiceWrapper\winsw.csproj -p:Version=$(AssemblyVersion)
dotnet publish -c $(BuildConfiguration) -f netcoreapp3.1 -r win-x64 src\Core\ServiceWrapper\winsw.csproj -p:PublishSingleFile=true -p:PublishTrimmed=true -p:Version=$(AssemblyVersion)
dotnet publish -c $(BuildConfiguration) -f netcoreapp3.1 -r win-x86 src\Core\ServiceWrapper\winsw.csproj -p:PublishSingleFile=true -p:PublishTrimmed=true -p:Version=$(AssemblyVersion)
displayName: Build
- task: NuGetToolInstaller@1
displayName: Install Nuget
inputs:
checkLatest: true
- task: NuGetCommand@2
displayName: Pack
inputs:
command: pack
packagesToPack: WinSW.nuspec
versioningScheme: byEnvVar
versionEnvVar: PackageVersion
- script: dotnet test -c $(BuildConfiguration) --no-build src\Test\winswTests\winswTests.csproj
displayName: Test
- ${{ each artifact in parameters.artifacts }}:
- task: PublishBuildArtifacts@1
displayName: ${{ artifact.displayName }}
inputs:
PathtoPublish: ${{ artifact.inputs.Path }}
ArtifactName: ${{ artifact.inputs.Name }}