Last active
October 3, 2016 10:51
-
-
Save ArturKarbone/c1875a1b99a0d00e87389ee03d36a4c8 to your computer and use it in GitHub Desktop.
Simple .NET Core CI pipeline
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
. ".\CI.Functions.ps1" | |
echo "build: CI Pipeline started" | |
Push-Location $PSScriptRoot | |
CleanUpArtifactsDirectory | |
RestoreSolutionPackages | |
BuildAndPackageArtifacts src/* | |
BuildAndPackageArtifacts utilities/* | |
BuildAndLaunchUnitTests | |
BuildAndLaunchIntegrationTests | |
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
function CleanUpArtifactsDirectory | |
{ | |
if(Test-Path .\.artifacts) { | |
echo "build: Cleaning .\.artifacts" | |
Remove-Item .\.artifacts -Force -Recurse | |
} | |
} | |
function RestoreSolutionPackages | |
{ | |
dotnet restore --no-cache --disable-parallel | |
} | |
Function BuildTests($location) | |
{ | |
foreach ($test in ls $location) { | |
Push-Location $test | |
echo "build: Building a test project in $test" | |
& dotnet build -c Development | |
if($LASTEXITCODE -ne 0) { exit 2 } | |
Pop-Location | |
} | |
} | |
Function LaunchTests($location) | |
{ | |
foreach ($test in ls $location) { | |
Push-Location $test | |
echo "build: Testing project in $test" | |
dotnet test -c Development | |
if($LASTEXITCODE -ne 0) { exit 3 } | |
#echo %errorlevel% | |
Pop-Location | |
} | |
} | |
Function BuildAndLaunchUnitTests | |
{ | |
BuildTests test/*.Tests | |
LaunchTests test/*.Tests | |
} | |
Function BuildAndLaunchIntegrationTests | |
{ | |
BuildTests test/*.IntegrationTests | |
LaunchTests test/*.IntegrationTests | |
} | |
function BuildAndPackageArtifacts($location) | |
{ | |
foreach ($src in ls $location) { | |
Push-Location $src | |
echo "build: Packaging project in $src" | |
& dotnet pack -c Release -o ..\..\.artifacts | |
if($LASTEXITCODE -ne 0) { exit 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
. ".\CI.Functions.ps1" | |
echo "build: CB Build started" | |
Push-Location $PSScriptRoot | |
CleanUpArtifactsDirectory | |
RestoreSolutionPackages | |
BuildAndPackageArtifacts src/* | |
BuildAndPackageArtifacts utilities/* | |
BuildAndLaunchUnitTests | |
BuildAndLaunchIntegrationTests | |
Pop-Location | |
function CleanUpArtifactsDirectory | |
{ | |
if(Test-Path .\.artifacts) { | |
echo "build: Cleaning .\.artifacts" | |
Remove-Item .\.artifacts -Force -Recurse | |
} | |
} | |
function RestoreSolutionPackages | |
{ | |
dotnet restore --no-cache --disable-parallel | |
} | |
Function BuildTests($location) | |
{ | |
foreach ($test in ls $location) { | |
Push-Location $test | |
echo "==============build: Building a test project in $test==============" | |
& dotnet build -c Development | |
if($LASTEXITCODE -ne 0) { exit 2 } | |
Pop-Location | |
} | |
} | |
Function LaunchTests($location) | |
{ | |
foreach ($test in ls $location) { | |
Push-Location $test | |
echo "build: Testing project in $test" | |
dotnet test -c Development | |
if($LASTEXITCODE -ne 0) { exit 3 } | |
#echo %errorlevel% | |
Pop-Location | |
} | |
} | |
Function BuildAndLaunchUnitTests | |
{ | |
BuildTests test/*.Tests | |
LaunchTests test/*.Tests | |
} | |
Function BuildAndLaunchIntegrationTests | |
{ | |
BuildTests test/*.IntegrationTests | |
LaunchTests test/*.IntegrationTests | |
} | |
function BuildAndPackageArtifacts($location) | |
{ | |
foreach ($src in ls $location) { | |
Push-Location $src | |
echo "build: Packaging project in $src" | |
& dotnet pack -c Release -o ..\..\.artifacts | |
if($LASTEXITCODE -ne 0) { exit 1 } | |
Pop-Location | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment