forked from alpstable/gidari
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·54 lines (43 loc) · 1.29 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
# PKGS returns all Go packages in the Gidari code base.
PKGS = $(or $(PKG),$(shell env GO111MODULE=on $(GC) list ./...))
# TESTPKGS returns all Go packages int the Gidari code base that contain "*_test.go" files.
TESTPKGS = $(shell env GO111MODULE=on $(GC) list -f \
'{{ if or .TestGoFiles .XTestGoFiles }}{{ .ImportPath }}{{ end }}' \
$(PKGS))
# GC is the go compiler.
GC = go
export GO111MODULE=on
default:
chmod +rwx scripts/*.sh
$(GC) build cmd/gidari.go
# containers build the docker containers for performing integration tests.
.PHONY: containers
containers:
scripts/build-storage.sh
# proto is a phony target that will generate the protobuf files.
.PHONY: proto
proto:
protoc --proto_path=proto --go_out=proto proto/db.proto
# test runs all of the application tests locally.
.PHONY: tests
tests:
$(GC) clean -testcache
@$(foreach dir,$(TESTPKGS), $(GC) test $(dir) -v;)
# ci are the integration tests in CI/CD.
.PHONY: ci
ci:
$(GC) clean -testcache
./scripts/run-ci-tests.sh
# lint runs the linter.
.PHONY: lint
lint:
golangci-lint run --config .golangci.yml
# fmt runs the formatter.
.PHONY: fmt
fmt:
gofumpt -l -w .
golangci-lint run --fix
# add-license adds the license to all the top of all the .go files.
.PHONY: add-license
add-license:
./scripts/add-license.sh