-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
79 lines (69 loc) · 2.06 KB
/
Taskfile.yml
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
version: "3"
env:
CGO_LDFLAGS_ALLOW: "-Wl,-z,now"
CGO_LDFLAGS: "-O3 -g -Wl,-Bstatic"
vars:
PACKAGE: "github.com/openPanel/core"
# ldflags
EXT_LDFLAGS: -fPIC -Wl,-Bstatic -lraft -luv_a -llz4 -ldqlite -Wl,-Bdynamic
STATIC_C_EXT_LDFLAGS: -fPIC -static -lraft -luv_a -llz4 -ldqlite
EXTERNAL_LINK: "-linkmode=external -v -extldflags '{{.EXT_LDFLAGS}}'"
EXTERNAL_C_LINK: "-linkmode=external -v -extldflags '{{.STATIC_C_EXT_LDFLAGS}}'"
STATIC_LDFLAGS: "{{.EXTERNAL_LINK}}"
STATIC_C_LDFLAGS: "{{.EXTERNAL_C_LINK}}"
STATIC_STRIP_LDFLAGS: "{{.EXTERNAL_LINK}} -s -w"
# gcflags
GCFLAGS: "all=-N -l"
# tags
STATIC_TAGS: "osusergo netgo static_build"
URFAVE_CLI_TAGS: "urfave_cli_no_docs"
SQLITE_TAGS: "sqlite_omit_load_extension sqlite_foreign_keys"
RELEASE_TAGS: "release {{.STATIC_TAGS}} {{.URFAVE_CLI_TAGS}} {{.SQLITE_TAGS}}"
DEBUG_TAGS: "{{.URFAVE_CLI_TAGS}} {{.STATIC_TAGS}} {{.SQLITE_TAGS}}"
tasks:
build-release:
cmds:
- >+
go build
-buildmode=pie
-tags "{{.RELEASE_TAGS}}"
-trimpath
-ldflags "{{.STATIC_STRIP_LDFLAGS}}"
-o ./bin/openPanel {{.PACKAGE}}
build-debug:
cmds:
- >+
go build
-buildmode=pie
-tags "{{.DEBUG_TAGS}}"
-ldflags "{{.STATIC_LDFLAGS}}"
-o ./bin/openPanel.debug {{.PACKAGE}}
build-analysis:
cmds:
- >+
go build
-buildmode=pie
-tags "{{.DEBUG_TAGS}}"
-ldflags "{{.STATIC_C_LDFLAGS}}"
-gcflags "{{.GCFLAGS}}"
-o ./bin/openPanel.analysis {{.PACKAGE}}
install_deps:
cmds:
- "if [ -z $CI ]; then echo 'Not running in CI, exiting'; exit 1; fi"
- "sudo add-apt-repository ppa:dqlite/dev"
- "sudo apt-get update"
- "sudo apt install -y liblz4-dev liblz4-tool libuv1-dev libsqlite3-dev musl-tools"
gen_grpc:
cmds:
- buf generate
gen_ent:
cmds:
- go run github.com/openPanel/core/scripts ent
gen:
deps:
- gen_grpc
- gen_ent
bingo:
cmds:
- "go install github.com/bwplotka/bingo@latest"
- "bingo get"