-
Notifications
You must be signed in to change notification settings - Fork 0
/
Justfile
125 lines (99 loc) · 2.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
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
123
124
125
set quiet := true
set dotenv-load := true
BIN_PATH := 'bin/lighthouse'
IMAGE_NAME := 'lighthouse_app'
REMOTE_DIR := 'lighthouse'
DB_NAME := 'lighthouse'
AUTOCAP_BIN_PATH := 'bin/autocap-$(hostname -s)'
mod make
[private]
help:
just --list --unsorted --list-submodules
# debug disabled, services enabled
dev: build-autocap
hivemind
# debug enabled, services disabled
dev2: build-autocap
DISABLE_SERVICES=1 LIGHTHOUSE_DEBUG=1 hivemind
# debug enabled, services enabled
dev3: build-autocap
LIGHTHOUSE_DEBUG=1 hivemind
db:
mariadb {{ DB_NAME }}
drop:
echo 'drop database if exists {{ DB_NAME }}' | mariadb
pull:
importdb -f --host s --local {{ DB_NAME }} --remote {{ DB_NAME }}
fmt:
just --fmt
find . -name '*.just' -print0 | xargs -0 -I{} just --fmt -f {}
go fmt ./...
test: generate
#!/bin/bash
set -eo pipefail
export VIEWS_DIR=$(realpath cmd/*/views)
unbuffer go test -cover ./... | gostack --test
cov: generate
#!/bin/bash
set -eo pipefail
FILE=$(mktemp)
export VIEWS_DIR=$(realpath cmd/*/views)
go test ./... -cover -coverprofile="$FILE"
go tool cover -html="$FILE"
rm "$FILE"
lint:
#!/bin/bash
set -eo pipefail
unbuffer go vet ./... | gostack
unbuffer golangci-lint --color never run | gostack
fix:
#!/bin/bash
set -eo pipefail
unbuffer golangci-lint --color never run --fix | gostack
sloc:
tokei -tGo,HTML,CSS,JavaScript \
-e **/alpine.min.js \
-e **/bulma.min.css
clean:
rm -vf {{ AUTOCAP_BIN_PATH }}
rm -vf {{ BIN_PATH }}
deploy: buildc
deploy-container \
--host s \
--image {{ IMAGE_NAME }} \
--dir {{ REMOTE_DIR }} \
--compose compose.yml \
--add .env.prod \
--init deploy/init
buildc:
docker-compose build
# ——————————————————————————————————————————————————————————————————————————————————————————————————
[private]
up: buildc
docker-compose up
[private]
down:
docker-compose down
[private]
build-autocap:
mkif {{ AUTOCAP_BIN_PATH }} ./tools/autocap/* -x 'just rebuild-autocap'
[private]
rebuild-autocap:
sudo rm -f {{ AUTOCAP_BIN_PATH }}
go build -o {{ AUTOCAP_BIN_PATH }} ./tools/autocap
sudo chown root {{ AUTOCAP_BIN_PATH }}
sudo chmod u+s {{ AUTOCAP_BIN_PATH }}
[private]
serve: build
#!/bin/bash
set -eo pipefail
{{ AUTOCAP_BIN_PATH }} {{ BIN_PATH }}
unbuffer {{ BIN_PATH }} | gostack
[private]
generate:
go generate ./...
[private]
build: generate
#!/bin/bash
set -eo pipefail
unbuffer go build -o {{ BIN_PATH }} ./cmd/lighthouse | gostack