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

Commit

Permalink
Add azure-pipelines.yml file
Browse files Browse the repository at this point in the history
  • Loading branch information
AArnott committed Apr 20, 2020
1 parent 98d8171 commit a62b573
Show file tree
Hide file tree
Showing 3 changed files with 217 additions and 4 deletions.
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>
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
}
}

0 comments on commit a62b573

Please sign in to comment.