Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #869 from AArnott/dev
Browse files Browse the repository at this point in the history
Add azure-pipelines.yml file
  • Loading branch information
Lxiamail authored Apr 20, 2020
2 parents 98d8171 + ae74b4e commit e477b31
Show file tree
Hide file tree
Showing 9 changed files with 239 additions and 33 deletions.
8 changes: 7 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<RawBinariesDropDirectory Condition=" '$(RawBinariesDropDirectory)' == '' ">$(OutputDrop)\raw\binaries</RawBinariesDropDirectory>
<RawSymbolsDropDirectory Condition=" '$(RawSymbolsDropDirectory)' == '' ">$(OutputDrop)\raw\symbols</RawSymbolsDropDirectory>
<OutputPath>$(OutputDrop)\$(MSBuildProjectName)\</OutputPath>
<DocumentationFile>$(OutputPath)$(MSBuildProjectName).xml</DocumentationFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<BaseIntermediateOutputPath>$(OutputFullPath)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
</PropertyGroup>

Expand Down Expand Up @@ -57,6 +57,12 @@
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)\LICENSE.txt" Pack="true" PackagePath=""/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning">
<Version>3.0.28</Version>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>

<!-- Some of the project types do not have a pack target. This creates a default empty pack target that will be overridden in supported project types -->
<Target Name="Pack">
Expand Down
6 changes: 0 additions & 6 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.2" Condition=" '$(IsPackage)' != 'true' ">
<PrivateAssets>All</PrivateAssets>
</PackageReference>

<!-- GitVersionTask is not compiled against .NET Core, so importing the targets will
result in a failure because it will try to resolve Microsoft.Build.Utilities v4.0 -->
<PackageReference Include="GitVersionTask" Version="4.0.0" Condition=" '$(MSBuildRuntimeType)' != 'Core' AND Exists('$(MSBuildThisFileDirectory)\.git') ">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>

<!-- Work around an issue where portable PDB is not supported yet in Api scan tool.
Expand Down
19 changes: 0 additions & 19 deletions GitVersion.yml

This file was deleted.

3 changes: 1 addition & 2 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- Don't use any sources set by the system (workaround for microbuild issue) -->
<clear />
<add key="nuget" value="https://www.nuget.org/api/v2/" />
<add key="nuget" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="corefx lab" value="https://dotnet.myget.org/F/dotnet-corefxlab/api/v3/index.json" />
</packageSources>
</configuration>
2 changes: 1 addition & 1 deletion PortabilityTools.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
build.sh = build.sh
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
GitVersion.yml = GitVersion.yml
version.json = version.json
global.json = global.json
init.ps1 = init.ps1
LICENSE = LICENSE
Expand Down
210 changes: 210 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
trigger:
branches:
include:
- master
- dev

variables:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
BuildConfiguration: Release
BuildPlatform: Any CPU
NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages

jobs:
- job: Windows
pool: VSEng-MicroBuildVS2017
steps:
- checkout: self
clean: true

- powershell: .\init.ps1
displayName: init.ps1 script

- task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@1
displayName: Run PoliCheck
inputs:
targetType: F
optionsFC: 0
optionsXS: 0
optionsHMENABLE: 0
continueOnError: true

- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
displayName: Run CredScan
inputs:
debugMode: false
continueOnError: true

- task: VSBuild@1
displayName: Restore packages
inputs:
msbuildArgs: '/m /t:restore'
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)

- task: VSBuild@1
displayName: 'Build solution PortabilityTools.sln'
inputs:
msbuildArgs: '/m /t:build;pack /bl:$(Build.SourcesDirectory)\bin\$(BuildConfiguration)\msbuild.binlog /p:DeployExtension=False'
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)

- task: VSBuild@1
displayName: Build apiport global tool
inputs:
solution: src/ApiPort/ApiPort/ApiPort.csproj
msbuildArgs: '-t:pack -p:GlobalTool=true'
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)

- script: dotnet publish src/ApiPort/ApiPort/ApiPort.csproj -r win7-x64 -f netcoreapp2.1 --self-contained true
displayName: publish self-contained apiport - win7-x64

- script: dotnet publish src/ApiPort/ApiPort/ApiPort.csproj -r win7-x86 -f netcoreapp2.1 --self-contained true
displayName: publish self-contained apiport - win7-x86

- powershell: |
# Extract rule Ids into a plaintext file that is expected by the Roslyn Analyzer build task
$xdoc = [xml](Get-Content ".\rules.ruleset")
$xdoc.RuleSet.Rules.Rule.Id | Out-File "bin\RoslynAnalyzerSuppressions.txt"
# Add NoWarn Ids
$xdoc = [xml](Get-Content ".\Directory.Build.props")
$xdoc.Project.PropertyGroup.NoWarn -split "," | Select -skip 1 | Where {$_} | Add-Content ".\bin\RoslynAnalyzerSuppressions.txt"
displayName: Extract suppression ids for Roslyn Analyzer task
- task: VSTest@2
displayName: Test with VSTest
inputs:
testAssemblyVer2: |
**\*test*.dll
!**\obj\**
!**\PortabilityServiceIntegrationTests.dll
runOnlyImpactedTests: false
vsTestVersion: '16.0'
runInParallel: false
runTestsInIsolation: false
codeCoverageEnabled: false
platform: $(BuildPlatform)
configuration: $(BuildConfiguration)
diagnosticsEnabled: True

- task: DotNetCoreCLI@2
displayName: Test with dotnet test
inputs:
command: test
projects: |
tests/**/*[Tt]ests/*.csproj
!tests/ApiPort/ApiPortVS.Tests/ApiPortVS.Tests.csproj
!**\PortabilityServiceIntegrationTests.dll
arguments: --configuration $(BuildConfiguration) --no-build

- task: CopyFiles@2
displayName: Copy Analysis files to Staging
inputs:
SourceFolder: bin\$(BuildConfiguration)
Contents: |
ApiPort\**\*
ApiPort.Offline\**\*
ApiPort.Vsix\*.vsix
raw\**\*
*.binlog
TargetFolder: $(Build.StagingDirectory)\drop

- task: CopyFiles@2
displayName: Collection symbol files
inputs:
SourceFolder: bin\$(BuildConfiguration)
Contents: '**\*.pdb'
TargetFolder: $(Build.StagingDirectory)\symbols

- task: securedevelopmentteam.vss-secure-development-tools.build-task-roslynanalyzers.RoslynAnalyzers@2
displayName: Run Roslyn Analyzers
inputs:
suppressionFileForCompilerWarnings: bin\RoslynAnalyzerSuppressions.txt

- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: Component Detection

- publish: $(Build.StagingDirectory)\drop
displayName: Publish drop
artifact: drop-$(Agent.JobName)
enabled: false

- task: securedevelopmentteam.vss-secure-development-tools.build-task-fxcop.FxCop@2
displayName: 'Run FxCop'
inputs:
inputType: Basic
targets: 'bin\$(BuildConfiguration)\ApiPort*\net4*\**\ApiPort*.*;bin\$(BuildConfiguration)\ApiPort.Offline\net4*\**\Microsoft.Fx.*.dll;'
recursive: false
directory: 'C:\Windows\Microsoft.NET\Framework\v4.0.30319'
verbose: true
enabled: false
continueOnError: true

- task: securedevelopmentteam.vss-secure-development-tools.build-task-binskim.BinSkim@3
displayName: 'Run BinSkim '
inputs:
InputType: Basic
AnalyzeTarget: '$(Build.StagingDirectory)\drop\Microsoft.Fx.*.dll;$(Build.StagingDirectory)\drop\ApiPor*.dll;$(Build.StagingDirectory)\drop\ApiPor*.exe'
AnalyzeSymPath: $(Build.StagingDirectory)\symbols
continueOnError: true

- task: securedevelopmentteam.vss-secure-development-tools.build-task-apiscan.APIScan@1
displayName: 'Run APIScan net461'
inputs:
softwareFolder: '$(Build.StagingDirectory)\drop\raw\binaries\net461'
softwareName: 'API Port'
softwareVersionNum: 4.XX
symbolsFolder: '$(Build.StagingDirectory)\drop\raw\symbols\net461'
isLargeApp: false

- task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2
displayName: 'Publish Security Analysis Logs'
condition: succeededOrFailed()

- job: Linux
pool:
vmImage: Ubuntu 18.04
variables:
BuildNetCoreAppTarget: netcoreapp2.1
RestoreBuildProjects: src/ApiPort/ApiPort/*.csproj
steps:
- powershell: .\init.ps1
displayName: init.ps1 script

- task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
command: restore
projects: $(RestoreBuildProjects)
feedsToUse: config
nugetConfigPath: NuGet.config

- task: DotNetCoreCLI@2
displayName: dotnet build
inputs:
projects: $(RestoreBuildProjects)
arguments: '--configuration $(BuildConfiguration) -f $(BuildNetCoreAppTarget) --no-restore'

- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
command: test
projects: |
tests/**/*[Tt]ests/*.csproj
!tests/**/*/ApiPortVS.Tests.csproj
arguments: '--configuration $(BuildConfiguration) --framework $(BuildNetCoreAppTarget) --no-build'

- task: DotNetCoreCLI@2
displayName: dotnet publish
inputs:
command: publish
publishWebProjects: false
projects: $(RestoreBuildProjects)
arguments: '--configuration $(BuildConfiguration) -f $(BuildNetCoreAppTarget) --output $(Build.StagingDirectory) --no-build'
zipAfterPublish: True

- publish: $(Build.StagingDirectory)
displayName: Publish apiport
artifact: drop-$(Agent.JobName)
8 changes: 6 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"sources": [ "src" ]
}
"sdk": {
"version": "2.1.513",
"rollForward": "patch",
"allowPrerelease": false
}
}
3 changes: 1 addition & 2 deletions src/ApiPort/ApiPort.VisualStudio/ApiPort.VisualStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
<!-- Most projects will just inherit this from Directory.Build.props, but since this contains WPF, a temp project is created which causes issues with MSBuildProjectName -->
<OutputPath>$(OutputDrop)\$(AssemblyName)\</OutputPath>
<BaseIntermediateOutputPath>$(OutputFullPath)obj\$(AssemblyName)\</BaseIntermediateOutputPath>
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -163,4 +162,4 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), PortabilityTools.VisualStudio.Imports.targets))\PortabilityTools.VisualStudio.Imports.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="Exists('$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets')" />
</Project>
</Project>
13 changes: 13 additions & 0 deletions version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "2.4-alpha",
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/v\\d+(?:\\.\\d+)?$"
],
"cloudBuild": {
"buildNumber": {
"enabled": true
}
}
}

0 comments on commit e477b31

Please sign in to comment.