-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove nix Signed-off-by: joshvanl <me@joshvanl.dev> * Fix workflow file by separating `uses` and `runs` Signed-off-by: joshvanl <me@joshvanl.dev> * Update workflow target branch main -> master Signed-off-by: joshvanl <me@joshvanl.dev> * Add Makefile back Signed-off-by: Artur Souza <asouza.pro@gmail.com> * Use less strict lint settings. Signed-off-by: Artur Souza <asouza.pro@gmail.com> --------- Signed-off-by: joshvanl <me@joshvanl.dev> Signed-off-by: Artur Souza <asouza.pro@gmail.com> Co-authored-by: Artur Souza <asouza.pro@gmail.com>
- Loading branch information
1 parent
7d28278
commit a46af5f
Showing
6 changed files
with
79 additions
and
458 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
################################################################################ | ||
# Target: lint # | ||
################################################################################ | ||
# Please use golangci-lint with matching version, otherwise you might encounter errors. | ||
# You can download at https://github.com/golangci/golangci-lint/releases/ | ||
# Check .github/wortkflows/test.yaml for the version used in GitHub actions. | ||
|
||
ifeq ($(GOOS),windows) | ||
GOLANGCI_LINT:=golangci-lint.exe | ||
else | ||
GOLANGCI_LINT:=golangci-lint | ||
endif | ||
|
||
.PHONY: lint | ||
lint: | ||
$(GOLANGCI_LINT) run --timeout=20m | ||
|
||
|
||
################################################################################ | ||
# Target: check-linter # | ||
################################################################################ | ||
.SILENT: check-linter # Silence output other than the application run | ||
.PHONY: check-linter | ||
check-linter: | ||
$(RUN_BUILD_TOOLS) check-linter | ||
|
||
|
||
################################################################################ | ||
# Target: modtidy # | ||
################################################################################ | ||
.PHONY: modtidy | ||
modtidy: | ||
go mod tidy | ||
|
||
################################################################################ | ||
# Target: gen-proto # | ||
################################################################################ | ||
PROTOC ?=protoc | ||
PROTOC_VERSION = 24.4 | ||
PROTOBUF_SUITE_VERSION = 24.4 | ||
PROTOC_GEN_GO_VERSION = v1.32.0 | ||
|
||
PROTOC_GEN_GO_GRPC_VERSION = 1.3.0 | ||
|
||
PROTOS:=$(shell ls proto) | ||
PROTO_PREFIX:=github.com/diagridio/go-etcd-cron | ||
|
||
.PHONY: check-proto-version | ||
check-proto-version: ## Checking the version of proto related tools | ||
@test "$(shell protoc --version)" = "libprotoc $(PROTOC_VERSION)" \ | ||
|| { echo "please use protoc $(PROTOC_VERSION) (protobuf $(PROTOBUF_SUITE_VERSION)) to generate proto"; exit 1; } | ||
|
||
@test "$(shell protoc-gen-go-grpc --version)" = "protoc-gen-go-grpc $(PROTOC_GEN_GO_GRPC_VERSION)" \ | ||
|| { echo "please use protoc-gen-go-grpc $(PROTOC_GEN_GO_GRPC_VERSION) to generate proto"; exit 1; } | ||
|
||
@test "$(shell protoc-gen-go --version 2>&1)" = "protoc-gen-go $(PROTOC_GEN_GO_VERSION)" \ | ||
|| { echo "please use protoc-gen-go $(PROTOC_GEN_GO_VERSION) to generate proto"; exit 1; } | ||
|
||
# Generate archive files for each binary | ||
# $(1): the binary name to be archived | ||
define genProtoc | ||
.PHONY: gen-proto-$(1) | ||
gen-proto-$(1): | ||
$(PROTOC) --go_out=. --go_opt=module=$(PROTO_PREFIX) --go-grpc_out=. --go-grpc_opt=require_unimplemented_servers=false,module=$(PROTO_PREFIX) ./proto/$(1)/* | ||
endef | ||
|
||
$(foreach ITEM,$(PROTOS),$(eval $(call genProtoc,$(ITEM)))) | ||
|
||
GEN_PROTOS:=$(foreach ITEM,$(PROTOS),gen-proto-$(ITEM)) | ||
|
||
.PHONY: gen-proto | ||
gen-proto: check-proto-version $(GEN_PROTOS) modtidy | ||
|
||
test: | ||
go test -timeout 300s --race ./... |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.