This repository has been archived by the owner on Jan 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
58 lines (48 loc) · 1.89 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
55
56
57
58
GO_OS := $(shell go env GOOS)
GO_ARCH := $(shell go env GOARCH)
GO_FLAGS :=
ENV := dev
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
.NOTPARALLEL:
all: clean deps test images
.PHONY: clean
clean:
@rm -rf service/agora/build/
@rm -rf service/garbage-collector/build/
@rm -rf service/history-collector/build/
@rm -f coverage.txt
.PHONY: deps
deps:
@go get ./...
.PHONY: deps-clean
deps-clean:
@go mod tidy
.PHONY: test
test:
@./go-test.sh
.PHONY: build build-agora build-garbage-collector build-history-collector
build: build-agora build-garbage-collector build-history-collector
build-agora:
@go vet github.com/kinecosystem/agora/service/agora
GOOS=$(GO_OS) GOARCH=$(GO_ARCH) CGO_ENABLED=0 go build $(GO_FLAGS) -o service/agora/build/$(GO_OS)-$(GO_ARCH)/agora \
github.com/kinecosystem/agora/service/agora
build-garbage-collector:
@go vet github.com/kinecosystem/agora/service/garbage-collector
GOOS=$(GO_OS) GOARCH=$(GO_ARCH) CGO_ENABLED=0 go build $(GO_FLAGS) -o service/garbage-collector/build/$(GO_OS)-$(GO_ARCH)/garbage-collector \
github.com/kinecosystem/agora/service/garbage-collector
build-history-collector:
@go vet github.com/kinecosystem/agora/service/history-collector
GOOS=$(GO_OS) GOARCH=$(GO_ARCH) CGO_ENABLED=0 go build $(GO_FLAGS) -o service/history-collector/build/$(GO_OS)-$(GO_ARCH)/history-collector \
github.com/kinecosystem/agora/service/history-collector
.PHONY: images
images: GO_OS := linux
images: GO_ARCH := amd64
images: build images-only
.PHONY: images-only agora-image garbage-collector-image history-collector-image
images-only: agora-image garbage-collector-image history-collector-image
agora-image:
docker build service/agora -t agora-service:$(GIT_BRANCH)
garbage-collector-image:
docker build service/garbage-collector -t garbage-collector:$(GIT_BRANCH)
history-collector-image:
docker build service/history-collector -t history-collector:$(GIT_BRANCH)