-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (57 loc) · 1.65 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
PROJECT?=auto-docs
V:=$(shell git log | head -n 1 | cut -d\ -f2)
LDFLAGS:=-ldflags "-X main.GitCommit=${V}"
bin-prep:
GO111MODULE=off go get -u github.com/kevinburke/go-bindata/...
bin-dist:
go-bindata -o $(PROJECT)/server/assets.go -prefix dist/ dist/...
sed -i "s/package main/package server/" $(PROJECT)/server/assets.go
binaries:
$(MAKE) binary GOARCH=amd64 GOOS=linux
$(MAKE) binary GOARCH=amd64 GOOS=windows
$(MAKE) binary GOARCH=amd64 GOOS=darwin
$(MAKE) binary GOARCH=386 GOOS=linux
$(MAKE) binary GOARCH=386 GOOS=windows
binary: GOARCH?=amd64
binary: GOOS?=linux
binary:
go build $(LDFLAGS) -o build/$(PROJECT).$(GOARCH)-$(GOOS) ./auto-docs
if [ "$(GOOS)" = "windows" ]; then \
mv build/$(PROJECT).$(GOARCH)-$(GOOS) build/$(PROJECT).$(GOARCH)-$(GOOS).exe; \
fi
build-fe:
yarn
yarn build
clean:
rm -f $(PROJECT)/server/assets.go
rm -r dist
compile:
go install $(LDFLAGS) ./$(PROJECT)/
coverage:
go test -race -covermode=atomic -coverprofile=c.out ./...
sed -i '/^github.com\/cloudcloud\/auto-docs\/auto-docs\/server\/assets.go.*/d' c.out
go tool cover -html=c.out -o cover.html
# at this time, there's no watch enabled for the go binary
dev-be: bin-prep bin-dist install
$(PROJECT) server
# serve is a watch task with built-in node server
dev-fe:
yarn serve
image: VERSION?=1.0.0
image:
docker build -t cloudcloud/auto-docs:v$(VERSION) .
install: build-fe compile
test: bin-dist install
go test -v -race ./...
complete-binaries: clean bin-prep build-fe bin-dist binaries
#
# Docker Compose management commands.
#
DN?=auto-docs
DC?=docker-compose -p $(DN)
up:
$(DC) up -d
shell:
docker exec -it $(DN)_autodocs_1 bash
down:
$(DC) down