-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBuild.fs
67 lines (51 loc) · 1.52 KB
/
Build.fs
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
open Fake.Core
open Fake.IO
open Helpers
initializeContext()
let buildPath = Path.getFullName "build"
let srcPath = Path.getFullName "src"
let appPath = Path.getFullName "app"
let deployPath = Path.getFullName "deploy"
let testsPath = Path.getFullName "test"
// Until Fable (beyond) is released, we need to compile with locally installed Fable branch.
let cliPath = Path.getFullName "../Fable/src/Fable.Cli"
Target.create "Clean" (fun _ ->
Shell.cleanDir buildPath
)
Target.create "Build" (fun _ ->
Shell.mkdir buildPath
run dotnet $"fable --exclude Fable.Core --lang Python --outDir {buildPath}/lib" srcPath
)
Target.create "App" (fun _ ->
Shell.mkdir buildPath
run dotnet $"fable --exclude Fable.Core --lang Python" appPath
run poetry $"""run uvicorn program:app --port "8080" --workers 1 --log-level error""" $"{appPath}"
)
Target.create "Test" (fun _ ->
run dotnet "build" testsPath
[ "native", dotnet "run" testsPath
"python", dotnet $"fable --lang Python --outDir {buildPath}/tests" testsPath
]
|> runParallel
run poetry $"run python -m pytest {buildPath}/tests" ""
)
Target.create "Pack" (fun _ ->
run dotnet "pack -c Release" srcPath
)
Target.create "Format" (fun _ ->
run dotnet "fantomas . -r" srcPath
run dotnet "fantomas . -r" testsPath
)
open Fake.Core.TargetOperators
let dependencies = [
"Clean"
==> "Build"
"Clean"
==> "App"
"Build"
==> "Test"
"Build"
==> "Pack"
]
[<EntryPoint>]
let main args = runOrDefault args