-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.fsx
122 lines (99 loc) · 2.69 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// include Fake libs
#r "./packages/build/FAKE/tools/FakeLib.dll"
#r "System.IO.Compression.FileSystem"
open System
open System.IO
open Fake
open Fake.YarnHelper
open Fake.Git
let dotnetcliVersion = "2.1.4"
let mutable dotnetExePath = "dotnet"
let runDotnet dir =
DotNetCli.RunCommand (fun p -> { p with ToolPath = dotnetExePath
WorkingDir = dir } )
Target "InstallDotNetCore" (fun _ ->
dotnetExePath <- DotNetCli.InstallDotNetSDK dotnetcliVersion
)
Target "Clean" (fun _ ->
!! "bin"
++ "obj"
|> CleanDirs
)
Target "Install" (fun _ ->
runDotnet "" "restore"
)
Target "InstallYarn" (fun _ ->
Yarn (fun p ->
{ p with
Command = Install Standard
})
)
Target "Build" (fun _ ->
runDotnet "" "build"
)
Target "CleanTests" (fun _->
!! "tests/bin"
++ "tests/obj"
|> CleanDirs
)
Target "InstallTests" (fun _ ->
runDotnet "tests" "restore"
)
Target "BuildTests" (fun _ ->
runDotnet "tests" "build"
)
Target "RunTests" (fun _ ->
runDotnet "" "fable npm-run test --port free"
)
Target "CleanDocs" (fun _ ->
seq [
"docs/_public"
"docs/.sass-cache"
] |> CleanDirs
)
// --------------------------------------------------------------------------------------
// Generate the documentation
let githubLink = "[email protected]:ed-ilyin/Fable.EdIlyin.Core.git"
let publishBranch = "gh-pages"
let fableRoot = __SOURCE_DIRECTORY__
let temp = fableRoot </> "temp"
let docsDir = fableRoot </> "docs"
let docsOuput = docsDir </> "_public"
let fornax = "fornax"
let args = "build"
Target "BuildDocs" (fun _ ->
let fileName, args =
if EnvironmentHelper.isUnix
then fornax, args else "cmd", ("/C " + fornax + " " + args)
let ok =
execProcess (fun info ->
info.FileName <- fileName
info.WorkingDirectory <- docsDir
info.Arguments <- args) TimeSpan.MaxValue
if not ok then failwith (sprintf "'%s> %s %s' task failed" docsDir fileName args)
)
// --------------------------------------------------------------------------------------
// Release Scripts
Target "PublishDocs" (fun _ ->
CleanDir temp
Repository.cloneSingleBranch "" githubLink publishBranch temp
CopyRecursive docsOuput temp true |> tracefn "%A"
StageAll temp
Git.Commit.Commit temp (sprintf "Update site (%s)" (DateTime.Now.ToShortDateString()))
Branches.push temp
)
"Clean"
==> "InstallDotNetCore"
==> "Install"
==> "Build"
==> "InstallYarn"
==> "CleanTests"
==> "InstallTests"
==> "BuildTests"
==> "RunTests"
// Build order
"CleanDocs"
==> "BuildDocs"
==> "PublishDocs"
// start build
RunTargetOrDefault "Build"