-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
77 lines (63 loc) · 1.77 KB
/
justfile
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
binary := "gt"
version := "0.0.3"
build_dir := "bin"
dist_dir := "dist"
cmd := "."
output := "." / build_dir / binary
dist := "." / dist_dir / binary
contrib_dir := "." / "contrib"
screenshots_dir := "screenshots"
archive_base := dist_dir / binary + "-" + version
linux_archive := archive_base + "-x86_64.tar"
arm64_archive := archive_base + "-arm64.tar"
arm_archive := archive_base + "-arm.tar"
# do the thing
default: test check install
# build binary
build:
go build -o {{output}} {{cmd}}
package $CGO_ENABLED="0": man
go build -o {{binary}} {{cmd}}
tar cafv {{linux_archive}} {{binary}} {{binary}}.1 README.md LICENSE {{screenshots_dir}}
tar rafv {{linux_archive}} -C {{contrib_dir}} "completions"
gzip -f {{linux_archive}}
rm {{binary}}
GOARCH="arm" GOARM="7" go build -o {{binary}} {{cmd}}
tar cafv {{arm_archive}} {{binary}} {{binary}}.1 README.md LICENSE {{screenshots_dir}}
tar rafv {{arm_archive}} -C {{contrib_dir}} "completions"
gzip -f {{arm_archive}}
rm {{binary}}
GOARCH="arm64" go build -o {{binary}} {{cmd}}
tar cafv {{arm64_archive}} {{binary}} {{binary}}.1 README.md LICENSE {{screenshots_dir}}
tar rafv {{arm64_archive}} -C {{contrib_dir}} "completions"
gzip -f {{arm64_archive}}
rm {{binary}}
# run from source
run:
go run {{cmd}}
# build 'n run
run-binary: build
exec {{output}}
# run with args
run-args args:
go run {{cmd}} {{args}}
# install binary into $GOPATH
install:
go install {{cmd}}
# install manpages into $HOME/.local/share/man
install-man:
mkdir -p $HOME/.local/share/man/man1
cp {{binary}}.1 $HOME/.local/share/man/man1/{{binary}}.1
# clean up after yourself
clean:
-rm {{output}}
-rm {{dist_dir}}/*.tar.gz
# run go tests
test:
gotestsum
# run linter
check:
staticcheck ./...
# generate manpage
man:
scdoc < {{binary}}.1.scd > {{binary}}.1