-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
80 lines (57 loc) · 2.26 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
validate_version:
ifndef VERSION
$(error VERSION is undefined)
endif
db:
cockroach demo --insecure --no-example-database
tables:
cockroach sql --insecure < examples/many_to_many/create.sql
data_many_to_many:
go run dg.go -c ./examples/many_to_many/config.yaml -o ./csvs/many_to_many -i import.sql
data_person:
go run dg.go -c ./examples/person/config.yaml -o ./csvs/person
data_range_test:
go run dg.go -c ./examples/range_test/config.yaml -o ./csvs/range_test
data_input_test:
go run dg.go -c ./examples/input_test/config.yaml -o ./csvs/input_test
data_unique_test:
go run dg.go -c ./examples/unique_test/config.yaml -o ./csvs/unique_test
data_const_test:
go run dg.go -c ./examples/const_test/config.yaml -o ./csvs/const_test
data_match:
go run dg.go -c ./examples/match_test/config.yaml -o ./csvs/match -i import.sql
data_each_match:
go run dg.go -c ./examples/each_match_test/config.yaml -o ./csvs/each_match -i import.sql
data_pattern:
go run dg.go -c ./examples/pattern_test/config.yaml -o ./csvs/pattern_test -i import.sql
data: data_many_to_many data_person data_range_test data_input_test data_unique_test data_const_test
echo "done"
file_server:
python3 -m http.server 3000 -d csvs/many_to_many
import:
cockroach sql --insecure < examples/many_to_many/insert.sql
test:
go test ./... -v -cover
cover:
go test -v -coverpkg=./... -coverprofile=profile.cov ./... -count=1
go tool cover -func profile.cov
# go tool cover -html coverage.out
profile:
go run dg.go -c ./examples/many_to_many/config.yaml -o ./csvs/many_to_many -cpuprofile profile.out
go tool pprof -http=:8080 profile.out
release: validate_version
# make sure the folder exists
mkdir -p ./releases
# linux
GOOS=linux go build -ldflags "-X main.version=${VERSION}" -o dg ;\
tar -zcvf ./releases/dg_${VERSION}_linux.tar.gz ./dg ;\
# macos (arm)
GOOS=darwin GOARCH=arm64 go build -ldflags "-X main.version=${VERSION}" -o dg ;\
tar -zcvf ./releases/dg_${VERSION}_macos_arm64.tar.gz ./dg ;\
# macos (amd)
GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=${VERSION}" -o dg ;\
tar -zcvf ./releases/dg_${VERSION}_macos_amd64.tar.gz ./dg ;\
# windows
GOOS=windows go build -ldflags "-X main.version=${VERSION}" -o dg ;\
tar -zcvf ./releases/dg_${VERSION}_windows.tar.gz ./dg ;\
rm ./dg