forked from wal-g/wal-g
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
80 lines (61 loc) · 2.66 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
MAIN_PG_PATH := main/pg
MAIN_MYSQL_PATH := main/mysql
DOCKER_COMMON := golang ubuntu s3
CMD_FILES = $(wildcard wal-g/*.go)
PKG_FILES = $(wildcard internal/**/*.go internal/**/**/*.go internal/*.go)
TEST_FILES = $(wildcard test/*.go testtools/*.go)
PKG := github.com/wal-g/wal-g
.PHONY: unittest fmt lint install clean
ifdef GOTAGS
override GOTAGS := -tags $(GOTAGS)
endif
test: install deps lint unittest pg_build mysql_build unlink_brotli pg_integration_test mysql_integration_test
pg_test: install deps pg_build lint unittest unlink_brotli pg_integration_test
pg_build: $(CMD_FILES) $(PKG_FILES)
(cd $(MAIN_PG_PATH) && go build -o wal-g $(GOTAGS) -ldflags "-s -w -X github.com/wal-g/wal-g/cmd.BuildDate=`date -u +%Y.%m.%d_%H:%M:%S` -X github.com/wal-g/wal-g/cmd.GitRevision=`git rev-parse --short HEAD` -X github.com/wal-g/wal-g/cmd.WalgVersion=`git tag -l --points-at HEAD`")
pg_integration_test:
docker-compose build $(DOCKER_COMMON) pg pg_tests
docker-compose up --exit-code-from pg_tests pg_tests
pg_clean:
(cd $(MAIN_PG_PATH) && go clean)
./cleanup.sh
pg_install: pg_build
mv $(MAIN_PG_PATH)/wal-g $(GOBIN)/wal-g
mysql_test: install deps mysql_build lint unittest unlink_brotli mysql_integration_test
mysql_build: $(CMD_FILES) $(PKG_FILES)
(cd $(MAIN_MYSQL_PATH) && go build -o wal-g $(GOTAGS) -ldflags "-s -w -X github.com/wal-g/wal-g/cmd.BuildDate=`date -u +%Y.%m.%d_%H:%M:%S` -X github.com/wal-g/wal-g/cmd.GitRevision=`git rev-parse --short HEAD` -X github.com/wal-g/wal-g/cmd.WalgVersion=`git tag -l --points-at HEAD`")
mysql_integration_test:
docker-compose build $(DOCKER_COMMON) mysql mysql_tests
docker-compose up --exit-code-from mysql_tests mysql_tests
mysql_clean:
(cd $(MAIN_MYSQL_PATH) && go clean)
./cleanup.sh
mysql_install: mysql_build
mv $(MAIN_MYSQL_PATH)/wal-g $(GOBIN)/wal-g
unittest:
go list ./... | grep -Ev 'vendor|submodules|tmp' | xargs go vet
go test -v ./test/
go test -v ./internal/walparser/
go test -v ./internal/compression/
go test -v ./internal/crypto/
go test -v ./internal/crypto/openpgp/
go test -v ./internal/storages/s3/
go test -v ./internal/storages/gcs/
go test -v ./internal/storages/fs/
go test -v ./internal/storages/azure/
go test -v ./internal/storages/swift/
fmt: $(CMD_FILES) $(PKG_FILES) $(TEST_FILES)
gofmt -s -w $(CMD_FILES) $(PKG_FILES) $(TEST_FILES)
lint: $(CMD_FILES) $(PKG_FILES) $(TEST_FILES)
go list ./... | grep -Ev 'vendor|submodules|tmp' | xargs golint
deps:
git submodule update --init
dep ensure
./link_brotli.sh
install:
go get -u github.com/golang/dep/cmd/dep
go get -u golang.org/x/lint/golint
unlink_brotli:
rm -rf vendor/github.com/google/brotli/*
mv tmp/* vendor/github.com/google/brotli/
rm -rf tmp/