-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
73 lines (61 loc) · 2.81 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
SISYPHUS_GO_EXECUTABLE ?= go
DIST_DIRS := find * -type d -exec
VERSION_GIT != git describe --tags
VERSION_GIT_CLEAN != echo ${VERSION_GIT} | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p'
VERSION ?= ${VERSION_GIT_CLEAN}
VERSION_INCHANGELOG != head -n1 CHANGELOG.md | sed -nre 's/^[^0-9]*(([0-9]+\.)*[0-9]+).*/\1/p'
verify-version:
@if [ "$(VERSION)" = "$(VERSION_INCHANGELOG)" ]; then \
echo "sisyphus: $(VERSION_INCHANGELOG)"; \
elif [ "$(VERSION)" = "$(VERSION_INCHANGELOG)-dev" ]; then \
echo "sisyphus (development): $(VERSION_INCHANGELOG)"; \
else \
echo "Version number does not match CHANGELOG.md"; \
echo "Build Version: $(VERSION)"; \
echo "CHANGELOG : $(VERSION_INCHANGELOG)"; \
exit 1; \
fi
build: verify-version
${SISYPHUS_GO_EXECUTABLE} build -o sisyphus/sisyphus -ldflags "-X main.version=${VERSION}" sisyphus/sisyphus.go
install: build
install -d ${DESTDIR}/usr/local/bin/
install -m 755 ./sisyphus/sisyphus ${DESTDIR}/usr/local/bin/sisyphus
test:
${SISYPHUS_GO_EXECUTABLE} get -u github.com/onsi/ginkgo/ginkgo
${SISYPHUS_GO_EXECUTABLE} get -u github.com/onsi/gomega
${GOPATH}/bin/ginkgo -r --randomizeAllSpecs --randomizeSuites --failOnPending --progress --cover --race
static-test:
${SISYPHUS_GO_EXECUTABLE} get -u github.com/alecthomas/gometalinter
${GOPATH}/bin/gometalinter --install
${GOPATH}/bin/gometalinter --vendor --deadline=5m --disable-all --enable=goconst --enable=gocyclo --enable=unused --enable=interfacer --enable=lll --enable=misspell --enable=staticcheck --enable=aligncheck --enable=deadcode --enable=goimports --enable=ineffassign --enable=unconvert --enable=unparam --enable=varcheck --enable=dupl --enable=errcheck --enable=golint --enable=structcheck --enable=gosimple --enable=safesql --tests --json . > gometalinter.out
send-coverage: test
CODECLIMATE_API_HOST=https://codebeat.co/webhooks/code_coverage \
CODECLIMATE_REPO_TOKEN=6A4615809-e3c4-4267-a049-eaec20ad63b5 \
codeclimate-test-reporter < sisyphus.coverprofile
integration-test:
${SISYPHUS_GO_EXECUTABLE} build
./sisyphus run
./sisyphus start
./sisyphus restart
./sisyphus status
./sisyphus stop
clean:
rm -f ./sisyphus/sisyphus
rm -rf ./dist
build-all:
${SISYPHUS_GO_EXECUTABLE} get -u github.com/franciscocpg/gox
${GOPATH}/bin/gox -verbose \
-ldflags "-X main.version=${VERSION}" \
-os="linux darwin windows freebsd openbsd netbsd" \
-arch="amd64 386 armv5 armv6 armv7 arm64" \
-osarch="!darwin/arm64" \
-output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}" ./sisyphus
dist: build-all
cd dist && \
$(DIST_DIRS) cp ../LICENSE {} \; && \
$(DIST_DIRS) cp ../README.md {} \; && \
$(DIST_DIRS) cp ../CHANGELOG.md {} \; && \
$(DIST_DIRS) tar -zcf sisyphus-${VERSION}-{}.tar.gz {} \; && \
$(DIST_DIRS) zip -r sisyphus-${VERSION}-{}.zip {} \; && \
cd ..
.PHONY: build test install clean build-all dist integration-test verify-version