-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
443b846
commit 9083e1a
Showing
4 changed files
with
144 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
param ( | ||
[string]$BuildVersionNumber=$(throw "-BuildVersionNumber is required."), | ||
[string]$TagVersionNumber | ||
[string]$BuildVersionNumber=$(throw "-BuildVersionNumber is required."), | ||
[string]$TagVersionNumber | ||
) | ||
|
||
# set version number in package.json | ||
Get-ChildItem -Path $PSScriptRoot\..\src -Filter *.csproj -Recurse | ForEach-Object{ | ||
$ProjectPath = $_.FullName | ||
if ($TagVersionNumber){ | ||
(gc -Path $ProjectPath) ` | ||
-replace "(?<=`"version`":\s`")[.\w-]*(?=`",)", "$TagVersionNumber" | | ||
sc -Path $ProjectPath -Encoding UTF8 | ||
& dotnet restore --no-cache | ||
|
||
foreach ($src in ls $PSScriptRoot\..\src/*) { | ||
Push-Location $src | ||
|
||
Write-Output "build: Building & packaging project in $src" | ||
|
||
if ($TagVersionNumber -ne $null) { | ||
$version = $TagVersionNumber | ||
} | ||
else{ | ||
(gc -Path $ProjectPath) ` | ||
-replace "(?<=`"version`":\s`")[.\w-]*(?=`",)", "$BuildVersionNumber" | | ||
sc -Path $ProjectPath -Encoding UTF8 | ||
else { | ||
$version = $BuildVersionNumber | ||
} | ||
} | ||
|
||
# run restore on all project.json files in the src folder including 2>1 to redirect stderr to stdout for badly behaved tools | ||
Get-ChildItem -Path $PSScriptRoot\..\src -Filter *.csproj -Recurse | ForEach-Object { & dotnet restore $_.FullName 2>1 } | ||
& dotnet build -c Release | ||
& dotnet pack -c Release --include-symbols -o ..\..\artifacts --no-build /p:PackageVersion=$version | ||
if($LASTEXITCODE -ne 0) { exit 1 } | ||
|
||
# run pack on all project.json files in the src folder including 2>1 to redirect stderr to stdout for badly behaved tools | ||
Get-ChildItem -Path $PSScriptRoot\..\src -Filter *.csproj -Recurse | ForEach-Object { & dotnet pack $_.FullName -c Release 2>1 } | ||
Pop-Location | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,70 @@ | ||
param ( | ||
[string]$CoverallsRepoToken=$(throw "-CoverallsRepoToken is required."), | ||
[string]$CoverFilter=$(throw "-CoverFilter is required.") | ||
) | ||
#param ( | ||
# [string]$CoverallsRepoToken=$(throw "-CoverallsRepoToken is required."), | ||
# [string]$CoverFilter=$(throw "-CoverFilter is required.") | ||
#) | ||
|
||
Write-Output "Starting code coverage with filter: $CoverFilter" | ||
#Write-Output "Starting code coverage with filter: $CoverFilter" | ||
|
||
$alwaysFilter = "-[xunit*]* -[Microsoft*]* -[dotnet*]* -[NuGet*]* -[Newtonsoft*]* -[Consul*]* -[Nancy*]* -[AngleSharp]* -[csc]* -[Anonymously*]*" | ||
$filter = "$CoverFilter $alwaysFilter" | ||
#$alwaysFilter = "-[xunit*]* -[Microsoft*]* -[dotnet*]* -[NuGet*]* -[Newtonsoft*]* -[Consul*]* -[Nancy*]* -[AngleSharp]* -[csc]* -[Anonymously*]*" | ||
#$filter = "$CoverFilter $alwaysFilter" | ||
|
||
$packagesPath = $env:USERPROFILE + "\.nuget\packages" | ||
$opencoverPath = $packagesPath + "\OpenCover\4.6.519\tools\OpenCover.Console.exe" | ||
$coverallsPath = $packagesPath + "\coveralls.io\1.3.4\tools\coveralls.net.exe" | ||
$tempPath = "c:\codecoverage" | ||
$tempCoveragePath = $tempPath + "\coverage\" | ||
$tempCoverageFileName = $tempCoveragePath + "coverage.xml" | ||
#$packagesPath = $env:USERPROFILE + "\.nuget\packages" | ||
#$opencoverPath = $packagesPath + "\OpenCover\4.6.519\tools\OpenCover.Console.exe" | ||
#$coverallsPath = $packagesPath + "\coveralls.io\1.3.4\tools\coveralls.net.exe" | ||
#$tempPath = "c:\codecoverage" | ||
#$tempCoveragePath = $tempPath + "\coverage\" | ||
#$tempCoverageFileName = $tempCoveragePath + "coverage.xml" | ||
|
||
# create temp path | ||
if (-not (test-path $tempPath) ) { | ||
mkdir $tempPath | Out-Null | ||
} | ||
## create temp path | ||
#if (-not (test-path $tempPath) ) { | ||
# mkdir $tempPath | Out-Null | ||
#} | ||
|
||
# run opencover | ||
Get-ChildItem -Path $PSScriptRoot\..\test -Filter *.csproj -Recurse | ForEach-Object { | ||
$path = "$tempPath\$($_.Directory.BaseName)" | ||
if (-not (test-path $path) ) { | ||
mkdir $path | Out-Null | ||
} | ||
## run opencover | ||
#Get-ChildItem -Path $PSScriptRoot\..\test -Filter *.csproj -Recurse | ForEach-Object { | ||
# $path = "$tempPath\$($_.Directory.BaseName)" | ||
# if (-not (test-path $path) ) { | ||
# mkdir $path | Out-Null | ||
# } | ||
|
||
$tempBinPath = $path + "\bin\" | ||
$targetArgs = "`"test -o $tempBinPath $($_.FullName)`"" | ||
# $tempBinPath = $path + "\bin\" | ||
# $targetArgs = "`"test -o $tempBinPath $($_.FullName)`"" | ||
|
||
if (-not (test-path $tempBinPath) ) { | ||
mkdir $tempBinPath | Out-Null | ||
} | ||
# if (-not (test-path $tempBinPath) ) { | ||
# mkdir $tempBinPath | Out-Null | ||
# } | ||
|
||
if (-not (test-path $tempCoveragePath) ) { | ||
mkdir $tempCoveragePath | Out-Null | ||
} | ||
# if (-not (test-path $tempCoveragePath) ) { | ||
# mkdir $tempCoveragePath | Out-Null | ||
# } | ||
|
||
& $opencoverPath ` | ||
-register:user ` | ||
-target:"dotnet.exe" ` | ||
-targetargs:$targetArgs ` | ||
-searchdirs:$tempBinPath ` | ||
-output:$tempCoverageFileName ` | ||
-mergebyhash ` | ||
-mergeoutput ` | ||
-skipautoprops ` | ||
-returntargetcode ` | ||
-filter:$filter ` | ||
-hideskipped:Filter ` | ||
-oldstyle | ||
} | ||
# & $opencoverPath ` | ||
# -register:user ` | ||
# -target:"dotnet.exe" ` | ||
# -targetargs:$targetArgs ` | ||
# -searchdirs:$tempBinPath ` | ||
# -output:$tempCoverageFileName ` | ||
# -mergebyhash ` | ||
# -mergeoutput ` | ||
# -skipautoprops ` | ||
# -returntargetcode ` | ||
# -filter:$filter ` | ||
# -hideskipped:Filter ` | ||
# -oldstyle | ||
#} | ||
|
||
# upload to coveralls.io | ||
Write-Output "Sending code coverage results to coveralls.io" | ||
## upload to coveralls.io | ||
#Write-Output "Sending code coverage results to coveralls.io" | ||
|
||
& $coverallsPath ` | ||
--opencover $tempCoverageFileName ` | ||
--full-sources ` | ||
--repo-token $CoverallsRepoToken | ||
#& $coverallsPath ` | ||
# --opencover $tempCoverageFileName ` | ||
# --full-sources ` | ||
# --repo-token $CoverallsRepoToken | ||
|
||
7z a codecoverage.zip $tempCoverageFileName | ||
Push-AppveyorArtifact codecoverage.zip | ||
#7z a codecoverage.zip $tempCoverageFileName | ||
#Push-AppveyorArtifact codecoverage.zip | ||
|
||
pip install codecov | ||
codecov -f $tempCoverageFileName -X gcov | ||
#pip install codecov | ||
#codecov -f $tempCoverageFileName -X gcov | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
Write-Host "PSScriptRoot: " $PSScriptRoot | ||
$CoverFilter='+[Flurl.Http.Xml*]* -[*]*.Logging.* -[*Tests]*' | ||
|
||
Write-Output "Starting code coverage with filter: $CoverFilter" | ||
|
||
$alwaysFilter = "-[xunit*]* -[Microsoft*]* -[dotnet*]* -[NuGet*]* -[Newtonsoft*]* -[Consul*]* -[Nancy*]* -[AngleSharp]* -[csc]* -[Anonymously*]*" | ||
$filter = "$CoverFilter $alwaysFilter" | ||
|
||
$packagesPath = $env:USERPROFILE + "\.nuget\packages" | ||
$opencoverPath = $packagesPath + "\OpenCover\4.6.519\tools\OpenCover.Console.exe" | ||
$coverallsPath = $packagesPath + "\coveralls.io\1.3.4\tools\coveralls.net.exe" | ||
$tempPath = "c:\codecoverage" | ||
$tempCoveragePath = $tempPath + "\coverage\" | ||
$tempCoverageFileName = $tempCoveragePath + "coverage.xml" | ||
|
||
# create temp path | ||
if (-not (test-path $tempPath) ) { | ||
mkdir $tempPath | Out-Null | ||
} | ||
|
||
# run opencover | ||
Get-ChildItem -Path $PSScriptRoot\..\test -Filter *.csproj -Recurse | ForEach-Object { | ||
$path = "$tempPath\$($_.Directory.BaseName)" | ||
if (-not (test-path $path) ) { | ||
mkdir $path | Out-Null | ||
} | ||
|
||
$tempBinPath = $path + "\bin\" | ||
$targetArgs = "`"test -o $tempBinPath $($_.FullName)`"" | ||
|
||
if (-not (test-path $tempBinPath) ) { | ||
mkdir $tempBinPath | Out-Null | ||
} | ||
|
||
if (-not (test-path $tempCoveragePath) ) { | ||
mkdir $tempCoveragePath | Out-Null | ||
} | ||
|
||
& $opencoverPath ` | ||
-register:user ` | ||
-target:"dotnet.exe" ` | ||
-targetargs:$targetArgs ` | ||
-searchdirs:$tempBinPath ` | ||
-output:$tempCoverageFileName ` | ||
-mergebyhash ` | ||
-mergeoutput ` | ||
-skipautoprops ` | ||
-returntargetcode ` | ||
-filter:$filter ` | ||
-hideskipped:Filter ` | ||
-oldstyle | ||
} | ||
<# | ||
# upload to coveralls.io | ||
Write-Output "Sending code coverage results to coveralls.io" | ||
& $coverallsPath ` | ||
--opencover $tempCoverageFileName ` | ||
--full-sources ` | ||
--repo-token $CoverallsRepoToken | ||
7z a codecoverage.zip $tempCoverageFileName | ||
Push-AppveyorArtifact codecoverage.zip | ||
pip install codecov | ||
codecov -f $tempCoverageFileName -X gcov | ||
#> | ||
|