-
Notifications
You must be signed in to change notification settings - Fork 3
/
azure-pipelines.yml
90 lines (71 loc) · 3.12 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
86
87
88
89
# 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
pr:
autoCancel: true
branches:
include:
- master
- develop
- releases/*
trigger:
branches:
include:
- master
- develop
- releases/*
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
solutionDirectory: 'GraphqlController'
GraphControllerProjectDirectory: '$(solutionDirectory)/GraphqlController'
GraphControllerAspNetCoreProjectDirectory: '$(solutionDirectory)/GraphqlController.AspNet'
jobs:
- job: build
timeoutInMinutes: 10
# when is from a pull request
condition: eq(variables['Build.Reason'], 'PullRequest')
steps:
- template: build-pipeline.yml
- job: buildAndDeploy
timeoutInMinutes: 10
# when is not from a pull request
condition: ne(variables['Build.Reason'], 'PullRequest')
steps:
- template: build-pipeline.yml
# collect code coverage
- script: dotnet test $(solutionDirectory)/GraphqlController.UnitTest/GraphqlController.UnitTest.csproj --configuration $(buildConfiguration) --logger trx --collect "Code coverage"
- task: PublishTestResults@2
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
inputs:
testRunner: VSTest
testResultsFiles: '**/*.trx'
displayName: 'Collect code coverage'
# create nuget packages
- script: dotnet pack $(GraphControllerProjectDirectory) -c $(buildConfiguration) -p:Version=$(GitVersion.NugetVersion) -o . --no-build
displayName: 'Create Nuget for GraphqlController'
- script: dotnet pack $(GraphControllerAspNetCoreProjectDirectory) -c $(buildConfiguration) -p:Version=$(GitVersion.NugetVersion) -o . --no-build
displayName: 'Create Nuget for GraphqlController.AspNetCore'
- task: Bash@3
inputs:
targetType: 'inline'
script: 'dotnet nuget push ./GraphqlController.$(GitVersion.NugetVersion).nupkg -k oy2o72lrb7bbkm7svamaunhjhxw62djeziqjr5frtb6mom -s https://api.nuget.org/v3/index.json'
env:
NUGET_KEY: $(nugetorgKey)
- task: Bash@3
inputs:
targetType: 'inline'
script: 'dotnet nuget push ./GraphqlController.AspNetCore.$(GitVersion.NugetVersion).nupkg -k oy2o72lrb7bbkm7svamaunhjhxw62djeziqjr5frtb6mom -s https://api.nuget.org/v3/index.json'
env:
NUGET_KEY: $(nugetorgKey)
# publish nuget packages
# - script: dotnet nuget push ./GraphqlController.$(GitVersion.NugetVersion).nupkg -k %NUGET_KEY% -s https://api.nuget.org/v3/index.json
# displayName: 'Publish GraphqlController'
# env:
# NUGET_KEY: $(nugetorgKey)
# - script: dotnet nuget push ./GraphqlController.AspNetCore.$(GitVersion.NugetVersion).nupkg -k %NUGET_KEY% -s https://api.nuget.org/v3/index.json
# displayName: 'Publish GraphqlController.AspNetCore'
# env:
# NUGET_KEY: $(nugetorgKey)