-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
task: unit tests get run in build script
- Loading branch information
1 parent
4ba893b
commit 7b5324b
Showing
1 changed file
with
42 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,42 @@ | ||
dotnet restore | ||
dotnet build -c Release | ||
Set-StrictMode -Version latest | ||
$ErrorActionPreference = "Stop" | ||
|
||
|
||
# Taken from psake https://github.com/psake/psake | ||
|
||
<# | ||
.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 = ("Error executing command {0}" -f $cmd) | ||
) | ||
& $cmd | ||
if ($lastexitcode -ne 0) { | ||
throw ("Exec: " + $errorMessage) | ||
} | ||
} | ||
|
||
$config = "release" | ||
|
||
Exec { dotnet restore } | ||
|
||
Exec { dotnet build --configuration $config --no-restore } | ||
|
||
Get-ChildItem .\**\*.csproj -Recurse | Where-Object { $_.Name -match ".*Test(s)?.csproj$"} | ForEach-Object { | ||
Exec { dotnet test $_.FullName --configuration $config --no-build --no-restore } | ||
} | ||
|
||
if (Get-Command "Push-AppveyorArtifact" -errorAction SilentlyContinue) | ||
{ | ||
Get-ChildItem .\*\bin\$config\*.nupkg -Recurse | ForEach-Object { Push-AppveyorArtifact $_.FullName -FileName $_.Name } | ||
} |