ci changes

This commit is contained in:
Ben Adams 2017-11-12 12:40:13 +01:00
parent e7a2f46ff6
commit d4bf1639c7
6 changed files with 80 additions and 6 deletions

View File

@ -1,6 +1,7 @@
# Ben.Demystifier # Ben.Demystifier
[![NuGet version (Ben.Demystifier)](https://img.shields.io/nuget/v/Ben.Demystifier.svg?style=flat-square)](https://www.nuget.org/packages/Ben.Demystifier/) [![NuGet version (Ben.Demystifier)](https://img.shields.io/nuget/v/Ben.Demystifier.svg?style=flat-square)](https://www.nuget.org/packages/Ben.Demystifier/)
[![Build status](https://ci.appveyor.com/api/projects/status/rlhygchfph287fq0?svg=true)](https://ci.appveyor.com/project/benaadams/ben-demystifier)
## High performance understanding for stack traces ## High performance understanding for stack traces

34
appveyor.yml Normal file
View File

@ -0,0 +1,34 @@
image: Visual Studio 2017
shallow_clone: true
branches:
only:
- master
skip_branch_with_pr: true
skip_tags: true
skip_commits:
files:
- BUILDING.md
- CONTRIBUTING.md
- ISSUE_TEMPLATE.md
- LICENCE
- README.md
nuget:
disable_publish_on_pr: true
build_script:
- ps: .\build.ps1 -target appveyor -buildAssemblyVersion ($env:BuildVersion + $env:APPVEYOR_BUILD_NUMBER) -buildSemanticVersion ($env:BuildSemanticVersion + $env:APPVEYOR_BUILD_NUMBER)
test: off
deploy: off
artifacts:
- path: artifacts/build
- path: artifacts/packages
- path: artifacts/test

32
build.ps1 Normal file
View File

@ -0,0 +1,32 @@
<#
.SYNOPSIS
This is a helper function that runs a scriptblock and checks the PS variable $lastexitcode
to see if an error occcured. If an error is detected then an exception is thrown.
This function allows you to run command-line programs without having to
explicitly check the $lastexitcode variable.
.EXAMPLE
exec { svn info $repository_trunk } "Error executing SVN. Please verify SVN command-line client is installed"
#>
function Exec
{
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=1)][scriptblock]$cmd,
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd)
)
& $cmd
if ($lastexitcode -ne 0) {
throw ("Exec: " + $errorMessage)
}
}
if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse }
exec { & dotnet restore }
$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL];
$revision = "{0:D4}" -f [convert]::ToInt32($revision, 10)
exec { & dotnet test .\test\Ben.Demystifier.Test -c Release }
exec { & dotnet pack .\src\Ben.Demystifier -c Release -o .\artifacts --version-suffix=$revision }

View File

@ -6,6 +6,8 @@
<Description>High performance understanding for stack traces (Make error logs more productive)</Description> <Description>High performance understanding for stack traces (Make error logs more productive)</Description>
<Authors>ben_a_adams</Authors> <Authors>ben_a_adams</Authors>
<RepositoryUrl>https://github.com/benaadams/Ben.Demystifier</RepositoryUrl> <RepositoryUrl>https://github.com/benaadams/Ben.Demystifier</RepositoryUrl>
<PackageProjectUrl>https://github.com/benaadams/Ben.Demystifier</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/benaadams/Ben.Demystifier/blob/master/LICENSE</PackageLicenseUrl>
<RepositoryType>git</RepositoryType> <RepositoryType>git</RepositoryType>
<IncludeSymbols>true</IncludeSymbols> <IncludeSymbols>true</IncludeSymbols>
<IncludeSource>true</IncludeSource> <IncludeSource>true</IncludeSource>
@ -14,7 +16,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.0;net46</TargetFrameworks> <TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
<LangVersion>7.2</LangVersion> <LangVersion>7.1</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -8,7 +8,7 @@ namespace System.Collections.Generic.Enumerable
public static EnumerableIList<T> Create<T>(IList<T> list) => new EnumerableIList<T>(list); public static EnumerableIList<T> Create<T>(IList<T> list) => new EnumerableIList<T>(list);
} }
public readonly struct EnumerableIList<T> : IEnumerableIList<T>, IList<T> public struct EnumerableIList<T> : IEnumerableIList<T>, IList<T>
{ {
private readonly IList<T> _list; private readonly IList<T> _list;

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -37,15 +38,19 @@ namespace Demystify
// Assert // Assert
var stackTrace = demystifiedException.ToString(); var stackTrace = demystifiedException.ToString();
stackTrace = ReplaceLineEndings.Replace(stackTrace, ""); stackTrace = ReplaceLineEndings.Replace(stackTrace, "");
var trace = stackTrace.Split(Environment.NewLine); var trace = stackTrace.Split(Environment.NewLine)
// Remove items that vary between test runners
.Where(s =>
s != " at void System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, object state)" &&
s != " at Task Demystify.DynamicCompilation.DoesNotPreventStackTrace()+()=>{}"
)
.ToArray();
Assert.Equal( Assert.Equal(
new[] { new[] {
"System.ArgumentException: Message", "System.ArgumentException: Message",
" at void lambda_method(Closure)", " at void lambda_method(Closure)",
" at Task Demystify.DynamicCompilation.DoesNotPreventThrowStackTrace()+()=>{}", " at async Task Demystify.DynamicCompilation.DoesNotPreventStackTrace()"},
" at void System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, object state)",
" at async Task Demystify.DynamicCompilation.DoesNotPreventThrowStackTrace()"},
trace); trace);
} }