-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (43 loc) · 1.41 KB
/
Makefile
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
.PHONY: test clean
default: build
BINARY_FILE_NAME=source-telegram
COVERAGE_FILE_NAME=cover.out
COVERAGE_TMP_FILE_NAME=cover.tmp
docker-tdlib:
docker build -f tdlib.Dockerfile -t ghcr.io/awakari/tdlib:latest .
docker push ghcr.io/awakari/tdlib:latest
proto:
go install github.com/golang/protobuf/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1
PATH=${PATH}:~/go/bin protoc --go_out=plugins=grpc:. --go_opt=paths=source_relative \
api/grpc/*.proto \
api/grpc/queue/*.proto
vet: proto
go vet
test: vet
go test -race -cover -coverprofile=${COVERAGE_FILE_NAME} ./...
cat ${COVERAGE_FILE_NAME} | grep -v _mock.go | grep -v logging.go | grep -v .pb.go > ${COVERAGE_FILE_NAME}.tmp
mv -f ${COVERAGE_FILE_NAME}.tmp ${COVERAGE_FILE_NAME}
go tool cover -func=${COVERAGE_FILE_NAME} | grep -Po '^total\:\h+\(statements\)\h+\K.+(?=\.\d+%)' > ${COVERAGE_TMP_FILE_NAME}
./scripts/cover.sh
rm -f ${COVERAGE_TMP_FILE_NAME}
build: proto
CGO_ENABLED=0 GOOS=linux GOARCH= GOARM= go build -ldflags="-s -w" -o ${BINARY_FILE_NAME} main.go
chmod ugo+x ${BINARY_FILE_NAME}
docker:
docker build -t awakari/source-telegram .
run:
docker run \
--rm \
-it \
--env-file env.txt \
--name awakari-source-telegram \
--network host \
awakari/source-telegram
staging: docker
./scripts/staging.sh
release: docker
./scripts/release.sh
clean:
go clean
rm -f ${BINARY_FILE_NAME} ${COVERAGE_FILE_NAME}