Merge pull request #477 from NextTurn/pipelines

Set up CI with Azure Pipelines
pull/494/head
Oleg Nenashev 2020-04-08 09:36:11 +02:00 committed by GitHub
commit bed7b68d0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 145 additions and 39 deletions

View File

@ -1,39 +0,0 @@
# WinSW Developer Information
### Build Environment
* *winsw_key.snk* should be available in the project's root in order to build the executable
* You can generate the certificate by running *generate-key.ps1*
* The certificate is in *.gitignore* list. Please do not add it to the repository
### Continuous Integration
Project has a continuous integration flow being hosted by AppVeyor ([project page](https://ci.appveyor.com/project/winsw/winsw)).
This CI instance automates building and testing of the Release configuration of WinSW.
See [the appveyor.yml file](./appveyor.yml) for more details.
Versions generated by the CI instances are **NOT** aligned with the release version, they use a rolling version ID instead.
### Releasing to GitHub and NuGet
Releases are being performed to 3 locations: GitHub, NuGet, and Jenkins Maven Repository.
For all these releases we use binaries being created by the special AppVeyor Job ([winsw-release]https://ci.appveyor.com/project/winsw/winsw-release/)).
Here are the release steps:
1. Integrate all pull requests you want to release to the master branch.
1. Update [CHANGELOG](./CHANGELOG.md) and push changes to the master.
1. Wait till the [AppVeyor build](https://ci.appveyor.com/project/winsw/winsw) finishes for the last commit.
1. Go to the [winsw-release job page](https://ci.appveyor.com/project/winsw/winsw-release/).
1. If you are doing a release with a new feature, bump the second digit in the _Version_ setting (e.g. to `2.N.${build}`) and change the next build number to `0`. In such case the version in assembly info will be `2.N.0`
1. Run the [winsw-release](https://ci.appveyor.com/project/winsw/winsw-release/) build.
Once it completes, ensure the version is correct.
1. Click on the _Deploy_ button for the build.
Then deploy changes to _GitHub Releases_ and NuGet using the available publishers.
1. Go to [GitHub Releases](https://github.com/winsw/winsw/releases), find the published Release, click on *Edit release* and then uncheck the *This is a pre-release* checkbox to make the release public.
### Releasing to the Maven repository (legacy)
Maven repository is no longer the main source of releases,
but some projects still depend on WinSW from the Jenkins Maven repository.
Maven Packaging repository can be found [here](https://github.com/jenkinsci/winsw-maven-packaging).

51
eng/build.yml Normal file
View File

@ -0,0 +1,51 @@
name: $(Major).$(Minor).$(Patch).$(Revision)
trigger:
- master
pr:
- master
variables:
Revision: $[counter(format('{0}.{1}.{2}', variables.Major, variables.Minor, variables.Patch), 1)]
AssemblyVersion: $(Major).$(Minor).$(Patch)
PackageVersion: $(Major).$(Minor).$(Patch).$(Revision)
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)

50
eng/release.yml Normal file
View File

@ -0,0 +1,50 @@
name: $(Major).$(Minor).$(Patch).$(Revision)
trigger: none
variables:
Revision: $[counter(format('{0}.{1}.{2}', variables.Major, variables.Minor, variables.Patch), 1)]
AssemblyVersion: $(Major).$(Minor).$(Patch)
PackageVersion: $(Major).$(Minor).$(Patch)
BuildConfiguration: 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

44
eng/template.yml Normal file
View File

@ -0,0 +1,44 @@
# 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 }}