-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefile
208 lines (157 loc) · 7.16 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#
# Copyright (c) 2014-2017 10X Genomics, Inc. All rights reserved.
#
# Build a Go package with git version embedding.
#
PWD=$(shell pwd)
GOBINS=$(notdir $(wildcard cmd/m*))
REPO=github.com/martian-lang/martian
GOLIBTESTS=$(addprefix test-, $(notdir $(wildcard martian/*)))
GOBINTESTS=$(addprefix test-, $(GOBINS))
GOTESTS=$(GOLIBTESTS) $(GOBINTESTS) test-all
VERSION=$(shell git describe --tags --always --dirty)
RELEASE=false
SRC_ROOT=$(abspath $(dir $(PWD))../..)
GO_FLAGS=-trimpath -ldflags "-X '$(REPO)/martian/util.__VERSION__=$(VERSION)' -X $(REPO)/martian/util.__RELEASE__='$(RELEASE)'"
unexport GOPATH
export GO111MODULE=on
export GOBIN=$(PWD)/bin
.PHONY: $(GOBINS) grammar web $(GOTESTS) coverage.out govet all-bins $(GOBIN)/sum_squares longtests integration_prereqs vscode vscode-test
#
# Targets for development builds.
#
all: grammar all-bins web test vscode
martian/syntax/grammar.go: martian/syntax/grammar.y martian/syntax/lexer.go
go generate ./martian/syntax
martian/test/sum_squares/types.go: PATH:=$(GOBIN):$(PATH)
martian/test/sum_squares/types.go: test/split_test_go/pipeline_stages.mro mro2go
go generate ./martian/test/sum_squares
$(GOBIN)/sum_squares: martian/test/sum_squares/sum_squares.go \
martian/test/sum_squares/types.go
go install $(GO_FLAGS) ./martian/test/sum_squares
grammar: martian/syntax/grammar.go
$(GOBINS):
go install $(GO_FLAGS) ./cmd/$@
all-bins:
go install $(GO_FLAGS) ./cmd/...
web:
$(MAKE) -C web/martian
vscode:
(cd tools/syntax/vscode && yarn install --frozen-lockfile --ignore-optional && npm run-script compile)
vscode-test: vscode
(cd tools/syntax/vscode && npm run-script check-lint)
$(GOLIBTESTS): test-%:
go test -v ./martian/$*
$(GOBINTESTS): test-%:
go test -v ./cmd/$*
WEB_FILES=web/martian/serve
$(WEB_FILES): web
ADAPTERS=$(wildcard adapters/python/*.py) $(wildcard adapters/python/*/*.py)
JOBMANAGERS=$(wildcard jobmanagers/*.py) \
$(wildcard jobmanagers/*.json) \
$(wildcard jobmanagers/*.template.example)
$(addprefix bin/, $(GOBINS)): all-bins
PRODUCT_NAME:=martian-$(VERSION)-$(shell uname -is | tr "A-Z " "a-z-")
TARBALLS:=$(addprefix $(PRODUCT_NAME).tar, .gz .xz)
$(TARBALLS): $(addprefix bin/, $(GOBINS)) $(ADAPTERS) $(JOBMANAGERS) $(WEB_FILES)
git status || echo "no git status"
tar --owner=0 --group=0 --transform "s/^\\./$(PRODUCT_NAME)/" -caf $@ $(addprefix ./, $^)
tarball: $(TARBALLS)
test-all: martian/syntax/grammar.go | martian/test/sum_squares/types.go
go test -race ./martian/... ./cmd/...
coverage.out: martian/syntax/grammar.go | martian/test/sum_squares/types.go
go test -coverprofile=coverage.out \
-coverpkg=./martian/... \
./martian/... ./cmd/...
coverage.html: coverage.out
go tool cover -html=coverage.out -o coverage.html
cover: coverage.html
govet: martian/syntax/grammar.go | martian/test/sum_squares/types.go
go vet ./martian/... ./cmd/...
test: test-all govet $(GOBIN)/sum_squares vscode-test
# Note this target is expected to fail, since we haven't gone back and made
# legacy code compliant. The CI only checks for new issues.
golint:
go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run --config .github/.golangci.yml
integration_prereqs: mrp mrjob $(ADAPTERS) test/martian_test.py $(JOBMANAGERS)
test/split_test/pipeline_test: test/split_test/split_test.json \
integration_prereqs
test/martian_test.py $<
test/split_test_go/pipeline_test: test/split_test_go/split_test.json \
integration_prereqs $(GOBIN)/sum_squares
test/martian_test.py $<
test/split_test_go/disable_pipeline_test: test/split_test_go/disable_test.json \
integration_prereqs $(GOBIN)/sum_squares
test/martian_test.py $<
test/exit_test/pipeline_test: test/exit_test/exit_test.json \
integration_prereqs
test/martian_test.py $<
test/files_test/pipeline_test: test/files_test/files_test.json \
integration_prereqs
test/martian_test.py $<
test/retain_test/pipeline_test: test/retain_test/retain_test.json \
integration_prereqs
test/martian_test.py $<
test/struct_test/pipeline_test: test/struct_test/struct_test.json \
integration_prereqs
test/martian_test.py $<
test/fork_test/fail/pipeline_fail: test/fork_test/fail1_test.json \
integration_prereqs
test/martian_test.py $<
test/fork_test/ar_fail/pipeline_fail: test/fork_test/autoretry_fail.json \
integration_prereqs
test/martian_test.py $<
test/fork_test/pass/pipeline_test: test/fork_test/fork_test.json \
integration_prereqs
test/martian_test.py $<
test/fork_test/retry/pipeline_test: test/fork_test/retry_test.json \
integration_prereqs
test/martian_test.py $<
test/fork_test/ar_pass/pipeline_test: test/fork_test/autoretry_pass.json \
integration_prereqs
test/martian_test.py $<
test/fork_test/ar_remote_pass/pipeline_test: test/fork_test/autoretry_remote_pass.json \
integration_prereqs
test/martian_test.py $<
test/map_test/pipeline_test: test/map_test/map_test.json \
integration_prereqs
test/martian_test.py $<
test/disable_test/pipeline_test: test/disable_test/disable_test.json \
integration_prereqs
test/martian_test.py $<
test/retry_map_call_map_test/pipeline_test: test/retry_map_call_map_test/autoretry_pass.json \
integration_prereqs
test/martian_test.py $<
test/retry_test/pipeline_test: test/retry_test/autoretry_pass.json \
integration_prereqs
test/martian_test.py $<
longtests: test/split_test/pipeline_test \
test/split_test_go/pipeline_test \
test/split_test_go/disable_pipeline_test \
test/exit_test/pipeline_test \
test/files_test/pipeline_test \
test/retain_test/pipeline_test \
test/struct_test/pipeline_test \
test/fork_test/pass/pipeline_test \
test/fork_test/retry/pipeline_test \
test/fork_test/ar_pass/pipeline_test \
test/fork_test/ar_remote_pass/pipeline_test \
test/fork_test/fail/pipeline_fail \
test/fork_test/ar_fail/pipeline_fail \
test/map_test/pipeline_test \
test/disable_test/pipeline_test \
test/retry_map_call_map_test/pipeline_test \
test/retry_test/pipeline_test
# Collect profiles to use for profile-guided optimization for mrp and mrjob,
# and merge/update the appropriate default.pgo files.
update_pgo: integration_prereqs
mkdir -p profiles
rm -f profiles/*.pprof
MRO_SELF_PROFILE="$(PWD)/profiles/*.pprof" $(MAKE) longtests
find $(PWD)/profiles -maxdepth 1 -name "*.pprof" | xargs go tool pprof -proto > $(PWD)/cmd/mrp/default.pgo
find $(PWD)/test -name _selfProfile.pprof | xargs go tool pprof -proto > $(PWD)/cmd/mrjob/default.pgo
clean:
rm -rf $(GOBIN)
rm -rf $(dir $(GOBIN))pkg
$(MAKE) -C web/martian clean
$(MAKE) -C tools/syntax/vscode clean