-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.fsx
96 lines (71 loc) · 2.06 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
80
81
82
83
84
85
86
87
88
89
90
91
#r "paket:
source https://api.nuget.org/v3/index.json
framework: netstandard2.0
nuget FSharp.Core < 5
nuget Fake.Core
nuget Fake.Core.Target
nuget Fake.Core.ReleaseNotes
nuget Fake.DotNet.Cli
nuget Fake.DotNet.Paket //"
#load ".fake/build.fsx/intellisense.fsx"
open System
open Fake.Core
open Fake.Core.TargetOperators
open Fake.IO
open Fake.IO.FileSystemOperators
open Fake.DotNet
module BuildPath =
let root = __SOURCE_DIRECTORY__
let bin = root </> "bin"
let nuget = bin </> "nuget"
let test = bin </> "test"
let sln = Directory.findFirstMatchingFile "*.sln" root
let releaseNotes = root </> "RELEASE_NOTES.md"
let releaseNotes = ReleaseNotes.load BuildPath.releaseNotes
let version =
let semver = releaseNotes.SemVer
let build =
Environment.environVarOrNone "GITHUB_RUN_NUMBER"
|> Option.bind (fun v ->
match UInt32.TryParse v with
| true, n -> Some n
| false, _ -> None)
|> Option.defaultValue 0u
{ semver with Original = None
Patch = build }
Target.create "Clean" <| fun _ ->
Directory.delete BuildPath.bin
Target.create "Build" <| fun _ ->
DotNet.build (fun p ->
{ p with
Configuration = DotNet.BuildConfiguration.Release } )
BuildPath.sln
Target.create "Test" <| fun _ ->
let fx =
if Environment.isWindows then
None
else
Some "netcoreapp3.1"
DotNet.test (fun p ->
{ p with
Configuration = DotNet.BuildConfiguration.Release
NoBuild = true
Framework = fx
ResultsDirectory = Some BuildPath.test
} )
BuildPath.sln
Target.create "Nuget" <| fun _ ->
Paket.pack (fun p ->
{ p with
BuildConfig = "Release"
OutputPath = BuildPath.nuget
Version = version.AsString
ToolType = ToolType.CreateLocalTool() }
)
Target.create "All" ignore
"Clean"
==> "Build"
==> "Test"
==> "Nuget"
==> "All"
Target.runOrDefault "All"