-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
85 lines (73 loc) · 3.04 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# https://stackoverflow.com/questions/54718866/azure-pipeline-nuget-package-versioning-scheme-how-to-get-1-0-revr
#Set build number automatically
name: $(majorMinorVersion).$(semanticVersion) # $(rev:r) # NOTE: rev resets when the default retention period expires
# pipeline variables
variables:
majorMinorVersion: 1.0
# semanticVersion counter is automatically incremented by one in each execution of pipeline
# second parameter is seed value to reset to every time the referenced majorMinorVersion is changed
semanticVersion: $[counter(variables['majorMinorVersion'], 0)]
# Only run against master
trigger: none
# Don't run against PRs
pr: none
stages:
- stage: build_and_unitTests
jobs:
- job: run_build_and_unitTests
pool:
vmImage: 'windows-latest'
steps:
- script: dotnet restore
- task: DotNetCoreCLI@2
displayName: Build
inputs:
command: build
projects: '**/*.csproj'
arguments: '--configuration $(buildConfiguration)'
- task: DotNetCoreCLI@2
displayName: UnitTests
inputs:
command: test
projects: '**/tests/**/*UnitTests.csproj'
arguments: '--configuration $(buildConfiguration) --settings $(Build.SourcesDirectory)\tests\Microsoft.Extensions.Configuration.MsTestContext.UnitTests\config.runsettings'
- stage: integrationTests_and_nugetpush
dependsOn: build_and_unitTests
jobs:
- job: publish
pool:
vmImage: 'windows-latest'
steps:
- script: dotnet publish --output $(Build.ArtifactStagingDirectory)
- task: FileTransform@1
condition: eq(variables['RunIntegrationTests'], true)
displayName: 'local.settings.json variables set'
inputs:
folderPath: '$(Build.ArtifactStagingDirectory)'
fileType: json
targetFiles: local.settings.json
- task: VSTest@2
condition: eq(variables['RunIntegrationTests'], true)
inputs:
testSelector: 'testAssemblies'
testAssemblyVer2: '**\*.IntegrationTests.dll'
searchFolder: '$(Build.ArtifactStagingDirectory)'
otherConsoleOptions: '/platform:x64 /Framework:.NETCoreApp,Version=v2.1 /logger:console;verbosity="normal"'
- task: DotNetCoreCLI@2
displayName: 'NuGet pack'
condition: eq(variables['PushPackage'], true)
inputs:
command: 'pack'
configuration: $(BuildConfiguration)
packagesToPack: '**/Microsoft.Extensions.Configuration.MsTestContext.csproj'
packDirectory: '$(build.artifactStagingDirectory)'
versioningScheme: byBuildNumber # https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#yaml-snippet
- task: NuGetCommand@2
displayName: 'NuGet push'
condition: eq(variables['PushPackage'], true)
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
nuGetFeedType: 'external'
publishFeedCredentials: 'Nuget official'
# - task: PublishBuildArtifacts@1