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
7GO_RUN=go run -v
8
9all: build sass
10
11build:
12 $(GO_BUILD) -o $(OUT) $(SERVER)
13
14run: sass
15 $(GO_RUN) $(SERVER) \
16 --db-type psql \
17 --db-con "host=localhost user=gabrielgio password=diablo123 dbname=img port=5432 sslmode=disable" \
18 --log-level trace \
19 --aes-key=6368616e676520746869732070617373 \
20 --root=${HOME}
21
22sass:
23 @mkdir -p static
24 sassc \
25 -I scss scss/main.scss static/main.css \
26 --style compressed
27
28test: test.unit test.integration
29
30test.all: gci test.unit test.integration lint
31
32test.integration:
33 $(GO_TEST) -tags=integration ./...
34
35test.unit:
36 $(GO_TEST) -tags=unit ./...
37
38gen:
39 go run -v \
40 ./cmd/ggen/...
41
42cover.%:
43 $(GO_TEST) \
44 -tags=$* \
45 -coverprofile=bin/cover \
46 ./...
47 go tool cover \
48 -html=bin/cover \
49 -o bin/cover.html
50 echo "open bin/cover.html"
51
52lint:
53 golangci-lint run \
54 --fix \
55 --config golangci.yml \
56 --verbose \
57 ./...
58
59gci:
60 find . \
61 -type f \
62 -name "*.go" \
63 -not -path "./vendor/*" \
64 -exec gci write -s standard -s default -s "prefix(git.sr.ht/~gabrielgio/img)" {} +