forked from chucknorris/roundhouse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
executable file
·64 lines (44 loc) · 1.76 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env pwsh
$MSBUILD=msbuild
$root = $PSScriptRoot;
$CODEDROP="$($root)\code_drop";
$LOGDIR="$($CODEDROP)\log";
$TESTOUTDIR="$($root)\product\roundhouse.tests\bin"
$onAppVeyor = $("$($env:APPVEYOR)" -eq "True");
pushd $root
"`n"
" * Generating version number"
$gitVersion = (GitVersion | ConvertFrom-Json)
If ($onAppVeyor) {
$newVersion="$($gitVersion.FullSemVer)"
Write-host " - Updating appveyor build version to: $newVersion"
$env:APPVEYOR_BUILD_VERSION="$newVersion"
appveyor UpdateBuild -Version "$newVersion"
}
" * Restoring nuget packages"
nuget restore -NonInteractive -Verbosity quiet
# Create output and log dirs if they don't exist (don't know why this is necessary - works on my box...)
If (!(Test-Path $CODEDROP)) {
$null = mkdir $CODEDROP;
}
If (!(Test-Path $LOGDIR)) {
$null = mkdir $LOGDIR;
}
" * Building and packaging"
msbuild /t:"Build;Pack" /p:DropFolder=$CODEDROP /p:Version="$($gitVersion.FullSemVer)" /p:NoPackageAnalysis=true /nologo /v:q /fl /flp:"LogFile=$LOGDIR\msbuild.log;Verbosity=n" /p:Configuration=Build /p:Platform="Any CPU"
# AppVeyor runs the test automagically, no need to run explicitly with nunit-console.exe.
# But we want to run the tests on localhost too.
If (! $onAppVeyor) {
# Find nunit3-console dynamically
"`n * Looking for nunit3-console.exe"
$nugetRoot = $env:NUGET_PACKAGES;
If ("$($nugetRoot)" -eq "") {
$nugetRoot = "~/.nuget"
}
$nunit = $(dir -r "$($nugetRoot)/packages/nunit*" -i nunit3-console.exe | Select-Object -last 1)
" - Found at $($nunit)"
"`n * Running unit tests`n"
$tests = $(dir -r "$($TESTOUTDIR)" -i *.tests.dll);
& $nunit --noheader --noresult --output "$($LOGDIR)/nunit.log" --err="$($LOGDIR)/nunit.errlog" $tests
}
popd