-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (58 loc) · 2.76 KB
/
Makefile
File metadata and controls
72 lines (58 loc) · 2.76 KB
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
.PHONY: gomods
gomods: ## Install gomods
go install github.com/jmank88/gomods@v0.1.6
.PHONY: gomodtidy
gomodtidy: gomods
gomods -s proto_vendor tidy
.PHONY: docs
docs:
go doc -http
.PHONY: install-protoc
install-protoc:
script/install-protoc.sh 29.3 /
go install google.golang.org/protobuf/cmd/protoc-gen-go@`go list -m -json google.golang.org/protobuf | jq -r .Version`
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1
.PHONY: mockery
mockery: $(mockery) ## Install mockery.
go install github.com/vektra/mockery/v2@v2.53.3
.PHONY: rm-mocked
rm-mocked:
grep -rl "^// Code generated by mockery" | grep .go$ | xargs -r rm
.PHONY: rm-builders
rm-builders:
# not sure why, but go.tmpl is matched when run in makefile but not when run in the commandline.
grep -rl "^// Code generated by github.com/smartcontractkit/chainlink-common/pkg/capabilities/cli" | grep .go$ | grep -v go.tmpl$ | xargs -r rm
# test wasm file should be removed as well
rm -f ./pkg/workflows/wasm/host/test/cmd/testmodule.wasm
.PHONY: generate
generate: mockery install-protoc gomods cre-protoc modgraph
export PATH="$(HOME)/.local/bin:$(HOME)/go/bin:$(PATH)"; gomods -s proto_vendor -go generate -x ./...
find . -type f -name .mockery.yaml -execdir mockery \; ## Execute mockery for all .mockery.yaml files. If this fails, you might have a local mockery installed. Uninstall or update it.
.PHONY: cre-protoc
cre-protoc:
cd pkg/capabilities/v2/protoc && go build -o protoc-gen-cre .
.PHONY: lint-workspace lint
# If GOLANGCI_LINT_VERSION is not set, extract it from .tool-versions
ifndef GOLANGCI_LINT_VERSION
GOLANGCI_LINT_VERSION := $(shell grep '^golangci-lint ' .tool-versions | awk '{print $$2}')
endif
GOLANGCI_LINT_COMMON_OPTS := --max-issues-per-linter 0 --max-same-issues 0
GOLANGCI_LINT_DIRECTORY := ./golangci-lint
lint-workspace:
@./script/lint.sh $(GOLANGCI_LINT_VERSION) "$(GOLANGCI_LINT_COMMON_OPTS)" $(GOLANGCI_LINT_DIRECTORY)
lint:
@./script/lint.sh $(GOLANGCI_LINT_VERSION) "$(GOLANGCI_LINT_COMMON_OPTS)" $(GOLANGCI_LINT_DIRECTORY) "--new-from-rev=origin/main"
.PHONY: modgraph
modgraph: gomods
go install github.com/jmank88/modgraph@v0.1.0
./modgraph > go.md
.PHONY: dependabot
ifndef DEPENDABOT_SEVERITY
DEPENDABOT_SEVERITY := "critical,high"
endif
dependabot: gomods
gh api --paginate -H "Accept: application/vnd.github+json" --method GET \
'/repos/smartcontractkit/chainlink-common/dependabot/alerts?state=open&ecosystem=Go&severity=$(DEPENDABOT_SEVERITY)' | \
jq -r '.[] | select(.security_vulnerability.first_patched_version != null) | .dependency.manifest_path |= rtrimstr("go.mod") | "./\(.dependency.manifest_path) \(.security_vulnerability.package.name) \(.security_vulnerability.first_patched_version.identifier)"' | \
go run ./script/cmd/dependabot
gomods tidy