Repository navigation
Expand file tree
/
Copy pathJustfile
More file actions
110 lines (89 loc) · 4.96 KB
/
Copy pathJustfile
File metadata and controls
110 lines (89 loc) · 4.96 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import './tools/lib/utils.justfile'
# Default: show available recipes
default:
just --list
# Coverage exclusion regex for mockery-generated files
# - mock_*.go files
# - *_mocks directories
# - mocks directories
COVERAGE_EXCLUDE_REGEX := '(/mock_.*\.go:|/_mocks/.*:|/mocks/.*:)'
install-protoc:
sudo ./tools/bin/install-protoc.sh $VERSION_PROTOC
install-go-tools:
go install github.com/jmank88/gomods@v$VERSION_GOMODS
go install github.com/jmank88/modgraph@v$VERSION_MODGRAPH
go install google.golang.org/protobuf/cmd/protoc-gen-go@v$VERSION_PROTOC_GEN_GO
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v$VERSION_PROTOC_GEN_GO_GRPC
go install github.com/bufbuild/buf/cmd/buf@v$VERSION_BUF
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v$VERSION_GOLANGCI_LINT
go install github.com/vektra/mockery/v2@v$VERSION_MOCKERY
go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v$VERSION_OAPI_CODEGEN
go install github.com/a-h/templ/cmd/templ@v$VERSION_TEMPL
install-pre-commit:
brew install pre-commit
pre-commit install
generate: ensure-oapi-codegen ensure-templ
rm -f indexer/indexer_openapi_v1.yaml
rm -f indexer/pkg/client/internal/client.go
find . -name 'go.mod' -execdir go generate ./... \;
just config-docs
just mock
# Regenerate configuration/secrets docs from the app config structs.
# Freshness is enforced by TestConfigDocsFresh in ./tools/configdoc.
#
# The generated doccomments_gen.go files are deleted first so that deleting a documented type stays
# recoverable: the stale file left behind holds a method on a type that no longer exists, which
# breaks the package it sits in, and the generator imports every such package through its registry.
# Without the delete it could never build far enough to remove the file itself. Only files carrying
# this tool's generated-by header are touched, and the run rewrites every one it still reaches.
config-docs: ensure-go
grep -rl --include='doccomments_gen.go' 'Code generated by github.com/smartcontractkit/chainlink-ccv/tools/configdoc' . | xargs rm -f
go run ./tools/configdoc/cmd/generate -o docs/config
mock: ensure-mockery
@echo "Cleaning existing mocks..."
# remove standalone mock_*.go files created by mockery
find . -type f -name 'mock_*.go' -print -delete
@echo "Generating mocks with mockery..."
find . -type f -name .mockery.yaml -execdir mockery \;
tidy: ensure-go ensure-gomods ensure-modgraph
gomods tidy
./tools/bin/modgraph.sh > go.md
# Format all go files
fmt: ensure-golangci-lint
find . -type f -name go.mod -execdir golangci-lint fmt \;
# Run golangci-lint (positional args: fix?, timeout?). Pass `true` or `fix` as the first arg to add
# golangci's --fix; other tokens (e.g. mistyped `--timeout`) must not enable --fix.
# The noeagerio analyzer runs as a lint dependency: one cheap go vet pass.
lint fix="" timeout="10m": ensure-golangci-lint lint-noeagerio
gomods -c 'golangci-lint run --config {{justfile_directory()}}/.golangci.yaml {{ if fix == "true" { "--fix" } else if fix == "fix" { "--fix" } else { "" } }} --timeout {{timeout}}'
# Run the noeagerio analyzer (tools/noeagerio): no I/O in constructors or Start
# methods. Runs on the root module only; build/devenv and deployment are excluded.
lint-noeagerio: ensure-go
go build -o "$(go env GOPATH)/bin/noeagerio" ./tools/noeagerio/cmd/noeagerio
go vet -vettool="$(go env GOPATH)/bin/noeagerio" ./...
shellcheck:
@command -v shellcheck >/dev/null 2>&1 || { \
echo "shellcheck is not installed. Please install it first."; \
exit 1; \
}
find . -type f -name *.sh -execdir shellcheck {} +
mod-download: ensure-go
go mod download
test short="": ensure-go
gomods -w go test -fullpath -shuffle on {{ if short != "" { "-short" } else { "" } }} -v -race ./...
test-coverage coverage_file="coverage.out" short="":
# coverage_file := env_var_or_default('COVERAGE_FILE', 'coverage.out')
go test -v -race -fullpath -shuffle on {{ if short != "" { "-short" } else { "" } }} -v -coverprofile={{coverage_file}} ./...
# Filter mockery-generated files (mock_*.go) from coverage profile
{ head -n1 {{coverage_file}}; tail -n +2 {{coverage_file}} | grep -v -E '{{COVERAGE_EXCLUDE_REGEX}}' || true; } > {{coverage_file}}.filtered
mv {{coverage_file}}.filtered {{coverage_file}}
bump-chainlink-ccip sha:
@echo "Bumping chainlink-ccip dependencies in root..."
go get github.com/smartcontractkit/chainlink-ccip/chains/evm@{{sha}}
@echo "Bumping chainlink-ccip dependencies in build/devenv..."
(cd build/devenv && go get github.com/smartcontractkit/chainlink-ccip@{{sha}} && go get github.com/smartcontractkit/chainlink-ccip/chains/evm/deployment@{{sha}} && go get github.com/smartcontractkit/chainlink-ccip/deployment@{{sha}} && go get github.com/smartcontractkit/chainlink-ccip/chains/evm@{{sha}})
@just tidy
sh:
@just ccv sh
ccv args="sh":
cd ./build/devenv && go run ./cmd/ccv {{args}}