-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (53 loc) · 1.92 KB
/
Makefile
File metadata and controls
68 lines (53 loc) · 1.92 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
.PHONY: all build build-admin lint test test-e2e test-quick clean goreleaser-dev-build install-tools install-foundry run-op gendoc
# Go parameters
COMMIT_SHA = $(shell git rev-parse HEAD)
GOCMD=go
GORELEASER=goreleaser
GOLANGCI_LINT=golangci-lint
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GOGET=$(GOCMD) get
GORUN=$(GOCMD) run
BUILD_FLAGS=-ldflags "-w -X 'github.com/smartcontractkit/cre-cli/cmd/version.Version=build $(COMMIT_SHA)'"
BINARY_NAME=cre
ADMIN_BINARY_NAME=cre-admin
GENDOC_BINARY_NAME=gendoc-cli
all: clean test build
build:
$(GOBUILD) $(BUILD_FLAGS) -o $(BINARY_NAME) -v
lint:
$(GOLANGCI_LINT) --color=always run ./... --fix -v
test: lint
$(GOTEST) -v $$(go list ./... | grep -v usbwallet)
test-e2e:
$(GOTEST) -v -p 5 ./test/
# test-quick: run tests with 30s timeout, skipping slow/flaky e2e tests. Use -short so TestE2EInit_ConvertToCustomBuild_TS is skipped.
test-quick:
$(GOTEST) ./... -v -short -skip 'MultiCommandHappyPaths|TestPostToGateway|TestBlankWorkflowSimulation|TestWaitForBackendLinkProcessing|TestTryAutoLink|TestCheckLinkStatusViaGraphQL|Fails to run tests with invalid Go code' -timeout 30s
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
rm -f $(ADMIN_BINARY_NAME)
rm -f $(GENDOC_BINARY_NAME)
rm -rf dist
rm -f test/proposal_*.json
rm -f test/.proposal_*.json
run: build
./$(BINARY_NAME) $(CMD)
GORELEASER_CONFIG ?= .goreleaser.yml
goreleaser-dev-build:
$(GORELEASER) build --snapshot --clean --config=$(GORELEASER_CONFIG)
install-tools: install-foundry
asdf plugin add golang https://github.com/kennyp/asdf-golang.git
asdf plugin add golangci-lint https://github.com/hypnoglow/asdf-golangci-lint.git
asdf plugin add goreleaser https://github.com/kforsthoevel/asdf-goreleaser.git
asdf install
install-foundry:
curl -L https://foundry.paradigm.xyz | bash
foundryup --install v1.1.0
run-op:
op run --env-file=".env" -- ./$(BINARY_NAME) $(CMD)
gendoc:
rm -f docs/*
$(GORUN) gendoc/main.go