-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
94 lines (78 loc) · 2.39 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
.PHONY: all
all: lint build test install
.PHONY: docker-compose
docker-compose: docker-build
if docker-compose version > /dev/null 2>&1; then \
DOCKER_COMPOSE="docker-compose"; \
else \
if docker compose version > /dev/null 2>&1; then \
DOCKER_COMPOSE="docker compose"; \
else \
echo "Please install the docker-compose command"; \
exit 1; \
fi; \
fi; \
$${DOCKER_COMPOSE} down --remove-orphans; \
mkdir --parents tmp; \
BRANCH=$(shell git branch --show-current | sed -e 's:/:-:g') $${DOCKER_COMPOSE} up --force-recreate --build
.PHONY: devel
devel: install docker-build docker-compose
.PHONY: docker-build monitor processor
docker-build: install docker-build-monitor docker-build-processor docker-build-debug-container
.PHONY: docker-build-monitor docker-build-processor
docker-build-monitor docker-build-processor: docker-build-%:
docker build \
--tag athena/athena-$*:$(subst /,-,$(shell git rev-parse --abbrev-ref HEAD)) \
--file cmd/$*/Dockerfile \
$(if $(NOCACHE),--no-cache,) \
--build-arg ARCH=amd64 \
--build-arg OS=linux \
.
.PHONY: docker-build-debug-container
docker-build-debug-container:
docker build \
--tag debug-container \
--file Dockerfile-debug \
.
.PHONY: build
build: athena-monitor athena-processor salesforce-test
.PHONY: athena-monitor
athena-monitor:
go build -v -o $@ -ldflags="-X main.commit=$$(git describe --tags)" cmd/monitor/main.go
.PHONY: athena-processor
athena-processor:
go build -v -o $@ -ldflags="-X main.commit=$$(git describe --tags)" cmd/processor/main.go
.PHONY: salesforce-test
salesforce-test:
go build -v -o $@ -ldflags="-X main.commit=$$(git describe --tags)" cmd/salesforce-test/main.go
.PHONY: files.com-test
files.com-test:
go build -v -o $@ -ldflags="-X main.commit=$$(git describe --tags)" cmd/files.com-test/main.go
.PHONY: lint
lint: check_modules gofmt
.PHONY: check_modules
check_modules:
go mod tidy
.PHONY: gofmt
gofmt: check_modules
@fmt_result=$$(gofmt -d $$(find . -name '*.go' -print)); \
if [ -n "$${fmt_result}" ]; then \
echo "gofmt checking failed"; \
echo; \
echo "$${fmt_result}"; \
false; \
fi
.PHONY: test
test:
go test -v ./...
.PHONY: install
install: build
rm -rf build
mkdir build
cp --verbose athena-monitor athena-processor build/
.PHONY: docs
docs:
python3 -m venv venv
./venv/bin/pip install --upgrade pip
./venv/bin/pip install sphinx
. venv/bin/activate && make -C docs html