Skip to content

Commit

Permalink
Add Azure Pipelines definition
Browse files Browse the repository at this point in the history
  • Loading branch information
natemcmaster committed Jan 19, 2019
1 parent 2c1b7b8 commit ca93b75
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ indent_size = 2
[*.json]
indent_size = 2

[*.yml]
indent_size = 2

[*.cs]
indent_size = 4

Expand Down
55 changes: 55 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: $(Date:yyMMdd).$(Rev:rr)

trigger:
- '*'

pr:
- '*'

variables:
- group: AzureKeyVault
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
value: 1

jobs:
- job: Windows
pool:
vmImage: vs2017-win2016
steps:
- task: DotNetCoreInstaller@0
displayName: Install .NET Core 2.2
inputs:
version: '2.2.102'
- powershell: ./build.ps1 -ci /p:AzureKeyVaultClientSecret=$(kv-access-token)
displayName: Invoke build.ps1
- task: PublishTestResults@2
displayName: Upload test results
condition: always()
continueOnError: true
inputs:
testRunTitle: Windows
testRunner: vstest
testResultsFiles: '**/*.trx'
- task: PublishBuildArtifacts@1
displayName: Publish artifacts
inputs:
pathtoPublish: 'artifacts/'
artifactName: 'Packages'
- job: Linux
pool:
vmImage: 'Ubuntu-16.04'
steps:
- task: DotNetCoreInstaller@0
displayName: Install .NET Core 2.2
inputs:
version: '2.2.102'
- script: ./build.ps1 -ci
displayName: Invoke build.ps1
- task: PublishTestResults@2
displayName: Upload test results
condition: always()
continueOnError: true
inputs:
testRunTitle: Linux
testRunner: vstest
testResultsFiles: '**/*.trx'
10 changes: 9 additions & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ if ($ci) {
$MSBuildArgs += '-p:CI=true'
}

$CodeSign = $sign -or ($ci -and -not $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -and ($IsWindows -or -not $IsCoreCLR))
$isPr = $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -or ($env:BUILD_REASON -eq 'PullRequest')
if (-not (Test-Path variable:\IsCoreCLR)) {
$IsWindows = $true
}

$CodeSign = $sign -or ($ci -and -not $isPr -and $IsWindows)

if ($CodeSign) {
$toolsDir = "$PSScriptRoot/.build/tools"
Expand Down Expand Up @@ -72,6 +77,9 @@ exec dotnet pack --no-restore --no-build --configuration $Configuration -o $arti
if ($PSVersionTable.PSEdition -eq 'Core' -and -not $IsWindows) {
$testArgs += '--framework','netcoreapp2.1'
}
if ($env:TF_BUILD) {
$testArgs += '--logger', 'trx'
}

exec dotnet test --no-restore --no-build --configuration $Configuration '-clp:Summary' `
"$PSScriptRoot/test/CommandLineUtils.Tests/McMaster.Extensions.CommandLineUtils.Tests.csproj" `
Expand Down
10 changes: 6 additions & 4 deletions version.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
<PropertyGroup>
<VersionPrefix>2.3.1</VersionPrefix>
<VersionSuffix>build</VersionSuffix>
<PackageVersion Condition="'$(APPVEYOR_REPO_TAG)' == 'true' AND '$(VersionSuffix)' != ''">$(VersionPrefix)-$(VersionSuffix)</PackageVersion>
<PackageVersion Condition="'$(APPVEYOR_REPO_TAG)' == 'true' AND '$(VersionSuffix)' == 'rtm'">$(VersionPrefix)</PackageVersion>

<IncludePreReleaseLabelInPackageVersion Condition="'$(IsFinalBuild)' != 'true'">true</IncludePreReleaseLabelInPackageVersion>
<BuildNumber Condition=" '$(BuildNumber)' == '' ">$(APPVEYOR_BUILD_NUMBER)</BuildNumber>
<BuildNumber Condition=" '$(BuildNumber)' == '' ">$(BUILD_BUILDNUMBER)</BuildNumber>
<BuildNumber Condition=" '$(BuildNumber)' == '' ">0</BuildNumber>
<FileVersion>$(VersionPrefix).$(BuildNumber)</FileVersion>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' ">$(VersionSuffix).$(BuildNumber)</VersionSuffix>
<RepositoryCommit>$(APPVEYOR_REPO_COMMIT)</RepositoryCommit>
<RepositoryCommit Condition="'$(RepositoryCommit)' == ''">$(APPVEYOR_REPO_COMMIT)</RepositoryCommit>
<RepositoryCommit Condition="'$(RepositoryCommit)' == ''">$(BUILD_SOURCEVERSION)</RepositoryCommit>
<PackageVersion>$(VersionPrefix)</PackageVersion>
<PackageVersion Condition="'$(IncludePreReleaseLabelInPackageVersion)' == 'true'">$(PackageVersion)-$(VersionSuffix)</PackageVersion>
<InformationalVersion Condition="'$(RepositoryCommit)' != ''">$(PackageVersion)+$(RepositoryCommit)</InformationalVersion>
</PropertyGroup>
</Project>

0 comments on commit ca93b75

Please sign in to comment.