未验证 提交 c7e2b3fa 编写于 作者: K kezhenxu94 提交者: GitHub

chore: move tools setup into Makefile to easy the setup work locally (#42)

上级 e3ffd58d
......@@ -35,12 +35,6 @@ jobs:
go-version: 1.13
id: go
- name: Set up Packr
run: go get -u github.com/gobuffalo/packr/v2/...
- name: Set up GQLGen
run: go get -u github.com/99designs/gqlgen
- name: Check out code into the Go module directory
uses: actions/checkout@v2
......
......@@ -44,10 +44,16 @@ SHELL = /bin/bash
all: clean license deps codegen lint test build
deps:
tools:
$(GO_PACKR) -v || go get -u github.com/gobuffalo/packr/v2/...
$(GO_LINT) version || curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_PATH)/bin v1.21.0
$(GO_LICENSER) -version || GO111MODULE=off $(GO_GET) -u github.com/elastic/go-licenser
$(GQL_GEN) version || go get -u github.com/99designs/gqlgen
deps: tools
$(GO_GET) -v -t -d ./...
codegen: clean
codegen: clean tools
echo 'scalar Long' > query-protocol/schema.graphqls
$(GQL_GEN) generate
-rm -rf generated.go
......@@ -59,8 +65,7 @@ $(PLATFORMS):
GOOS=$(os) GOARCH=$(ARCH) $(GO_BUILD) $(GO_BUILD_FLAGS) -ldflags "$(GO_BUILD_LDFLAGS)" -o $(OUT_DIR)/$(BINARY)-$(VERSION)-$(os)-$(ARCH) cmd/main.go
.PHONY: lint
lint: codegen
$(GO_LINT) version || curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_PATH)/bin v1.21.0
lint: codegen tools
$(GO_LINT) run -v ./...
.PHONE: test
......@@ -71,15 +76,14 @@ test: clean codegen lint
build: deps windows linux darwin
.PHONY: license
license: clean
$(GO_LICENSER) -version || GO111MODULE=off $(GO_GET) -u github.com/elastic/go-licenser
license: clean tools
$(GO_LICENSER) -d -licensor='Apache Software Foundation (ASF)' .
.PHONY: verify
verify: clean lint test license
.PHONY: fix
fix:
fix: tools
$(GO_LINT) run -v --fix ./...
$(GO_LICENSER) -licensor='Apache Software Foundation (ASF)' .
......@@ -88,7 +92,7 @@ coverage: test
bash <(curl -s https://codecov.io/bash) -t a5af28a3-92a2-4b35-9a77-54ad99b1ae00
.PHONY: clean
clean:
clean: tools
-rm -rf bin
-rm -rf coverage.txt
-rm -rf query-protocol/schema.graphqls
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册