Files
GeoUK/GeoUK.OSTN/azure-pipelines.yml
2019-07-18 14:50:04 +01:00

72 lines
2.4 KiB
YAML

# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
# the build will trigger on any changes to the master branch
trigger:
- master
# the build will run on a Microsoft hosted agent, using the lastest Windows VM Image
pool:
vmImage: 'windows-latest'
# these variables are available throughout the build file
# just the build configuration is defined, in this case we are building Release packages
variables:
buildConfiguration: 'Release'
#The build has 3 seperate tasks run under 1 step
steps:
# The first task is the dotnet command build, pointing to our csproj file
- task: DotNetCoreCLI@2
displayName: 'dotnet build'
inputs:
command: 'build'
arguments: '--configuration $(buildConfiguration)'
projects: 'GeoUK.OSTN/GeoUK.OSTN.csproj'
# Unit tests
- task: VSTest@2
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: |
**\*GeoUK.OSTN.XUnit.dll
**\Tests\GeoUK.OSTN.XUnit\*GeoUK.OSTN.XUnit.dll
**\Tests\GeoUK.OSTN.XUnit\GeoUK.OSTN.XUnit.dll
**\*test*.dll
**\*XUnit*.dll
!**\*TestAdapter.dll
!**\obj\**
searchFolder: '$(System.DefaultWorkingDirectory)'
codeCoverageEnabled: true
# The second task is dotnet pack command again pointing to the csproj file
# The nobuild means the project will not be compiled before running pack, because its already built in above step
- task: DotNetCoreCLI@2
displayName: "dotnet pack"
inputs:
command: pack
arguments: '--configuration $(buildConfiguration)'
packagesToPack: 'GeoUK.OSTN/GeoUK.OSTN.csproj'
majorVersion: '$(Major)'
minorVersion: '$(Minor)'
patchVersion: '$(Patch)'
# The last task is a nuget command, nuget push
# This will push any .nupkg files to the 'TestFeed' artifact feed
# allowPackageConflicts allows us to build the same version and not throw an error when trying to push
# instead it just ingores the latest package unless the version changes
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: push
publishVstsFeed: 'TestFeed'
allowPackageConflicts: true
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'internal'
majorVersion: '$(Major)'
minorVersion: '$(Minor)'
patchVersion: '$(Patch)'