-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
46 lines (32 loc) · 1.54 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
# Makefile - just builds the binary, for dev mainly
.PHONY: clean test generate testbot static dist containers debug
commit := -X main.Commit=$(shell git rev-parse --short HEAD)
version := $(shell ./get-version.sh)
TAR_ARCHIVE = gopherbot-linux-amd64.tar.gz
ZIP_ARCHIVE = gopherbot-linux-amd64.zip
GOOS ?= linux
CGO ?= 0
CTAG ?= latest
ifdef TEST
TESTARGS = -run ${TEST}
endif
static: gopherbot
gopherbot: main.go modules.go bot/* brains/*/* connectors/*/* goplugins/*/* history/*/* robot/* gotasks/*/* modules/*/*
CGO_ENABLED=${CGO} GOOS=${GOOS} GOARCH=amd64 go build -mod readonly -ldflags "-s -w $(commit) $(version)" -tags "netgo osusergo static_build" -o gopherbot main.go modules.go
debug:
CGO_ENABLED=${CGO} GOOS=${GOOS} GOARCH=amd64 go build -mod readonly -ldflags "$(commit) $(version)" -tags "netgo osusergo static_build" -o gopherbot
clean:
rm -f gopherbot $(TAR_ARCHIVE) $(ZIP_ARCHIVE)
$(TAR_ARCHIVE): static
./mkdist.sh
dist: $(TAR_ARCHIVE)
# Run test suite without coverage (see .gopherci/pipeline.sh)
test:
go test ${TESTARGS} -v --tags 'test integration netgo osusergo static_build' -mod readonly -race ./test
# Generate Stringer methods
generate:
go generate -v --tags 'test integration netgo osusergo static_build' -mod readonly ./bot/
go generate -v --tags 'test integration netgo osusergo static_build' -mod readonly ./robot/
# Terminal robot that emits events gathered, for developing integration tests
testbot:
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=amd64 go build -mod readonly -tags 'netgo osusergo static_build test' -o gopherbot