forked from cs3org/reva
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
89 lines (67 loc) · 2.45 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
.PHONY: build
SHELL := /bin/bash
BUILD_DATE=`date +%FT%T%z`
GIT_COMMIT=`git rev-parse --short HEAD`
GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`
GIT_DIRTY=`git diff-index --quiet HEAD -- || echo "dirty-"`
VERSION=`git describe --always`
GO_VERSION=`go version | awk '{print $$3}'`
default: build test lint gen-doc check-changelog
release: deps build test lint gen-doc check-changelog
off:
GOPROXY=off
echo BUILD_DATE=${BUILD_DATE}
echo GIT_COMMIT=${GIT_COMMIT}
echo GIT_DIRTY=${GIT_DIRTY}
echo VERSION=${VERSION}
echo GO_VERSION=${GO_VERSION}
imports: off
`go env GOPATH`/bin/goimports -w tools pkg internal cmd
build: imports
go build -o ./cmd/revad/revad ./cmd/revad
go build -o ./cmd/reva/reva ./cmd/reva
tidy:
go mod tidy
build-revad: imports
go build -o ./cmd/revad/revad ./cmd/revad
build-reva: imports
go build -o ./cmd/reva/reva ./cmd/reva
test: off
go test -race ./...
lint:
go run tools/check-license/check-license.go
`go env GOPATH`/bin/golangci-lint run --timeout 2m0s
contrib:
git shortlog -se | cut -c8- | sort -u | awk '{print "-", $$0}' | grep -v 'users.noreply.github.com' > CONTRIBUTORS.md
# for manual building only
deps:
cd /tmp && rm -rf golangci-lint && git clone --quiet -b 'v1.26.0' --single-branch --depth 1 https://github.com/golangci/golangci-lint &> /dev/null && cd golangci-lint/cmd/golangci-lint && go install
cd /tmp && go get golang.org/x/tools/cmd/goimports
build-ci: off
go build -o ./cmd/revad/revad ./cmd/revad
go build -o ./cmd/reva/reva ./cmd/reva
lint-ci:
go run tools/check-license/check-license.go
gen-doc:
go run tools/generate-documentation/main.go
check-changelog:
go run tools/check-changelog/main.go
check-changelog-drone:
go run tools/check-changelog/main.go -repo origin -pr "$(PR)"
# to be run in CI platform
ci: build-ci test lint-ci
# to be run in Docker build
build-revad-docker: off
go build -o ./cmd/revad/revad ./cmd/revad
build-reva-docker: off
go build -o ./cmd/reva/reva ./cmd/reva
clean:
rm -rf dist
# for releasing you need to run: go run tools/prepare-release/main.go
# $ go run tools/prepare-release/main.go -version 0.0.1 -commit -tag
release-deps:
cd /tmp && rm -rf calens && git clone --quiet -b 'v0.2.0' --single-branch --depth 1 https://github.com/restic/calens &> /dev/null && cd calens && go install
# create local build versions
dist: default
go run tools/create-artifacts/main.go -version ${VERSION} -commit ${GIT_COMMIT} -goversion ${GO_VERSION}
all: deps default