forked from alexeyzimarev/Autofac.Extras.ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.fsx
79 lines (64 loc) · 1.87 KB
/
build.fsx
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// include Fake libs
#r "src/packages/FAKE/tools/FakeLib.dll"
open Fake
open Fake.Paket
open Fake.FileUtils
open Fake.Testing.XUnit2
open System
// Directories
let rootDir = currentDirectory
let buildDir = currentDirectory + "/bin/"
let nugetDir = currentDirectory + "/nuget/"
let testOutputDir = currentDirectory + "/testResults/"
let nugetApiKey = environVar "BAMBOO_nugetApiKey"
let nugetPublishUrl = environVar "BAMBOO_nugetPublishUrl"
let nugetVersion = getBuildParamOrDefault "nugetVersion" null
// Filesets
let appReferences =
!! "src/**/*.csproj"
// Targets
Target "Clean" (fun _ ->
CleanDirs [buildDir; nugetDir; testOutputDir]
MSBuildRelease buildDir "Clean" appReferences
|> Log "Clean-Output: "
)
Target "BuildApp" (fun _ ->
MSBuildRelease buildDir "Build" appReferences
|> Log "BuildApp-Output: "
)
Target "Test" (fun _ ->
let testAssemblies =
!! (buildDir @@ "/*Tests.dll")
if testAssemblies |> Seq.isEmpty then
traceError "No test assemblies found"
()
else
testAssemblies |> xUnit2 (fun p ->
{ p with
NUnitXmlOutputPath = Some (testOutputDir + "testresults.xml");
ToolPath = @"src/packages/xunit.runner.console/tools/xunit.console.exe"
})
)
Target "Pack" (fun _ ->
Pack (fun p ->
let p' = {p with OutputPath = nugetDir; WorkingDir = rootDir + "/src" }
if nugetVersion = null then p' else {p' with Version = nugetVersion }
)
)
Target "Push" (fun _ ->
Push (fun p ->
{p with
ApiKey = nugetApiKey
PublishUrl = nugetPublishUrl
WorkingDir = nugetDir
TimeOut = TimeSpan.FromSeconds(5.0)
})
)
// Build order
"Clean"
==> "BuildApp"
==> "Test"
==> "Pack"
==> "Push"
// start build
RunTargetOrDefault "Build"