Skip to content

Commit

Permalink
#34 Adding open cover and coveralls.net to build script, open cover a…
Browse files Browse the repository at this point in the history
…t the moment requires projects debug type to be full rather than portable unfortunetly
  • Loading branch information
alhardy committed Dec 23, 2016
1 parent acfc485 commit aefd020
Show file tree
Hide file tree
Showing 15 changed files with 35 additions and 18 deletions.
2 changes: 2 additions & 0 deletions build.cmd
Expand Up @@ -11,6 +11,8 @@ md .nuget
IF EXIST packages\psake goto run
.nuget\NuGet.exe install psake -ExcludeVersion -o packages -nocache
.nuget\NuGet.exe install newtonsoft.json -Version 7.0.1 -ExcludeVersion -o packages -nocache
.nuget\NuGet.exe install OpenCover -ExcludeVersion -o packages -nocache
.nuget\NuGet.exe install coveralls.net -ExcludeVersion -o packages -nocache

:run
:: Get Psake to Return Non-Zero Return Code on Build Failure (https://github.com/psake/psake/issues/58)
Expand Down
23 changes: 19 additions & 4 deletions scripts/default.ps1
Expand Up @@ -7,11 +7,14 @@ Include ".\core\utils.ps1"

$projectFileName = "project.json"
$solutionRoot = (get-item $PSScriptRoot).parent.fullname
$jsonlib= "$solutionRoot\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll"
$jsonlib = "$solutionRoot\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll"
$codeCoverage = "$solutionRoot\packages\OpenCover*\tools\OpenCover.Console.exe"
$coveralls = "$solutionRoot\packages\coveralls.net*\tools\csmacnz.coveralls.exe"
$artifactsRoot = "$solutionRoot\artifacts"
$artifactsBuildRoot = "$artifactsRoot\build"
$artifactsTestRoot = "$artifactsRoot\test"
$artifactsPackagesRoot = "$artifactsRoot\packages"
$artifactsCodeCoverageRoot = "$artifactsRoot\coverage"
$srcRoot = "$solutionRoot\src"
$testsRoot = "$solutionRoot\test"
$globalFilePath = "$solutionRoot\global.json"
Expand Down Expand Up @@ -63,10 +66,22 @@ task Build -depends Restore, Clean {
}

task RunTests -depends Restore, Clean {
$testProjects | foreach {
Write-Output "Running tests for '$_'"
dotnet test "$_"

New-Item $artifactsCodeCoverageRoot -type directory -force

if (-not (Test-Path env:COVERALLS_REPO_TOKEN))
{
Write-Output "Skipping code coverage publish"
$testProjects | foreach {
Write-Output "Running tests for '$_'"
exec { & $codeCoverage "-target:C:\Program Files\dotnet\dotnet.exe" -targetargs:" test -f netcoreapp1.0 -c Release $_" -mergeoutput -hideskipped:All -output:"$artifactsCodeCoverageRoot\coverage.xml" -oldStyle -filter:"+[App.Metrics*]* -[xunit.*]* -[*.Facts]*" -excludebyattribute:"*.ExcludeFromCodeCoverage*" -excludebyfile:"*\*Designer.cs;*\*.g.cs;*\*.g.i.cs" -register:user -skipautoprops -safemode:off }
}
}
else
{
Write-Output "Publishing code coverage"
exec { & $coveralls --opencover -i "$artifactsCodeCoverageRoot\coverage.xml" --repoToken $env:COVERALLS_REPO_TOKEN --commitId $env:APPVEYOR_REPO_COMMIT --commitBranch $env:APPVEYOR_REPO_BRANCH --commitAuthor $env:APPVEYOR_REPO_COMMIT_AUTHOR --commitEmail $env:APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL --commitMessage $env:APPVEYOR_REPO_COMMIT_MESSAGE --jobId $env:APPVEYOR_JOB_ID }
}
}

task PatchProject {
Expand Down
2 changes: 1 addition & 1 deletion src/App.Metrics.Concurrency/project.json
Expand Up @@ -7,7 +7,7 @@
"CS1570"
],
"xmlDoc": true,
"debugType": "portable"
"debugType": "full"
},
"copyright": "Allan Hardy 2016",
"description": "Provides useful structures for performing efficient concurrent operations. Original Project: https://github.com/etishor/ConcurrencyUtilities, including a port of Java's LongAdder and Striped64 classes",
Expand Down
2 changes: 1 addition & 1 deletion src/App.Metrics.Extensions.Middleware/project.json
Expand Up @@ -6,7 +6,7 @@
"CS1591"
],
"xmlDoc": true,
"debugType": "portable"
"debugType": "full"
},
"dependencies": {
"App.Metrics": "1.0.0-beta2",
Expand Down
2 changes: 1 addition & 1 deletion src/App.Metrics.Extensions.Mvc/project.json
Expand Up @@ -6,7 +6,7 @@
"CS1591"
],
"xmlDoc": true,
"debugType": "portable"
"debugType": "full"
},
"dependencies": {
"App.Metrics": "1.0.0-beta2",
Expand Down
2 changes: 1 addition & 1 deletion src/App.Metrics.Extensions.Reporting.Console/project.json
Expand Up @@ -7,7 +7,7 @@
"CS1591"
],
"xmlDoc": true,
"debugType": "portable"
"debugType": "full"
},
"copyright": "Allan Hardy 2016",

Expand Down
2 changes: 1 addition & 1 deletion src/App.Metrics.Extensions.Reporting.InfluxDB/project.json
Expand Up @@ -7,7 +7,7 @@
"CS1591"
],
"xmlDoc": true,
"debugType": "portable"
"debugType": "full"
},
"copyright": "Allan Hardy 2016",

Expand Down
2 changes: 1 addition & 1 deletion src/App.Metrics.Extensions.Reporting.TextFile/project.json
Expand Up @@ -7,7 +7,7 @@
"CS1591"
],
"xmlDoc": true,
"debugType": "portable"
"debugType": "full"
},
"copyright": "Allan Hardy 2016",

Expand Down
2 changes: 1 addition & 1 deletion src/App.Metrics.Formatters.Json/project.json
Expand Up @@ -6,7 +6,7 @@
"CS1591"
],
"xmlDoc": true,
"debugType": "portable"
"debugType": "full"
},
"dependencies": {
"App.Metrics": "1.0.0-beta2",
Expand Down
2 changes: 1 addition & 1 deletion src/App.Metrics/project.json
Expand Up @@ -7,7 +7,7 @@
"CS1570"
],
"xmlDoc": true,
"debugType": "portable"
"debugType": "full"
},
"copyright": "Allan Hardy 2016",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion test/App.Metrics.Concurrency.Facts/project.json
Expand Up @@ -8,7 +8,7 @@
},

"buildOptions": {
"debugType": "portable"
"debugType": "full"
},

"dependencies": {
Expand Down
Expand Up @@ -7,7 +7,7 @@
"win10-x64": {}
},

"buildOptions": { "debugType": "portable" },
"buildOptions": { "debugType": "full" },

"dependencies": {
"App.Metrics.Formatters.Json": {
Expand Down
2 changes: 1 addition & 1 deletion test/App.Metrics.Facts/project.json
Expand Up @@ -7,7 +7,7 @@
"win10-x64": {}
},

"buildOptions": { "debugType": "portable" },
"buildOptions": { "debugType": "full" },

"dependencies": {
"App.Metrics": {
Expand Down
4 changes: 2 additions & 2 deletions test/App.Metrics.Formatters.Json.Facts/project.json
Expand Up @@ -8,9 +8,9 @@
},

"buildOptions": {
"debugType": "portable",
"debugType": "full",
"embed": {
"include": ["JsonFiles/*.json"]
"include": [ "JsonFiles/*.json" ]
}
},

Expand Down
2 changes: 1 addition & 1 deletion test/App.Metrics.Sampling.Facts/project.json
Expand Up @@ -7,7 +7,7 @@
"win10-x64": {}
},

"buildOptions": { "debugType": "portable" },
"buildOptions": { "debugType": "full" },

"dependencies": {
"App.Metrics.Extensions.Middleware": {
Expand Down

0 comments on commit aefd020

Please sign in to comment.