Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
Set up CI with Azure Pipelines yml (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
azure-pipelines[bot] authored and bartelink committed Nov 4, 2018
1 parent f8e00a3 commit e392467
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 22 deletions.
12 changes: 5 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Test results
*.trx

# Build results
*.trx
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
Expand All @@ -21,7 +25,7 @@ bld/
[Oo]bj/
[Ll]og/

# Visual Studio 2015 cache/options directory
# Visual Studio 2015+ cache/options directory
.vs/

*_i.c
Expand Down Expand Up @@ -77,12 +81,6 @@ _ReSharper*/
# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
_NCrunch_*
.*crunch*.local.xml
Expand Down
3 changes: 2 additions & 1 deletion CallPolly.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "CallPolly.Tests", "tests\Ca
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".project", ".project", "{6047ADD6-C48C-4583-A5C6-58FDF7A0DC10}"
ProjectSection(SolutionItems) = preProject
build.cmd = build.cmd
azure-pipelines.yml = azure-pipelines.yml
build.proj = build.proj
build.ps1 = build.ps1
Directory.Build.props = Directory.Build.props
global.json = global.json
LICENSE = LICENSE
Expand Down
4 changes: 3 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<Project ToolsVersion="15.0">
<PropertyGroup>
<VersionPrefix>0.0.5</VersionPrefix>
<Authors>@jet @bartelink and contributors</Authors>
<Company>Jet.com</Company>
<Description>Apply systemwide resilience strategies consistently across subsystems, standing on Polly's shoulders</Description>
Expand All @@ -13,5 +12,8 @@
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<!-- disable sourcelink on mono, to workaround https://github.com/dotnet/sourcelink/issues/155 -->
<EnableSourceLink Condition=" '$(OS)' != 'Windows_NT' AND '$(MSBuildRuntimeType)' != 'Core' ">false</EnableSourceLink>
<EnableSourceControlManagerQueries>$(EnableSourceLink)</EnableSourceControlManagerQueries>
</PropertyGroup>
</Project>
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ In service of this, the assumption is that most extensions to CallPolly should l

=> **"can we make CallPolly help you achieve that without making it more complex for everyone else?**

# Building
```
# verify the integrity of the repo wrt being able to build/pack/test
./build.ps1
```

# Taster: example policy

Yes, there should be a real README with real examples; we'll get there :sweat_smile:
Expand Down
64 changes: 64 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: $(Rev:r)
jobs:
- job: Windows
pool:
vmImage: 'vs2017-win2016'
steps:
- powershell: |
$buildId = $env:BUILD_BUILDNUMBER.PadLeft(7, '0');
$versionSuffixPR = "ci-$buildId-pr$($env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)";
$branchName = "$env:BUILD_SOURCEBRANCHNAME".Replace("_","");
$versionSuffixBRANCH = "ci-$buildId";
$isTag = "$env:BUILD_SOURCEBRANCH".StartsWith('refs/tags/');
$isPR = "$env:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER" -ne ""
$versionSuffix = if ($isTag) { "" } else { if ($isPR) { $versionSuffixPR } else { $versionSuffixBRANCH } };
Write-Host "##vso[task.setvariable variable=VersionSuffix]$versionSuffix";
displayName: compute VersionSuffix
- script: dotnet msbuild build.proj
displayName: Test + Build
env:
VersionSuffix: '$(VersionSuffix)'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: 'tests/**/*.trx'
condition: succeededOrFailed()
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: 'bin'
artifactName: 'nupkgs'
- task: NuGetCommand@2
condition: and(succeeded(), or(eq(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/master')))
inputs:
command: push
nuGetFeedType: external
publishFeedCredentials: 'Jet-MyGet'
versioningScheme: byEnvVar
versionEnvVar: Version
packagesToPush: 'bin/*.nupkg;bin/*.symbols.nupkg'
- job: Linux
pool:
vmImage: 'ubuntu-16.04'
steps:
- script: echo "##vso[task.setvariable variable=FrameworkPathOverride]$(dirname $(which mono))/../lib/mono/4.5/"
displayName: Workaround .NET reference assemblies on linux
- script: dotnet msbuild build.proj
displayName: Test + Build
- task: PublishTestResults@2
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: 'tests/**/*.trx'
condition: succeededOrFailed()
- job: MacOS
pool:
vmImage: 'macOS-10.13'
steps:
- script: echo "##vso[task.setvariable variable=FrameworkPathOverride]$(dirname $(which mono))/../lib/mono/4.5/"
displayName: Workaround .NET reference assemblies on linux
- script: dotnet msbuild build.proj
displayName: Test + Build
- task: PublishTestResults@2
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: 'tests/**/*.trx'
condition: succeededOrFailed()
1 change: 0 additions & 1 deletion build.cmd

This file was deleted.

19 changes: 9 additions & 10 deletions build.proj
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
<Project ToolsVersion="15.0" DefaultTargets="Build;Test">
<Project ToolsVersion="15.0" DefaultTargets="Test;Build">

<Import Project="Directory.Build.props" />

<PropertyGroup>

<Name>CallPolly</Name>
<Cfg>--configuration Release</Cfg>

<RepoRootDir>$([System.IO.Path]::GetFullPath("$(MSBuildThisFileDirectory)"))</RepoRootDir>
<Bin>-o $(RepoRootDir)bin</Bin>

<BuildNumber Condition="'$(BuildNumber)' != ''">$([System.String]::Format('{0:0000000}',$([MSBuild]::Add($(BuildNumber), 0))))</BuildNumber>
<Suffix Condition=" '$(BuildNumber)' != '' AND '$(PullRequestId)' != ''">--version-suffix CI$(BuildNumber)-pr$(PullRequestId)</Suffix>
<Suffix Condition=" '$(BuildNumber)' != '' AND '$(PullRequestId)' == ''">--version-suffix CI$(BuildNumber)</Suffix>
<ThisDirAbsolute>$([System.IO.Path]::GetFullPath("$(MSBuildThisFileDirectory)"))</ThisDirAbsolute>
<PackOptions>-o $(ThisDirAbsolute)bin --version-suffix "$(VersionSuffix)"</PackOptions>
<TestOptions>--logger:trx</TestOptions>

</PropertyGroup>

<Target Name="Build">
<Exec Command="dotnet pack src/$(Name) $(Cfg) $(Bin) $(Suffix)" />
<Exec Command="dotnet pack src/$(Name) $(Cfg) $(PackOptions)" />
</Target>

<Target Name="Test">
<Exec Command="dotnet test tests/$(Name).Tests $(Cfg)" />
<Exec Command="dotnet test tests/$(Name).Acceptance $(Cfg)" />
<Exec Command="dotnet test tests/$(Name).Tests $(Cfg) $(TestOptions)" />
<Exec Command="dotnet test tests/$(Name).Acceptance $(Cfg) $(TestOptions)" />
</Target>

</Project>
1 change: 1 addition & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
& dotnet msbuild build.proj @args
9 changes: 8 additions & 1 deletion tests/CallPolly.Acceptance/CallPolly.Acceptance.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<Compile Include="Scenarios.fs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\CallPolly\CallPolly.fsproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="FSharp.Core" Version="3.1.2.5" Condition=" '$(TargetFramework)' == 'net461' " />
<PackageReference Update="FSharp.Core" Version="4.3.4" Condition=" '$(TargetFramework)' == 'netstandard2.0' " />
Expand All @@ -28,8 +32,11 @@
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
</ItemGroup>

<!-- Workaround for https://github.com/xunit/xunit/issues/1357 -->
<ItemGroup>
<ProjectReference Include="..\..\src\CallPolly\CallPolly.fsproj" />
<Content Include="xunit.runner.json" Condition=" '$(OS)' != 'Windows_NT' ">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions tests/CallPolly.Acceptance/xunit.runner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"appDomain": "denied"
}
9 changes: 8 additions & 1 deletion tests/CallPolly.Tests/CallPolly.Tests.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<Compile Include="RulesTests.fs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\CallPolly\CallPolly.fsproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="FSharp.Core" Version="3.1.2.5" Condition=" '$(TargetFramework)' == 'net461' " />
<PackageReference Update="FSharp.Core" Version="4.3.4" Condition=" '$(TargetFramework)' == 'netstandard2.0' " />
Expand All @@ -24,8 +28,11 @@
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
</ItemGroup>

<!-- Workaround for https://github.com/xunit/xunit/issues/1357 -->
<ItemGroup>
<ProjectReference Include="..\..\src\CallPolly\CallPolly.fsproj" />
<Content Include="xunit.runner.json" Condition=" '$(OS)' != 'Windows_NT' ">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>

</Project>
3 changes: 3 additions & 0 deletions tests/CallPolly.Tests/xunit.runner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"appDomain": "denied"
}

0 comments on commit e392467

Please sign in to comment.