aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile70
1 files changed, 22 insertions, 48 deletions
diff --git a/Makefile b/Makefile
index 6c9507c..19a623f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,64 +1,38 @@
-## Copyright 2020, Shulhan <m.shulhan@gmail.com>. All rights reserved.
+## Copyright 2020, Shulhan <ms@kilabit.info>. All rights reserved.
## Use of this source code is governed by a BSD-style
## license that can be found in the LICENSE file.
-.PHONY: all build lint test install release deploy
-.PHONY: dev-server
+.PHONY: all test check
+.PHONY: build-linux_amd64
+.PHONY: deploy deploy-kamusd deploy-telegram-bot
+.PHONY: run-kamusd
-all: build lint test
+BIN_LINUX_AMD64 := _bin/linux_amd64
-build:
- go build ./...
-
-lint:
- golangci-lint run --enable-all \
- --disable=dupl \
- --disable=funlen \
- --disable=godox \
- --disable=gomnd \
- --disable=wsl \
- --disable=gocognit \
- --disable=goerr113 \
- --disable=testpackage \
- ./...
+all: test check
test:
- go test ./...
+ go test -race -p=1 ./...
-install:
- go install ./cmd/kbbi/
+check:
+ golangci-lint run ./...
-##
-## Release tasks
-##
+build-linux_amd64:
+ mkdir -p $(BIN_LINUX_AMD64)
+ CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
+ go build -o $(BIN_LINUX_AMD64)/ ./cmd/...
-release:
- mkdir -p _content/bin/
- rm _content/bin/kbbi-*
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build ./cmd/kbbi && \
- gzip kbbi && \
- mv kbbi.gz _content/bin/kbbi-linux-amd64.gz
- CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build ./cmd/kbbi && \
- gzip kbbi && \
- mv kbbi.gz _content/bin/kbbi-darwin-amd64.gz
- CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build ./cmd/kbbi && \
- zip -m kbbi.zip kbbi.exe && \
- mv kbbi.zip _content/bin/kbbi-windows-amd64.zip
+deploy: build-linux_amd64
-deploy:
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
- go build -o www-kamusku-linux-amd64 ./cmd/www-kamusku/
- rsync --progress ./www-kamusku-linux-amd64 www-kamusku:~/bin/www-kamusku
- rsync --progress --recursive ./_www-kamusku/ www-kamusku:~/bin/_www-kamusku/
+deploy-kamusd:
+ rsync --progress $(BIN_LINUX_AMD64)/kamusd www-kamusku:~/bin/kamusd
-deploy-bot:
- CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
- go build -o bot-kbbi-linux-amd64 ./cmd/bot-kbbi/
- rsync --progress ./bot-kbbi-linux-amd64 www-kamusku:~/bin/bot-kbbi
+deploy-telegram-bot:
+ rsync --progress $(BIN_LINUX_AMD64)/kamusku-telegram-bot www-kamusku:~/bin/kamusku-telegram-bot
##
-## Development task
+## Development tasks.
##
-dev-server:
- DEBUG=1 go run ./cmd/www-kamusku
+run-kamusd:
+ DEBUG=2 go run ./cmd/kamusd