|
1 | 1 | # https://docs.microsoft.com/en-us/vsts/pipelines/yaml-schema?view=vsts |
2 | 2 |
|
| 3 | +trigger: |
| 4 | + batch: true |
| 5 | + branches: |
| 6 | + include: |
| 7 | + - 'master' |
| 8 | + |
| 9 | +pr: |
| 10 | + autoCancel: true |
| 11 | + branches: |
| 12 | + include: |
| 13 | + - master |
| 14 | + |
3 | 15 | pool: |
4 | | - vmImage: 'ubuntu-latest' |
| 16 | + vmImage: 'windows-latest' |
5 | 17 |
|
6 | 18 | variables: |
7 | | - BuildConfiguration: "Release" |
8 | | - Project: "$(Build.SourcesDirectory)/src/KK.AspNetCore.EasyAuthAuthentication/KK.AspNetCore.EasyAuthAuthentication.csproj" |
9 | | - ProjectFolder: "$(Build.SourcesDirectory)/src/KK.AspNetCore.EasyAuthAuthentication" |
10 | | - GitVersion: "5.0.1" |
| 19 | + # Set the DOTNET_SKIP_FIRST_TIME_EXPERIENCE environment variable to stop wasting time caching packages |
| 20 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 21 | + # Disable sending usage data to Microsoft |
| 22 | + DOTNET_CLI_TELEMETRY_OPTOUT: true |
| 23 | + BuildConfiguration: 'Release' |
| 24 | + Project: '$(Build.SourcesDirectory)/src/KK.AspNetCore.EasyAuthAuthentication/KK.AspNetCore.EasyAuthAuthentication.csproj' |
| 25 | + ProjectFolder: '$(Build.SourcesDirectory)/src/KK.AspNetCore.EasyAuthAuthentication' |
| 26 | + GitVersion: '5.1.3' |
11 | 27 |
|
12 | 28 | name: $(Year:yy)$(DayOfYear)$(Rev:rr) |
13 | 29 |
|
14 | | -steps: |
15 | | - - task: UseDotNet@2 |
16 | | - displayName: Use .NET Core $(DotNetVersion) |
17 | | - inputs: |
18 | | - packageType: "sdk" |
19 | | - useGlobalJson: true |
20 | | - - task: UseDotNet@2 |
21 | | - displayName: Install dotnet 2.1 for gitversion. That requiered it. |
22 | | - inputs: |
23 | | - packageType: "sdk" |
24 | | - version: 2.1.x |
25 | | - - task: DotNetCoreCLI@2 |
26 | | - displayName: 'Install GitVersion: $(GitVersion)' |
27 | | - inputs: |
28 | | - command: custom |
29 | | - custom: 'tool' |
30 | | - arguments: 'install GitVersion.Tool --version $(GitVersion) --tool-path pipelines/tools/gitversion' |
31 | | - - task: PowerShell@2 |
32 | | - displayName: Run GitVersion |
33 | | - inputs: |
34 | | - targetType: "filePath" |
35 | | - filePath: "pipelines/tools/Run-GitVersion.ps1" |
36 | | - workingDirectory: "$(ProjectFolder)" |
| 30 | +stages: |
| 31 | + - stage: 'Build' |
| 32 | + jobs: |
| 33 | + - job: 'Build' |
| 34 | + steps: |
| 35 | + - task: UseDotNet@2 |
| 36 | + displayName: 'Install dotnet core SDK' |
| 37 | + inputs: |
| 38 | + packageType: 'sdk' |
| 39 | + useGlobalJson: true |
| 40 | + |
| 41 | + - task: DotNetCoreCLI@2 |
| 42 | + displayName: 'Install GitVersion: $(GitVersion)' |
| 43 | + inputs: |
| 44 | + command: custom |
| 45 | + custom: 'tool' |
| 46 | + arguments: 'install GitVersion.Tool --version $(GitVersion) --tool-path ./pipelines/tools/gitversion' |
| 47 | + |
| 48 | + - task: PowerShell@2 |
| 49 | + displayName: 'Run GitVersion' |
| 50 | + inputs: |
| 51 | + targetType: 'filePath' |
| 52 | + filePath: 'pipelines/tools/Run-GitVersion.ps1' |
| 53 | + arguments: '-Verbose' |
| 54 | + workingDirectory: '$(ProjectFolder)' |
| 55 | + |
| 56 | + - task: DotNetCoreCLI@2 |
| 57 | + displayName: 'Restore' |
| 58 | + inputs: |
| 59 | + command: 'restore' |
| 60 | + projects: '$(Project)' |
37 | 61 |
|
38 | | - - task: DotNetCoreCLI@2 |
39 | | - displayName: Restore |
40 | | - inputs: |
41 | | - command: "restore" |
42 | | - projects: "$(Project)" |
| 62 | + - task: DotNetCoreCLI@2 |
| 63 | + displayName: 'Build' |
| 64 | + inputs: |
| 65 | + command: 'build' |
| 66 | + projects: '$(Project)' |
| 67 | + arguments: '--configuration $(buildConfiguration) --no-restore' |
43 | 68 |
|
44 | | - - task: DotNetCoreCLI@2 |
45 | | - displayName: Build |
46 | | - inputs: |
47 | | - command: "build" |
48 | | - projects: "$(Project)" |
49 | | - arguments: "--configuration $(buildConfiguration)" |
| 69 | + - task: DotNetCoreCLI@2 |
| 70 | + displayName: 'Test' |
| 71 | + inputs: |
| 72 | + command: 'test' |
| 73 | + projects: 'test/**/*.csproj' |
| 74 | + arguments: '--configuration $(buildConfiguration)' |
| 75 | + testRunTitle: '$(Build.BuildNumber)' |
50 | 76 |
|
51 | | - - task: DotNetCoreCLI@2 |
52 | | - displayName: Pack Pullrequest |
53 | | - condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) |
54 | | - inputs: |
55 | | - command: "pack" |
56 | | - packagesToPack: "$(Project)" |
57 | | - nobuild: true |
58 | | - arguments: "--configuration $(buildConfiguration)" |
59 | | - buildProperties: "VersionPrefix=$(GitVersion.MajorMinorPatch);VersionSuffix=pre-$(Build.BuildNumber);PackageId=PR-$(System.PullRequest.pullRequestNumber)-KK.AspNetCore.EasyAuthAuthentication" |
60 | | - packDirectory: "$(Build.ArtifactStagingDirectory)" |
61 | | - verbosityPack: Normal |
| 77 | + - template: templates/NuGet.Pack.yaml |
| 78 | + parameters: |
| 79 | + name: 'PR' |
| 80 | + condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) |
| 81 | + buildProperties: 'VersionPrefix=$(GitVersion.MajorMinorPatch);VersionSuffix=pre-$(Build.BuildNumber);PackageId=PR-$(System.PullRequest.pullRequestNumber)-KK.AspNetCore.EasyAuthAuthentication' |
62 | 82 |
|
63 | | - - task: DotNetCoreCLI@2 |
64 | | - displayName: Pack Internal |
65 | | - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) |
66 | | - inputs: |
67 | | - command: "pack" |
68 | | - packagesToPack: "$(Project)" |
69 | | - nobuild: true |
70 | | - arguments: "--configuration $(buildConfiguration)" |
71 | | - buildProperties: "VersionPrefix=$(GitVersion.MajorMinorPatch);VersionSuffix=pre-$(Build.BuildNumber)" |
72 | | - packDirectory: "$(Build.ArtifactStagingDirectory)" |
73 | | - verbosityPack: Normal |
| 83 | + - template: templates/NuGet.Pack.yaml |
| 84 | + parameters: |
| 85 | + name: 'Internal' |
| 86 | + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) |
| 87 | + buildProperties: 'VersionPrefix=$(GitVersion.MajorMinorPatch);VersionSuffix=pre-$(Build.BuildNumber)' |
74 | 88 |
|
75 | | - - task: DotNetCoreCLI@2 |
76 | | - displayName: Pack Release |
77 | | - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) |
78 | | - inputs: |
79 | | - command: "pack" |
80 | | - packagesToPack: "$(Project)" |
81 | | - nobuild: true |
82 | | - arguments: "--configuration $(buildConfiguration)" |
83 | | - buildProperties: "VersionPrefix=$(GitVersion.MajorMinorPatch);VersionSuffix=" |
84 | | - packDirectory: "$(Build.ArtifactStagingDirectory)" |
85 | | - verbosityPack: Normal |
| 89 | + - template: templates/NuGet.Pack.yaml |
| 90 | + parameters: |
| 91 | + name: 'Release' |
| 92 | + condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master')) |
| 93 | + buildProperties: 'VersionPrefix=$(GitVersion.MajorMinorPatch);VersionSuffix=' |
86 | 94 |
|
87 | | - - task: PublishBuildArtifacts@1 |
88 | | - displayName: Publish Artifact |
89 | | - condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.Reason'], 'PullRequest'))) |
90 | | - inputs: |
91 | | - pathtoPublish: "$(Build.ArtifactStagingDirectory)" |
92 | | - artifactName: NuGet |
93 | | - parallel: true |
| 95 | + - task: PublishBuildArtifacts@1 |
| 96 | + displayName: 'Publish Artifact' |
| 97 | + condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.Reason'], 'PullRequest'))) |
| 98 | + inputs: |
| 99 | + pathtoPublish: '$(Build.ArtifactStagingDirectory)' |
| 100 | + artifactName: NuGet |
| 101 | + parallel: true |
0 commit comments