|  | 
|  | 1 | +# Copyright (c) Microsoft Corporation. All rights reserved. | 
|  | 2 | +# Licensed under the MIT License. | 
|  | 3 | +name: $(TeamProject)_$(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) | 
|  | 4 | + | 
|  | 5 | +# Trigger is on github tags | 
|  | 6 | +trigger: | 
|  | 7 | +  tags: | 
|  | 8 | +    include: | 
|  | 9 | +      - '*' | 
|  | 10 | + | 
|  | 11 | +# No Pull request (PR) triggers for release | 
|  | 12 | +pr: none | 
|  | 13 | + | 
|  | 14 | +pool: | 
|  | 15 | +  vmImage: 'windows-latest' | 
|  | 16 | +   | 
|  | 17 | +variables: | 
|  | 18 | +  buildPlatform: 'Any CPU' | 
|  | 19 | +  buildConfiguration: 'Release' | 
|  | 20 | +  snExe: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe' | 
|  | 21 | +  snExe64: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\sn.exe' | 
|  | 22 | +  ProductBinPath: '$(Build.SourcesDirectory)\bin\$(BuildConfiguration)' | 
|  | 23 | +  mainDll: 'Microsoft.OpenApi.OData.Reader.dll' | 
|  | 24 | +  testDll: 'Microsoft.OpenApi.OData.Reader.Tests.dll' | 
|  | 25 | +  skipComponentGovernanceDetection: true | 
|  | 26 | + | 
|  | 27 | +steps: | 
|  | 28 | + | 
|  | 29 | +- task: UseDotNet@2 | 
|  | 30 | +  displayName: 'Use .NET 6' | 
|  | 31 | +  inputs: | 
|  | 32 | +    version: 6.x | 
|  | 33 | + | 
|  | 34 | +- task: PoliCheck@1 | 
|  | 35 | +  displayName: 'Run PoliCheck "OpenApi.OData-master\src"' | 
|  | 36 | +  inputs: | 
|  | 37 | +    inputType: CmdLine | 
|  | 38 | +    cmdLineArgs: '/F:$(Build.SourcesDirectory)/src /T:9 /Sev:"1|2" /PE:2 /O:poli_result_src.xml' | 
|  | 39 | + | 
|  | 40 | +- task: PoliCheck@1 | 
|  | 41 | +  displayName: 'Run PoliCheck "OpenApi.OData-master\test"' | 
|  | 42 | +  inputs: | 
|  | 43 | +    inputType: CmdLine | 
|  | 44 | +    cmdLineArgs: '/F:$(Build.SourcesDirectory)/test /T:9 /Sev:"1|2" /PE:2 /O:poli_result_test.xml' | 
|  | 45 | + | 
|  | 46 | +- task: PoliCheck@1 | 
|  | 47 | +  displayName: 'PoliCheck for OpenApi.OData-master\tool' | 
|  | 48 | +  inputs: | 
|  | 49 | +    inputType: CmdLine | 
|  | 50 | +    cmdLineArgs: '/F:$(Build.SourcesDirectory)/tool /T:9 /Sev:"1|2" /PE:2 /O:poli_result_tool.xml' | 
|  | 51 | +     | 
|  | 52 | +# Install the nuget tooler. | 
|  | 53 | +- task: NuGetToolInstaller@0 | 
|  | 54 | +  displayName: 'Use NuGet >=5.2.0' | 
|  | 55 | +  inputs: | 
|  | 56 | +    versionSpec: '>=5.2.0' | 
|  | 57 | +    checkLatest: true | 
|  | 58 | + | 
|  | 59 | +# Build the Product project | 
|  | 60 | +- task: DotNetCoreCLI@2 | 
|  | 61 | +  displayName: 'build Microsoft.OpenAPI.OData.Reader.csproj ' | 
|  | 62 | +  inputs: | 
|  | 63 | +    projects: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi.OData.Reader\Microsoft.OpenAPI.OData.Reader.csproj' | 
|  | 64 | +    arguments: '--configuration $(BuildConfiguration) --no-incremental' | 
|  | 65 | + | 
|  | 66 | +# Build the Unit test project | 
|  | 67 | +- task: DotNetCoreCLI@2 | 
|  | 68 | +  displayName: 'build Microsoft.OpenAPI.OData.Reader.Tests.csproj' | 
|  | 69 | +  inputs: | 
|  | 70 | +    projects: '$(Build.SourcesDirectory)\test\Microsoft.OpenAPI.OData.Reader.Tests\Microsoft.OpenApi.OData.Reader.Tests.csproj' | 
|  | 71 | +    arguments: '--configuration $(BuildConfiguration) --no-incremental' | 
|  | 72 | + | 
|  | 73 | +# because the assemblies are delay-signed, we need to disable | 
|  | 74 | +# strong name validation so that the tests may run, | 
|  | 75 | +# otherwise our assemblies will fail to load | 
|  | 76 | +- task: Powershell@2 | 
|  | 77 | +  displayName: 'Skip strong name validation' | 
|  | 78 | +  inputs: | 
|  | 79 | +    targetType: 'inline' | 
|  | 80 | +    script: | | 
|  | 81 | +      & "$(snExe)" /Vr $(ProductBinPath)\net472\$(mainDll) | 
|  | 82 | +      & "$(snExe64)" /Vr $(ProductBinPath)\net472\$(mainDll) | 
|  | 83 | +      & "$(snExe)" /Vr $(ProductBinPath)\test\net472\$(testDll) | 
|  | 84 | +      & "$(snExe64)" /Vr $(ProductBinPath)\test\net472\$(testDll) | 
|  | 85 | +
 | 
|  | 86 | +# Run the Unit test | 
|  | 87 | +- task: DotNetCoreCLI@2 | 
|  | 88 | +  displayName: 'Run Microsoft.OpenApi.OData.Reader.Tests.csproj' | 
|  | 89 | +  inputs: | 
|  | 90 | +    command: test | 
|  | 91 | +    projects: '$(Build.SourcesDirectory)\test\Microsoft.OpenAPI.OData.Reader.Tests\Microsoft.OpenApi.OData.Reader.Tests.csproj' | 
|  | 92 | +    arguments: '--configuration $(BuildConfiguration) --no-build' | 
|  | 93 | + | 
|  | 94 | +# CredScan | 
|  | 95 | +- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2 | 
|  | 96 | +  displayName: 'Run CredScan - Src' | 
|  | 97 | +  inputs: | 
|  | 98 | +    toolMajorVersion: 'V2' | 
|  | 99 | +    scanFolder: '$(Build.SourcesDirectory)\src' | 
|  | 100 | +    debugMode: false | 
|  | 101 | + | 
|  | 102 | +- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2 | 
|  | 103 | +  displayName: 'Run CredScan - Test' | 
|  | 104 | +  inputs: | 
|  | 105 | +    toolMajorVersion: 'V2' | 
|  | 106 | +    scanFolder: '$(Build.SourcesDirectory)\test' | 
|  | 107 | +    debugMode: false | 
|  | 108 | +   | 
|  | 109 | +# Microsoft.CodeAnalysis.FxCopAnalyzers is added into the project. | 
|  | 110 | +# Typically, .NET Standard (.NET Core) project doesn't need the FxCop. | 
|  | 111 | + | 
|  | 112 | +# Needn't the AntiMalware@3 task? | 
|  | 113 | +- task: AntiMalware@3 | 
|  | 114 | +  displayName: 'Run MpCmdRun.exe - ProductBinPath' | 
|  | 115 | +  inputs: | 
|  | 116 | +    FileDirPath: '$(ProductBinPath)' | 
|  | 117 | +  enabled: false | 
|  | 118 | + | 
|  | 119 | +- task: BinSkim@3 | 
|  | 120 | +  displayName: 'Run BinSkim - Product Binaries' | 
|  | 121 | +  inputs: | 
|  | 122 | +    InputType: Basic | 
|  | 123 | +    AnalyzeTarget: '$(ProductBinPath)\**\Microsoft.OpenApi.OData.Reader.dll' | 
|  | 124 | +    AnalyzeSymPath: '$(ProductBinPath)' | 
|  | 125 | +    AnalyzeVerbose: true | 
|  | 126 | +    AnalyzeHashes: true | 
|  | 127 | +    AnalyzeEnvironment: true | 
|  | 128 | + | 
|  | 129 | +- task: PublishSecurityAnalysisLogs@2 | 
|  | 130 | +  displayName: 'Publish Security Analysis Logs' | 
|  | 131 | +  inputs: | 
|  | 132 | +    ArtifactName: SecurityLogs | 
|  | 133 | + | 
|  | 134 | +- task: PostAnalysis@1 | 
|  | 135 | +  displayName: 'Post Analysis' | 
|  | 136 | +  inputs: | 
|  | 137 | +    BinSkim: true | 
|  | 138 | +    CredScan: true | 
|  | 139 | +    PoliCheck: true | 
|  | 140 | + | 
|  | 141 | +- task: EsrpCodeSigning@1 | 
|  | 142 | +  displayName: 'ESRP CodeSigning' | 
|  | 143 | +  inputs: | 
|  | 144 | +    ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)' | 
|  | 145 | +    FolderPath: '$(Build.SourcesDirectory)\bin\$(BuildConfiguration)' | 
|  | 146 | +    Pattern: Microsoft.OpenApi.OData.Reader.dll | 
|  | 147 | +    signConfigType: inlineSignParams | 
|  | 148 | +    inlineOperation: | | 
|  | 149 | +     [ | 
|  | 150 | +       { | 
|  | 151 | +         "keyCode": "CP-230012", | 
|  | 152 | +         "operationSetCode": "SigntoolSign", | 
|  | 153 | +         "parameters": [ | 
|  | 154 | +         { | 
|  | 155 | +           "parameterName": "OpusName", | 
|  | 156 | +           "parameterValue": "TestSign" | 
|  | 157 | +         }, | 
|  | 158 | +         { | 
|  | 159 | +           "parameterName": "OpusInfo", | 
|  | 160 | +           "parameterValue": "http://test" | 
|  | 161 | +         }, | 
|  | 162 | +         { | 
|  | 163 | +           "parameterName": "PageHash", | 
|  | 164 | +           "parameterValue": "/NPH" | 
|  | 165 | +         }, | 
|  | 166 | +         { | 
|  | 167 | +           "parameterName": "FileDigest", | 
|  | 168 | +           "parameterValue": "/fd sha256" | 
|  | 169 | +         }, | 
|  | 170 | +         { | 
|  | 171 | +           "parameterName": "TimeStamp", | 
|  | 172 | +           "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" | 
|  | 173 | +         } | 
|  | 174 | +         ], | 
|  | 175 | +         "toolName": "signtool.exe", | 
|  | 176 | +         "toolVersion": "6.2.9304.0" | 
|  | 177 | +       }, | 
|  | 178 | +       { | 
|  | 179 | +         "keyCode": "CP-230012", | 
|  | 180 | +         "operationSetCode": "SigntoolVerify", | 
|  | 181 | +         "parameters": [ | 
|  | 182 | +         { | 
|  | 183 | +           "parameterName": "VerifyAll", | 
|  | 184 | +           "parameterValue": "/all" | 
|  | 185 | +         } | 
|  | 186 | +         ], | 
|  | 187 | +         "toolName": "signtool.exe", | 
|  | 188 | +         "toolVersion": "6.2.9304.0" | 
|  | 189 | +       } | 
|  | 190 | +     ] | 
|  | 191 | +    SessionTimeout: 20 | 
|  | 192 | + | 
|  | 193 | +- task: MSBuild@1 | 
|  | 194 | +  displayName: 'Get Nuget Package Metadata' | 
|  | 195 | +  inputs: | 
|  | 196 | +    solution: '$(Build.SourcesDirectory)\tool\GetNugetPackageMetadata.proj' | 
|  | 197 | +    platform: '$(BuildPlatform)' | 
|  | 198 | +    configuration: '$(BuildConfiguration)' | 
|  | 199 | + | 
|  | 200 | +- task: PowerShell@2 | 
|  | 201 | +  displayName: 'Validate project version has been incremented' | 
|  | 202 | +  inputs: | 
|  | 203 | +    targetType: 'filePath' | 
|  | 204 | +    filePath: $(System.DefaultWorkingDirectory)\scripts\ValidateProjectVersionUpdated.ps1 | 
|  | 205 | +    arguments: '-projectVersion "$(VersionFullSemantic)"' | 
|  | 206 | + | 
|  | 207 | +- task: NuGetCommand@2 | 
|  | 208 | +  displayName: 'NuGet pack Release.nuspec' | 
|  | 209 | +  inputs: | 
|  | 210 | +    command: custom | 
|  | 211 | +    arguments: 'pack $(Build.SourcesDirectory)\src\Microsoft.OpenApi.OData.Reader\Microsoft.OpenAPI.OData.Reader.Release.nuspec -NonInteractive -OutputDirectory $(Build.ArtifactStagingDirectory)\Nuget -Properties Configuration=$(BuildConfiguration);ProductRoot=$(ProductBinPath);VersionFullSemantic=$(VersionFullSemantic);NightlyBuildVersion=$(VersionNugetNightlyBuild);VersionNuGetSemantic=$(VersionNuGetSemantic);OpenApiCorePackageDependency="$(OpenApiCorePackageDependency)";ODataEdmPackageDependency="$(ODataEdmPackageDependency)";  -Verbosity Detailed -Symbols -SymbolPackageFormat snupkg' | 
|  | 212 | +     | 
|  | 213 | +- task: EsrpCodeSigning@1 | 
|  | 214 | +  displayName: 'ESRP CodeSigning Nuget Packages' | 
|  | 215 | +  inputs: | 
|  | 216 | +    ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)' | 
|  | 217 | +    FolderPath: '$(Build.ArtifactStagingDirectory)\Nuget' | 
|  | 218 | +    Pattern: '*.nupkg' | 
|  | 219 | +    signConfigType: inlineSignParams | 
|  | 220 | +    inlineOperation: | | 
|  | 221 | +     [ | 
|  | 222 | +         { | 
|  | 223 | +             "keyCode": "CP-401405", | 
|  | 224 | +             "operationSetCode": "NuGetSign", | 
|  | 225 | +             "parameters": [ ], | 
|  | 226 | +             "toolName": "sign", | 
|  | 227 | +             "toolVersion": "1.0" | 
|  | 228 | +         }, | 
|  | 229 | +         { | 
|  | 230 | +             "keyCode": "CP-401405", | 
|  | 231 | +             "operationSetCode": "NuGetVerify", | 
|  | 232 | +             "parameters": [ ], | 
|  | 233 | +             "toolName": "sign", | 
|  | 234 | +             "toolVersion": "1.0" | 
|  | 235 | +         } | 
|  | 236 | +     ] | 
|  | 237 | +    SessionTimeout: 20 | 
|  | 238 | + | 
|  | 239 | +- task: PublishBuildArtifacts@1 | 
|  | 240 | +  displayName: 'Publish Artifact - Nuget Packages' | 
|  | 241 | +  inputs: | 
|  | 242 | +    PathtoPublish: '$(Build.ArtifactStagingDirectory)\Nuget' | 
|  | 243 | +    ArtifactName: Nuget | 
|  | 244 | +     | 
|  | 245 | +- task: NuGetCommand@2 | 
|  | 246 | +  displayName: 'Push nuget package to nuget.org' | 
|  | 247 | +  inputs: | 
|  | 248 | +    command: push | 
|  | 249 | +    packagesToPush: '$(Build.ArtifactStagingDirectory)\Nuget\*.nupkg' | 
|  | 250 | +    nuGetFeedType: external | 
|  | 251 | +    publishFeedCredentials: 'OpenAPI Nuget Connection' | 
|  | 252 | + | 
|  | 253 | +- task: GithubRelease@1 | 
|  | 254 | +  displayName: 'Create Github Release (v$(VersionFullSemantic))' | 
|  | 255 | +  inputs: | 
|  | 256 | +    githubConnection: 'github - danielmbaluka' | 
|  | 257 | +    title: 'v$(VersionFullSemantic)' | 
|  | 258 | +    tagSource: userSpecifiedTag | 
|  | 259 | +    tag: 'v$(VersionFullSemantic)' | 
0 commit comments