|
| 1 | +# ASP.NET Core (.NET Framework) |
| 2 | +# Build and test ASP.NET Core projects targeting the full .NET Framework. |
| 3 | +# Add steps that publish symbols, save build artifacts, and more: |
| 4 | +# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core |
| 5 | + |
| 6 | +trigger: |
| 7 | + branches: |
| 8 | + include: |
| 9 | + - release/* |
| 10 | + - develop |
| 11 | + - master |
| 12 | + tags: |
| 13 | + include: |
| 14 | + - v* |
| 15 | + |
| 16 | +pr: |
| 17 | + branches: |
| 18 | + include: |
| 19 | + - '*' # must quote since "*" is a YAML reserved character; we want a string |
| 20 | + |
| 21 | +variables: |
| 22 | + solution: FubarDev.FtpServer.sln |
| 23 | + buildPlatform: 'Any CPU' |
| 24 | + buildConfiguration: Release |
| 25 | + |
| 26 | +jobs: |
| 27 | +- job: prepare |
| 28 | + displayName: Setting the build number |
| 29 | + steps: |
| 30 | + - task: UseGitVersion@5 |
| 31 | + inputs: |
| 32 | + versionSpec: '5.0.2-beta1.130' |
| 33 | + includePrerelease: true |
| 34 | + updateAssemblyInfo: false |
| 35 | + env: |
| 36 | + BUILD_BUILDNUMBER: $(GitVersion.FullSemVer) |
| 37 | + |
| 38 | +- job: pack |
| 39 | + displayName: Build and create NuGet packages |
| 40 | + dependsOn: prepare |
| 41 | + condition: and(succeeded(), not(eq(variables['Build.Reason'], 'PullRequest'))) |
| 42 | + pool: |
| 43 | + vmImage: 'windows-latest' |
| 44 | + steps: |
| 45 | + - task: DotNetCoreCLI@2 |
| 46 | + inputs: |
| 47 | + command: 'restore' |
| 48 | + projects: '$(solution)' |
| 49 | + feedsToUse: 'select' |
| 50 | + verbosityRestore: 'Normal' |
| 51 | + - task: VSBuild@1 |
| 52 | + inputs: |
| 53 | + solution: '$(solution)' |
| 54 | + platform: '$(buildPlatform)' |
| 55 | + configuration: '$(buildConfiguration)' |
| 56 | + msbuildArgs: '/p:Version="$(build.buildNumber)"' |
| 57 | + - task: BuildQualityChecks@6 |
| 58 | + inputs: |
| 59 | + checkWarnings: true |
| 60 | + warningFailOption: 'build' |
| 61 | + allowWarningVariance: true |
| 62 | + warningVariance: '5' |
| 63 | + showStatistics: true |
| 64 | + includePartiallySucceeded: false |
| 65 | + warningTaskFilters: '/^vsbuild/i' |
| 66 | + warningFilters: | |
| 67 | + /##\[warning\].+CS.+:/i |
| 68 | + /##\[warning\].+SA.+:/i |
| 69 | + - task: DotNetCoreCLI@2 |
| 70 | + inputs: |
| 71 | + command: custom |
| 72 | + custom: pack |
| 73 | + arguments: $(solution) --output $(Build.ArtifactStagingDirectory) --include-symbols /p:Configuration=$(buildConfiguration) /p:Version=$(build.buildNumber) --verbosity Minimal |
| 74 | + - publish: $(Build.ArtifactStagingDirectory) |
| 75 | + artifact: packages |
| 76 | + |
| 77 | +- job: build |
| 78 | + displayName: Build the solution |
| 79 | + dependsOn: prepare |
| 80 | + condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) |
| 81 | + pool: |
| 82 | + vmImage: 'windows-latest' |
| 83 | + steps: |
| 84 | + - task: DotNetCoreCLI@2 |
| 85 | + inputs: |
| 86 | + command: 'restore' |
| 87 | + projects: '$(solution)' |
| 88 | + feedsToUse: 'select' |
| 89 | + verbosityRestore: 'Normal' |
| 90 | + - task: VSBuild@1 |
| 91 | + inputs: |
| 92 | + solution: '$(solution)' |
| 93 | + platform: '$(buildPlatform)' |
| 94 | + configuration: '$(buildConfiguration)' |
| 95 | + msbuildArgs: '/p:Version="$(build.buildNumber)"' |
| 96 | + - task: BuildQualityChecks@6 |
| 97 | + inputs: |
| 98 | + checkWarnings: true |
| 99 | + warningFailOption: 'build' |
| 100 | + allowWarningVariance: true |
| 101 | + warningVariance: '5' |
| 102 | + showStatistics: true |
| 103 | + includePartiallySucceeded: false |
| 104 | + warningTaskFilters: '/^vsbuild/i' |
| 105 | + warningFilters: | |
| 106 | + /##\[warning\].+CS.+:/i |
| 107 | + /##\[warning\].+SA.+:/i |
| 108 | +
|
| 109 | +- job: test |
| 110 | + displayName: Running the tests |
| 111 | + dependsOn: prepare |
| 112 | + variables: |
| 113 | + buildConfiguration: 'Debug' |
| 114 | + steps: |
| 115 | + - task: DotNetCoreCLI@2 |
| 116 | + inputs: |
| 117 | + command: 'test' |
| 118 | + projects: 'test/FubarDev.FtpServer.Tests/FubarDev.FtpServer.Tests.csproj' |
| 119 | + |
| 120 | +- job: tagRelease |
| 121 | + displayName: Tagging the build |
| 122 | + dependsOn: |
| 123 | + - test |
| 124 | + - pack |
| 125 | + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) |
| 126 | + steps: |
| 127 | + - checkout: none |
| 128 | + - task: tagBuildOrRelease@0 |
| 129 | + inputs: |
| 130 | + type: 'Build' |
| 131 | + tags: 'release' |
0 commit comments