-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.fsx
65 lines (52 loc) · 1.6 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
#r "paket:
source https://api.nuget.org/v3/index.json
nuget Fake.Core.Process
nuget Fake.Core.Target
nuget Fake.DotNet.Cli
nuget Fake.DotNet.MSBuild
nuget Fake.DotNet.Paket
nuget Fake.DotNet.Testing.NUnit
"
#load "./.fake/build.fsx/intellisense.fsx"
open Fake.Core
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.IO.Globbing
open Fake.IO.Globbing.Operators
open Fake.DotNet
open Fake.DotNet.Testing
let buildDir = "build"
let unitTestDir = buildDir </> "unit-test"
Target.create "Clean" (fun _ ->
Shell.cleanDirs [buildDir;]
)
Target.create "Restore" (fun _ ->
Paket.restore (fun param -> {param with ToolType=ToolType.CreateLocalTool()})
DotNet.restore id "nunit-bug.sln"
)
Target.create "Compile" (fun _ ->
!! "nunit-bug.sln"
|> MSBuild.runRelease id unitTestDir "Build"
|> Trace.logItems "AppBuild-Output: "
)
Target.create "Test1" (fun _ ->
let testAssemblies = !! (unitTestDir </> "TestProject1.dll")
let args = Arguments.Empty
|> Arguments.append ["--noheader"; @"--result=build\unit-test\TestResults.xml"]
|> Arguments.append testAssemblies
CreateProcess.fromRawCommand @"packages\NUnit.ConsoleRunner\tools\nunit3-console.exe" (Arguments.toArray args)
|> CreateProcess.ensureExitCode
|> Proc.run // start with the above configuratio
|> ignore
)
Target.create "Test2" (fun _ ->
!! (unitTestDir </> "TestProject1.dll")
|> NUnit3.run (fun p -> {p with ResultSpecs = [unitTestDir </> "TestResults.xml"] })
)
open Fake.Core.TargetOperators
"Clean"
==> "Restore"
==> "Compile"
==> "Test1"
==> "Test2"
Target.runOrDefault "Test2"