lens @ 4d930c0c8cb585979798fac2bb254f991faa62fb

 1BIN=img
 2OUT=./bin/$(BIN)
 3SERVER=./cmd/server/main.go
 4
 5GO_TEST=go test -v -timeout 100ms -shuffle on -parallel `nproc`
 6GO_BUILD=go build -v -ldflags '-w -s'
 7GO_RUN=go run -v
 8
 9all: build
10
11build: sass
12	$(GO_BUILD) -o $(OUT) $(SERVER)
13
14compress: build
15	upx -1 $(OUT)
16
17compress_into_oblivion: build
18	upx --best --ultra-brute $(OUT)
19
20run: sass
21	$(GO_RUN) $(SERVER) \
22		--log-level error \
23		--aes-key=6368616e676520746869732070617373 \
24		--root=${HOME}
25
26sass:
27	@mkdir -p static
28	sassc \
29		-I scss scss/main.scss static/main.css \
30		--style compressed
31
32test: test.unit test.integration
33
34test.all: gci test.unit test.integration lint
35
36test.integration:
37	$(GO_TEST) -tags=integration ./...
38
39test.unit:
40	$(GO_TEST) -tags=unit ./...
41
42gen:
43	go run -v \
44		./cmd/ggen/...
45
46cover.%:
47	$(GO_TEST) \
48		-tags=$* \
49		-coverprofile=bin/cover \
50		./...
51	go tool cover \
52		-html=bin/cover \
53		-o bin/cover.html
54	echo "open bin/cover.html"
55
56lint:
57	golangci-lint run \
58	--fix \
59	--config golangci.yml \
60	--verbose \
61	./...
62
63gci:
64	find . \
65		-type f \
66		-name "*.go" \
67		-not -path "./vendor/*" \
68		-exec gci write -s standard -s default -s "prefix(git.sr.ht/~gabrielgio/img)" {} +