forked from GitDataAI/jzfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
36 lines (28 loc) · 955 Bytes
/
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
SHELL=/usr/bin/env bash
GOCMD=$(or $(shell which go), $(error "Missing dependency - no go in PATH"))
GOGENERATE=$(GOCMD) generate
all: build
.PHONY: all
ldflags=-X=github.com/GitDataAI/jiaozifs/version.CurrentCommit=+git.$(subst -,.,$(shell git describe --always --match=NeVeRmAtCh --dirty 2>/dev/null || git rev-parse --short HEAD 2>/dev/null))
ifneq ($(strip $(LDFLAGS)),)
ldflags+=-extldflags=$(LDFLAGS)
endif
GOFLAGS+=-ldflags=$(ldflags)
gen-api: ./api/swagger.yml ./api/tmpls/chi
$(GOGENERATE) ./api
$(GOGENERATE) ./models/rbacmodel
install-go-swagger:
go install github.com/go-swagger/go-swagger/cmd/swagger@latest
SWAGGER_ARG=
swagger-srv:
swagger serve $(SWAGGER_ARG) -F swagger ./api/swagger.yml
lint:
golangci-lint run ./...
test: gen-api
go test -timeout=30m -parallel=4 -v ./...
build:gen-api
go build $(GOFLAGS) -o jzfs
TAG:=test
docker:build
docker build -t gitdatateam/jzfs:$(TAG) .
docker push gitdatateam/jzfs:$(TAG)