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

Commit

Permalink
Code Coverage
Browse files Browse the repository at this point in the history
- Copying code coverage stuff from Chasm
  • Loading branch information
Jonathan Dickinson committed Oct 6, 2017
1 parent c163c14 commit 31871cb
Show file tree
Hide file tree
Showing 22 changed files with 174 additions and 66 deletions.
26 changes: 18 additions & 8 deletions Directory.Build.props
@@ -1,11 +1,10 @@
<Project>

<PropertyGroup>
<Deterministic>false</Deterministic>
</PropertyGroup>
<PropertyGroup>
<Deterministic>false</Deterministic>
</PropertyGroup>

<PropertyGroup>
<VersionPrefix>1.0.0</VersionPrefix>
<PropertyGroup>
<Company>SourceCode Technology Holdings Inc.</Company>
<Product>SourceCode.Clay</Product>
<Copyright>Copyright © 2017 SourceCode Technology Holdings Inc.</Copyright>
Expand All @@ -16,10 +15,21 @@
<NoWarn>1701;1702;1705;S3242</NoWarn>
</PropertyGroup>

<!-- TODO: Remove this when OpenCover supports portable PDBs -->
<!-- https://github.com/OpenCover/opencover/issues/601 -->
<PropertyGroup>
<PackageProjectUrl>https://github.com/k2workflow/Clay/</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/k2workflow/Clay/blob/master/LICENSE</PackageLicenseUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<DebugType>full</DebugType>
<DebugType Condition="'$(Configuration)'=='Release'">pdbonly</DebugType>
</PropertyGroup>

<PropertyGroup>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<GeneratePackageOnBuild Condition="'$(Configuration)'=='Release'">true</GeneratePackageOnBuild>
</PropertyGroup>

<PropertyGroup>
<PackageProjectUrl>https://github.com/k2workflow/Clay/</PackageProjectUrl>
<PackageLicenseUrl>https://raw.githubusercontent.com/k2workflow/Clay/master/LICENSE</PackageLicenseUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
</PropertyGroup>
</Project>
79 changes: 79 additions & 0 deletions GenerateTestSolution.ps1
@@ -0,0 +1,79 @@
# Copyright (c) SourceCode Technology Holdings Inc. All rights reserved.
# Licensed under the MIT License. See LICENSE file in the project root for full license information.

Param(
[Parameter(Mandatory=$True,Position=1)]
[string]$InputSolution,
[Parameter(Mandatory=$False,Position=2)]
[string]$OutputSolution,
[Parameter(Mandatory=$False,Position=3)]
[string]$TestPattern
)

Write-Host "Test Solution Generator version 0.0.1"
Write-Host "Copyright (C) SourceCode Technology Holdings Inc. All rights reserved."

if (-not $OutputSolution) { $OutputSolution = [IO.Path]::ChangeExtension($InputSolution, ".Tests.sln") }

if (Test-Path $OutputSolution) { Remove-Item $OutputSolution }

if (-not $TestPattern) { $TestPattern = '.+?\.Tests' }

$TestPattern = "^\s*Project\("".+?""\)\s*=\s*""$TestPattern"",.+$"

Write-Host "InputSolution: $InputSolution"
Write-Host "OutputSolution: $OutputSolution"
Write-Host "TestPattern: $TestPattern"

$State = 0

foreach ($SlnLine in Get-Content $InputSolution) {

if ($SlnLine -match '^\s*GlobalSection\(NestedProjects\)') {

$State = 4

} elseif ($State -eq 4 -and $SlnLine -match '^\s*EndGlobalSection') {

$State = 3
continue;

} elseif ($SlnLine -match '^\s*Global$') {

$State = 3

}

if ($State -eq 3) {
# Copy build configuration

Add-Content $OutputSolution $SlnLine

} elseif ($SlnLine -match $TestPattern) {
# Copy test projects

$State = 2
Add-Content $OutputSolution $SlnLine
Write-Host "Matched project: $SlnLine"

} elseif ($SlnLine -match '^\s*Project\(') {
#Ignore any preceding non-test projects

$State = 1

} elseif ($State -eq 2) {
# Copy project metadata

Add-Content $OutputSolution $SlnLine
if ($SlnLine -match '^\s*EndProject$') { $State = 1 }

} elseif ($State -eq 0) {
# Copy header

Add-Content $OutputSolution $SlnLine

}

}

Write-Host "Created $OutputSolution."
1 change: 1 addition & 0 deletions README.md
@@ -1,6 +1,7 @@
## Clay

[![Build status](https://ci.appveyor.com/api/projects/status/yg5vnimungm86hf1/branch/master?svg=true)](https://ci.appveyor.com/project/jcdickinson/clay/branch/master)
[![Code Coverage](https://codecov.io/gh/k2workflow/Clay/coverage.svg)](https://codecov.io/gh/k2workflow/Clay)

Tools and extensions to the .Net framework.

Expand Down
4 changes: 4 additions & 0 deletions SourceCode.Clay.sln
Expand Up @@ -41,7 +41,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SourceCode.Clay.Threading.T
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "files", "files", "{B2F708DF-EF63-4F62-A95D-9A148D01421E}"
ProjectSection(SolutionItems) = preProject
appveyor.yml = appveyor.yml
CodeMaid.config = CodeMaid.config
Directory.Build.props = Directory.Build.props
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Global
Expand Down
90 changes: 42 additions & 48 deletions appveyor.yml
@@ -1,63 +1,57 @@
version: '1.0.{build}'
version: 'build-{build}'

image: Visual Studio 2017

configuration:
- Release

platform: Any CPU

environment:
DOTNET_CLI_TELEMETRY_OPTOUT: 1

init:
- ps: $Env:LABEL = "preview1-" + $Env:APPVEYOR_BUILD_NUMBER.PadLeft(5, "0")
- cmd: git config --global core.autocrlf true
- ps: $Env:NUGET_VERSION = "1.0.0-preview1-" + $Env:APPVEYOR_BUILD_NUMBER.PadLeft(5, "0")
- ps: if(-not $env:APPVEYOR_PULL_REQUEST_NUMBER) { $env:is_not_pr = "true"; }

before_build:
- appveyor-retry dotnet restore -v Minimal

build_script:
- dotnet build "src\SourceCode.Clay\SourceCode.Clay.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%
- dotnet build "src\SourceCode.Clay.Tests\SourceCode.Clay.Tests.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%

- dotnet build "src\SourceCode.Clay.Buffers\SourceCode.Clay.Buffers.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%
- dotnet build "src\SourceCode.Clay.Buffers.Tests\SourceCode.Clay.Buffers.Tests.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%

- dotnet build "src\SourceCode.Clay.Collections\SourceCode.Clay.Collections.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%
- dotnet build "src\SourceCode.Clay.Collections.Tests\SourceCode.Clay.Collections.Tests.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%

- dotnet build "src\SourceCode.Clay.Data\SourceCode.Clay.Data.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%
- dotnet build "src\SourceCode.Clay.Data.Tests\SourceCode.Clay.Data.Tests.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%

- dotnet build "src\SourceCode.Clay.Json\SourceCode.Clay.Json.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%
- dotnet build "src\SourceCode.Clay.Json.Tests\SourceCode.Clay.Json.Tests.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%

- dotnet build "src\SourceCode.Clay.Text\SourceCode.Clay.Text.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%
- dotnet build "src\SourceCode.Clay.Text.Tests\SourceCode.Clay.Text.Tests.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%

- dotnet build "src\SourceCode.Clay.Threading\SourceCode.Clay.Threading.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%
- dotnet build "src\SourceCode.Clay.Threading.Tests\SourceCode.Clay.Threading.Tests.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%

- dotnet build "src\SourceCode.Clay.OpenApi\SourceCode.Clay.OpenApi.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%
- dotnet build "src\SourceCode.Clay.OpenApi.Tests\SourceCode.Clay.OpenApi.Tests.csproj" -c %CONFIGURATION% --no-dependencies --version-suffix %LABEL%

after_build:
- dotnet pack "src\SourceCode.Clay\SourceCode.Clay.csproj" -c %CONFIGURATION% --no-build --version-suffix %LABEL%
- dotnet pack "src\SourceCode.Clay.Buffers\SourceCode.Clay.Buffers.csproj" -c %CONFIGURATION% --no-build --version-suffix %LABEL%
- dotnet pack "src\SourceCode.Clay.Collections\SourceCode.Clay.Collections.csproj" -c %CONFIGURATION% --no-build --version-suffix %LABEL%
- dotnet pack "src\SourceCode.Clay.Data\SourceCode.Clay.Data.csproj" -c %CONFIGURATION% --no-build --version-suffix %LABEL%
- dotnet pack "src\SourceCode.Clay.Json\SourceCode.Clay.Json.csproj" -c %CONFIGURATION% --no-build --version-suffix %LABEL%
- dotnet pack "src\SourceCode.Clay.Text\SourceCode.Clay.Text.csproj" -c %CONFIGURATION% --no-build --version-suffix %LABEL%
- dotnet pack "src\SourceCode.Clay.Threading\SourceCode.Clay.Threading.csproj" -c %CONFIGURATION% --no-build --version-suffix %LABEL%
- dotnet pack "src\SourceCode.Clay.OpenApi\SourceCode.Clay.OpenApi.csproj" -c %CONFIGURATION% --no-build --version-suffix %LABEL%

install:
- pip install codecov

dotnet_csproj:
patch: true
file: '**\*.csproj'
version: $(nuget_version)
package_version: $(nuget_version)

build:
project: SourceCode.Clay.sln
verbosity: minimal

test_script:
- dotnet test "src\SourceCode.Clay.Tests\SourceCode.Clay.Tests.csproj" -c %CONFIGURATION% --no-build
- dotnet test "src\SourceCode.Clay.Buffers.Tests\SourceCode.Clay.Buffers.Tests.csproj" -c %CONFIGURATION% --no-build
- dotnet test "src\SourceCode.Clay.Collections.Tests\SourceCode.Clay.Collections.Tests.csproj" -c %CONFIGURATION% --no-build
- dotnet test "src\SourceCode.Clay.Data.Tests\SourceCode.Clay.Data.Tests.csproj" -c %CONFIGURATION% --no-build
- dotnet test "src\SourceCode.Clay.Json.Tests\SourceCode.Clay.Json.Tests.csproj" -c %CONFIGURATION% --no-build
- dotnet test "src\SourceCode.Clay.Text.Tests\SourceCode.Clay.Text.Tests.csproj" -c %CONFIGURATION% --no-build
- dotnet test "src\SourceCode.Clay.Threading.Tests\SourceCode.Clay.Threading.Tests.csproj" -c %CONFIGURATION% --no-build
- dotnet test "src\SourceCode.Clay.OpenApi.Tests\SourceCode.Clay.OpenApi.Tests.csproj" -c %CONFIGURATION% --no-build
- ps: .\GenerateTestSolution.ps1 .\SourceCode.Clay.sln
- >-
OpenCover.Console.exe
-target:"dotnet.exe"
-targetargs:"test SourceCode.Clay.Tests.sln -c %CONFIGURATION% --no-build"
-filter:"+[*]* -[*.Tests]*"
-output:"%APPVEYOR_BUILD_FOLDER%\coverage.xml"
-excludebyattribute:*.ExcludeFromCodeCoverage*
-oldStyle
-register:user
-mergebyhash
-hideskipped:File
after_test:
- >-
codecov
-X gcov
-f "%APPVEYOR_BUILD_FOLDER%\coverage.xml"
artifacts:
- path: '**\*.nupkg'
- path: 'coverage.xml'

deploy:
provider: NuGet
api_key:
Expand Down
Expand Up @@ -10,6 +10,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0-preview-20170923-02" />
<PackageReference Include="OpenCover" Version="4.6.519" />
<PackageReference Include="xunit" Version="2.3.0-rc3-build3818" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-rc3-build3818" />
</ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/SourceCode.Clay.Buffers/SourceCode.Clay.Buffers.csproj
Expand Up @@ -18,8 +18,9 @@
<PropertyGroup>
<PackageId>SourceCode.Clay.Buffers</PackageId>
<Authors>SourceCode</Authors>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Description>Tools and extensions for working with buffers.</Description>
<PackageTags>clay utility extension buffer byte array</PackageTags>
<Version>1.0.0-local</Version>
<PackageVersion>1.0.0-local</PackageVersion>
</PropertyGroup>
</Project>
Expand Up @@ -17,6 +17,7 @@

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.10.9" />
<PackageReference Include="OpenCover" Version="4.6.519" />
</ItemGroup>

<ItemGroup>
Expand Down
Expand Up @@ -10,6 +10,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0-preview-20170923-02" />
<PackageReference Include="OpenCover" Version="4.6.519" />
<PackageReference Include="xunit" Version="2.3.0-rc3-build3818" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-rc3-build3818" />
</ItemGroup>
Expand Down
Expand Up @@ -18,8 +18,9 @@
<PropertyGroup>
<PackageId>SourceCode.Clay.Collections</PackageId>
<Authors>SourceCode</Authors>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Description>Tools and extensions for working with collections.</Description>
<PackageTags>clay utility extension dictionary switch list set</PackageTags>
<Version>1.0.0-local</Version>
<PackageVersion>1.0.0-local</PackageVersion>
</PropertyGroup>
</Project>
Expand Up @@ -10,6 +10,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0-preview-20170923-02" />
<PackageReference Include="OpenCover" Version="4.6.519" />
<PackageReference Include="xunit" Version="2.3.0-rc3-build3818" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-rc3-build3818" />
</ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/SourceCode.Clay.Data/SourceCode.Clay.Data.csproj
Expand Up @@ -22,8 +22,9 @@
<PropertyGroup>
<PackageId>SourceCode.Clay.Data</PackageId>
<Authors>SourceCode</Authors>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Description>Tools and extensions for working with data.</Description>
<PackageTags>clay utility extension sql connection tsql parser</PackageTags>
<Version>1.0.0-local</Version>
<PackageVersion>1.0.0-local</PackageVersion>
</PropertyGroup>
</Project>
Expand Up @@ -10,6 +10,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0-preview-20170923-02" />
<PackageReference Include="OpenCover" Version="4.6.519" />
<PackageReference Include="xunit" Version="2.3.0-rc3-build3818" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-rc3-build3818" />
</ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/SourceCode.Clay.Json/SourceCode.Clay.Json.csproj
Expand Up @@ -22,8 +22,9 @@
<PropertyGroup>
<PackageId>SourceCode.Clay.Json</PackageId>
<Authors>SourceCode</Authors>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Description>Tools and extensions for working with json.</Description>
<PackageTags>clay utility extension json validate</PackageTags>
<Version>1.0.0-local</Version>
<PackageVersion>1.0.0-local</PackageVersion>
</PropertyGroup>
</Project>
Expand Up @@ -8,6 +8,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0-preview-20170923-02" />
<PackageReference Include="OpenCover" Version="4.6.519" />
<PackageReference Include="xunit" Version="2.3.0-rc3-build3818" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-rc3-build3818" />
</ItemGroup>
Expand Down
10 changes: 6 additions & 4 deletions src/SourceCode.Clay.OpenApi/SourceCode.Clay.OpenApi.csproj
Expand Up @@ -7,6 +7,10 @@
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>

<PropertyGroup>
<NoWarn>1701;1702;1705;S3242;S4035</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Net.Compilers" Version="2.3.2" />
<PackageReference Include="SonarAnalyzer.CSharp" Version="6.4.1.3596">
Expand All @@ -26,9 +30,7 @@
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Description>DTOs for Open API 3.0.0.</Description>
<PackageTags>clay json open-api swagger</PackageTags>
</PropertyGroup>

<PropertyGroup>
<NoWarn>1701;1702;1705;S3242;S4035</NoWarn>
<Version>1.0.0-local</Version>
<PackageVersion>1.0.0-local</PackageVersion>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions src/SourceCode.Clay.Tests/SourceCode.Clay.Tests.csproj
Expand Up @@ -10,6 +10,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0-preview-20170923-02" />
<PackageReference Include="OpenCover" Version="4.6.519" />
<PackageReference Include="xunit" Version="2.3.0-rc3-build3818" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-rc3-build3818" />
</ItemGroup>
Expand Down
Expand Up @@ -10,6 +10,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0-preview-20170923-02" />
<PackageReference Include="OpenCover" Version="4.6.519" />
<PackageReference Include="xunit" Version="2.3.0-rc3-build3818" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-rc3-build3818" />
</ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/SourceCode.Clay.Text/SourceCode.Clay.Text.csproj
Expand Up @@ -20,5 +20,7 @@
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Description>Tools and extensions for working with text.</Description>
<PackageTags>clay utility extension string stringbuilder</PackageTags>
<Version>1.0.0-local</Version>
<PackageVersion>1.0.0-local</PackageVersion>
</PropertyGroup>
</Project>
Expand Up @@ -10,6 +10,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0-preview-20170923-02" />
<PackageReference Include="OpenCover" Version="4.6.519" />
<PackageReference Include="xunit" Version="2.3.0-rc3-build3818" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.0-rc3-build3818" />
</ItemGroup>
Expand Down

0 comments on commit 31871cb

Please sign in to comment.