Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The build script restores dependencies, builds, and runs tests.
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 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 |
---|---|---|
|
@@ -4,3 +4,5 @@ | |
*.json text | ||
*.txt text | ||
*.md text | ||
*.cmd text | ||
*.ps1 text |
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,3 @@ | ||
@echo off | ||
|
||
powershell -NoProfile -ExecutionPolicy Bypass -Command "& '.\build.ps1' %*;" |
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,45 @@ | ||
function main { | ||
step { Restore } | ||
step { Build } | ||
step { Test } | ||
} | ||
|
||
function Restore { | ||
exec { & dotnet restore --verbosity Warning } | ||
} | ||
|
||
function Build() { | ||
exec { & dotnet build .\src\Parsley --configuration Release } | ||
exec { & dotnet build .\src\Parsley.Tests --configuration Release } | ||
} | ||
|
||
function Test { | ||
exec { & dotnet test .\src\Parsley.Tests --configuration Release } | ||
} | ||
|
||
function step($block) { | ||
$name = $block.ToString().Trim().Split(' ')[0] | ||
write-host "Executing $name" -fore CYAN | ||
&$block | ||
} | ||
|
||
function exec($cmd) { | ||
$global:lastexitcode = 0 | ||
& $cmd | ||
if ($lastexitcode -ne 0) { | ||
throw "Error executing command:$cmd" | ||
} | ||
} | ||
|
||
try { | ||
main | ||
write-host | ||
write-host "Build Succeeded!" -fore GREEN | ||
exit 0 | ||
} catch [Exception] { | ||
write-host | ||
write-host $_.Exception.Message -fore DARKRED | ||
write-host | ||
write-host "Build Failed!" -fore DARKRED | ||
exit 1 | ||
} |