-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (52 loc) · 1.13 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
.PHONY: all build test proto lint clean
# Go parameters
GOCMD=go
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
# Python parameters
PYTHON=python3
PIP=$(PYTHON) -m pip
# Main targets
all: build
build: build-go build-python
test: test-go test-python
lint: lint-go lint-python lint-proto
clean: clean-go clean-python
# Go targets
build-go:
$(GOBUILD) -o bin/api ./api/cmd/main.go
test-go:
$(GOTEST) ./api/...
lint-go:
golangci-lint run ./api/...
clean-go:
$(GOCLEAN)
rm -f bin/api
# Python targets
build-python:
$(PIP) install -r worker/requirements.txt
test-python:
$(PYTHON) -m pytest worker/
lint-python:
flake8 worker/
black --check worker/
isort --check-only worker/
clean-python:
find . -type d -name __pycache__ -exec rm -rf {} +
proto:
cd proto && buf generate
lint-proto:
buf lint
# Additional targets
setup:
$(GOGET) -u github.com/golangci/golangci-lint/cmd/golangci-lint
$(PIP) install -r worker/requirements.txt
$(PIP) install flake8 black isort pytest
go install github.com/bufbuild/buf/cmd/buf@latest
format:
gofmt -w ./api
black worker/
isort worker/
check: lint test