-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
80 lines (64 loc) · 2.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
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
GOSRC = ./../../..
GITHUBSRC = ./../..
EUDATSRC = ./..
WEBUI = webui
JSBUNDLE = webui/app/gef-bundle.js
GEFPREFIX = github.com/EUDAT-GEF/GEF/gefserver
GEFPKGS = $(GEFPREFIX)/db,$(GEFPREFIX)/def,$(GEFPREFIX)/pier,$(GEFPREFIX)/server,$(GEFPREFIX)/tests
build: dependencies backend test webui
backend: buildbackend test
buildbackend:
$(GOPATH)/bin/golint ./gefserver
go vet ./gefserver
go build -i -o build/gefserver ./gefserver
test:
@rm -f coverage*.out
@echo "mode: count" > coverage.out
@(for pkg in `go list ./... | grep -v /vendor/`; do \
echo --- ; \
GEF_SECRET_KEY="test" go test -covermode=count -coverpkg $(GEFPKGS) -coverprofile=coverage-`basename $${pkg}`.out -timeout 4m $${pkg}; \
if [ $$? -ne 0 ]; then \
exit 1; \
fi; \
tail -n +2 coverage-`basename $${pkg}`.out >> coverage.out 2>/dev/null || true; \
done)
@echo --- Coverage ---
@go tool cover -func=coverage.out
webui: $(JSBUNDLE)
run_gef:
(cd gefserver && go run main.go)
run_webui_dev_server:
(cd $(WEBUI) && node_modules/webpack-dev-server/bin/webpack-dev-server.js -d --hot --https --config webpack.config.devel.js)
certificate:
@echo "-- Creating self-signed GEF web server certificate in ./ssl/"
@mkdir -p ssl
@openssl req -x509 -nodes -newkey rsa:2048 -keyout ssl/server.key -out ssl/server.crt -days 365 -subj "/C=EU/ST=Helsinki/L=Helsinki/O=EUDAT/OU=GEF/CN=gef" 2>&1
clean:
go clean ./...
rm -rf gefserver/vendor
rm -rf $(WEBUI)/node_modules
rm -f $(JSBUNDLE) $(JSBUNDLE).map
pack: dependencies webui certificate
mkdir -p build
mkdir -p build/bin
docker build -t gefcompile:linux .
docker run --rm -v $(PWD)/build:/go/src/github.com/EUDAT-GEF/GEF/build gefcompile:linux
mv build/gef_linux ./build/bin
cp gefserver/config.json ./build/bin
cp -r services ./build/
cp -r ssl ./build/
tar -cvzf gef-0.3.0.tar.gz build/*
rm -rf build
dependencies: $(GITHUBSRC)/golang/lint/golint \
gefserver/vendor \
$(WEBUI)/node_modules
$(WEBUI)/node_modules:
(cd $(WEBUI) && npm install)
$(GITHUBSRC)/golang/lint/golint:
go get -u github.com/golang/lint/golint
gefserver/vendor:
@echo "-- Installing go dependencies"
(cd gefserver && glide install)
$(JSBUNDLE):
(cd $(WEBUI) && node_modules/webpack/bin/webpack.js -p)
.PHONY: build backend webui run_gef run_webui_dev_server certificate dependencies clean pack