Skip to content

Commit 7c64e06

Browse files
committed
refactoring scripts so the build server can run each in-step
1 parent d7634c1 commit 7c64e06

File tree

3 files changed

+61
-12
lines changed

3 files changed

+61
-12
lines changed

build.cmd

+13
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@ IF NOT [%1]==[] (set TARGET="%1")
1212
SET BUILDMODE="Release"
1313
IF NOT [%2]==[] (set BUILDMODE="%2")
1414

15+
:: because we want to run specific steps inline on qed
16+
:: we need to break the dependency chain
17+
:: this ensures we do a build before running any tests
18+
19+
if TARGET=="Default" (SET RunBuild=1)
20+
if TARGET=="RunUnitTests" (SET RunBuild=1)
21+
if TARGET=="RunIntegrationTests" (SET RunBuild=1)
22+
if TARGET=="CreatePackages" (SET RunBuild=1)
23+
24+
if "%RunBuild%"=="" (
25+
"tools\FAKE.Core\tools\Fake.exe" "build.fsx" "target=BuildApp" "buildMode=%BUILDMODE%"
26+
)
27+
1528
"tools\FAKE.Core\tools\Fake.exe" "build.fsx" "target=%TARGET%" "buildMode=%BUILDMODE%"
1629

1730
rem Bail if we're running a TeamCity build.

build.fsx

+12-5
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,21 @@ Target "CreateOctokitReactivePackage" (fun _ ->
131131

132132
Target "Default" DoNothing
133133

134+
Target "CreatePackages" DoNothing
135+
134136
"Clean"
135137
==> "AssemblyInfo"
136138
==> "CheckProjects"
137-
==> "BuildApp"
138-
==> "UnitTests"
139-
==> "IntegrationTests"
140-
==> "CreateOctokitPackage"
141-
==> "CreateOctokitReactivePackage"
139+
==> "BuildApp"
140+
141+
"UnitTests"
142142
==> "Default"
143143

144+
"IntegrationTests"
145+
==> "Default"
146+
147+
"CreateOctokitPackage"
148+
"CreateOctokitReactivePackage"
149+
==> "CreatePackages"
150+
144151
RunTargetOrDefault "Default"

script/cibuild.ps1

+36-7
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ function Die-WithOutput($exitCode, $output) {
3535
exit $exitCode
3636
}
3737

38+
function Dump-Error($output) {
39+
$exitCode = $LastExitCode
40+
41+
$errors = $output | Select-String ": error"
42+
if ($errors) {
43+
$output = "Likely errors:", $errors, "", "Full output:", $output
44+
}
45+
46+
Die-WithOutput $exitCode $output
47+
}
48+
3849
function Run-Command([scriptblock]$Command, [switch]$Fatal, [switch]$Quiet) {
3950
$output = ""
4051
if ($Quiet) {
@@ -81,16 +92,34 @@ else {
8192

8293
Write-Output "Building Octokit..."
8394
Write-Output ""
84-
$output = .\tools\FAKE.Core\tools\Fake.exe "build.fsx" "target=Default" "buildMode=Release"
95+
$output = & .\tools\FAKE.Core\tools\Fake.exe "build.fsx" "target=BuildApp" "buildMode=Release" 2>&1
8596
if ($LastExitCode -ne 0) {
86-
$exitCode = $LastExitCode
97+
Dump-Error($output)
98+
}
8799

88-
$errors = $output | Select-String ": error"
89-
if ($errors) {
90-
$output = "Likely errors:", $errors, "", "Full output:", $output
91-
}
100+
Write-Output "Running unit tests..."
101+
Write-Output ""
102+
$output = & .\tools\FAKE.Core\tools\Fake.exe "build.fsx" "target=UnitTests" "buildMode=Release" 2>&1
103+
if ($LastExitCode -ne 0) {
104+
Dump-Error($output)
105+
}
92106

93-
Die-WithOutput $exitCode $output
107+
Write-Output "Running integration tests..."
108+
Write-Output ""
109+
$output = & .\tools\FAKE.Core\tools\Fake.exe "build.fsx" "target=IntegrationTests" "buildMode=Release" 2>&1
110+
if ($LastExitCode -ne 0) {
111+
Dump-Error($output)
112+
}
113+
114+
Write-Output "Creating NuGet packages..."
115+
Write-Output ""
116+
$output = & .\tools\FAKE.Core\tools\Fake.exe "build.fsx" "target=CreateOctokitPackage" "buildMode=Release" 2>&1
117+
if ($LastExitCode -ne 0) {
118+
Dump-Error($output)
119+
}
120+
$output = & .\tools\FAKE.Core\tools\Fake.exe "build.fsx" "target=CreateOctokitReactivePackage" "buildMode=Release" 2>&1
121+
if ($LastExitCode -ne 0) {
122+
Dump-Error($output)
94123
}
95124

96125
$exitCode = 0

0 commit comments

Comments
 (0)