-
Notifications
You must be signed in to change notification settings - Fork 44
/
Makefile
138 lines (111 loc) · 4.18 KB
/
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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
BIN_DIR = bin
export GOPATH ?= $(shell go env GOPATH)
export GO111MODULE ?= on
export PROJECT_SERUM_VERSION ?=v0.29.0
export PROJECT_SERUM_IMAGE ?= backpackapp/build:$(PROJECT_SERUM_VERSION)
LINUX=LINUX
OSX=OSX
WINDOWS=WIN32
OSFLAG :=
ifeq ($(OS),Windows_NT)
OSFLAG = $(WINDOWS)
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OSFLAG = $(LINUX)
endif
ifeq ($(UNAME_S),Darwin)
OSFLAG = $(OSX)
endif
endif
download:
go mod download
install:
ifeq ($(OSFLAG),$(WINDOWS))
echo "If you are running windows and know how to install what is needed, please contribute by adding it here!"
exit 1
endif
ifeq ($(OSFLAG),$(OSX))
brew install gpg
brew install asdf
asdf plugin-add nodejs || true
asdf plugin-add rust || true
asdf plugin-add golang || true
asdf plugin-add ginkgo || true
asdf plugin-add pulumi || true
asdf plugin add actionlint || true
asdf plugin add shellcheck || true
asdf plugin add kubectl || true
asdf plugin add yarn || true
asdf plugin add golangci-lint || true
asdf plugin add mockery || true
asdf install
go install github.com/smartcontractkit/chainlink-testing-framework/tools/gotestloghelper@latest
endif
ifeq ($(OSFLAG),$(LINUX))
ifneq ($(CI),true)
# install nix
sh <(curl -L https://nixos-nix-install-tests.cachix.org/serve/vij683ly7sl95nnhb67bdjjfabclr85m/install) --daemon --tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve --nix-extra-conf-file ./nix.conf
endif
endif
.PHONY: nix-flake-update
nix-flake-update:
docker run -it --rm -v $(shell pwd):/repo -e NIX_USER_CONF_FILES=/repo/nix.conf --workdir /repo nixos/nix:latest /bin/sh -c "nix flake update"
.PHONY: projectserum_version
projectserum_version:
@echo "${PROJECT_SERUM_VERSION}"
anchor_shell:
docker run --rm -it -v $(shell pwd):/workdir --entrypoint bash ${PROJECT_SERUM_IMAGE}
build_js:
cd gauntlet && yarn install --frozen-lockfile && yarn bundle
build_contracts:
docker run --rm -it -v $(shell pwd):/workdir ${PROJECT_SERUM_IMAGE} /bin/bash ./scripts/anchor-build.sh
build_contracts_local:
docker run --rm -it -v $(shell pwd):/workdir ${PROJECT_SERUM_IMAGE} /bin/bash ./scripts/setup-local.sh
build_contracts_staging:
docker run --rm -it -v $(shell pwd):/workdir ${PROJECT_SERUM_IMAGE} /bin/bash ./scripts/setup-staging.sh
cp_gauntlet_idl:
cp ./contracts/target/idl/*.json ./gauntlet/packages/gauntlet-solana-contracts/artifacts/schemas
build: build_js build_contracts cp_gauntlet_idl
build_local: build_js build_contracts_local cp_gauntlet_idl
build_staging: build_js build_contracts_staging cp_gauntlet_idl
test_relay_unit:
go build -v ./pkg/...
go test -v ./pkg/...
test_smoke:
cd ./integration-tests &&\
SELECTED_NETWORKS=SIMULATED go test -timeout 1h -count=1 -json $(args) -run TestSolanaOCRV2Smoke ./smoke 2>&1 | tee /tmp/gotest.log | gotestloghelper -json -tlogprefix -singlepackage -color
test_relay_integration:
cd ./integration-tests &&\
go test -timeout 20m -count=1 -json $(args) ./relayinterface/... 2>&1 | tee /tmp/gotest.log | gotestloghelper -json -tlogprefix -singlepackage -color
.PHONY: gomods
gomods: ## Install gomods
go install github.com/jmank88/[email protected]
.PHONY: gomodtidy
gomodtidy: gomods
gomods tidy
.PHONY: mockery
mockery: $(mockery) ## Install mockery.
go install github.com/vektra/mockery/[email protected]
.PHONY: rm-mocked
rm-mocked:
grep -rl "^// Code generated by mockery" | grep .go$ | xargs -r rm
.PHONY: generate
generate: mockery gomods
gomods -w go generate -x ./...
mockery
.PHONY: lint-go-integration-tests
lint-go-integration-tests:
cd ./integration-tests && golangci-lint --max-issues-per-linter 0 --max-same-issues 0 --color=always --exclude=dot-imports --timeout 10m --out-format checkstyle:golangci-lint-integration-tests-report.xml run
.PHONY: lint-go-relay
lint-go-relay:
cd ./pkg && golangci-lint --max-issues-per-linter 0 --max-same-issues 0 --color=always --exclude=dot-imports --timeout 10m --out-format checkstyle:golangci-lint-relay-report.xml run
.PHONY: upgrade-solana-image
upgrade-solana-image:
./scripts/update-solana.sh
.PHONY: update-e2e-core-deps
upgrade-e2e-core-deps:
cd ./integration-tests && ../scripts/update-e2e.sh
.PHONY: format-contracts
format-contracts:
cd ./contracts && cargo fmt && go fmt ./... && pnpm format