forked from hyperledger-archives/fabric-chaincode-evm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
110 lines (88 loc) · 3.63 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
# Copyright IBM Corp All Rights Reserved.
# Copyright London Stock Exchange Group All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# -------------------------------------------------------------
# This makefile defines the following targets
#
# - all (default) - builds all targets and runs all tests/checks
# - basic-checks - performs basic checks like license, spelling and linter
# - check-deps - check for vendored dependencies that are no longer used
# - checks - runs all non-integration tests/checks
# - gotools - installs go tools like golint
# - license - checks go source files for Apache license header
# - linter - runs all code checks
# - unit-test - runs the go-test based unit tests
# - integration-test - runs the e2e_cli based test
# - docker-images - pulls the latest docker ccenv and couchdb images needed for integration tests
# - update-mocks - update the counterfeiter test doubles
#
ARCH=$(shell go env GOARCH)
BASEIMAGE_RELEASE=0.4.13
BASE_DOCKER_NS ?= hyperledger
BASE_DOCKER_TAG=$(ARCH)-$(BASEIMAGE_RELEASE)
FABRIC_RELEASE=1.4
PREV_VERSION=6111630c6cf12d3ca31559e93e33e9dad1e6f402
BASE_VERSION=0.1.0
PACKAGES = ./statemanager/... ./evmcc/... ./fab3/ ./eventmanager/...
EXECUTABLES ?= go git curl docker
K := $(foreach exec,$(EXECUTABLES),\
$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH: Check dependencies")))
all: checks integration-test
checks: basic-checks unit-test
basic-checks: license spelling linter build
.PHONY: spelling
spelling: gotool.misspell
@scripts/check_spelling.sh
.PHONY: license
license:
@scripts/check_license.sh
.PHONY: build
build: bin/fab3 bin/evmcc
.PHONY: clean
clean:
rm -rf bin/ node_modules/
include gotools.mk
.PHONY: gotools
gotools: gotools-install
unit-test: $(PROJECT_FILES) gotool.ginkgo
@echo "Running unit-tests"
@ginkgo -r -randomizeAllSpecs -noColor -keepGoing -race -tags "$(GO_TAGS)" $(PACKAGES)
unit-tests: unit-test
linter: gotool.goimports gotool.golint check-deps
@echo "LINT: Running code checks.."
@scripts/golinter.sh
check-deps: gotool.dep
@echo "DEP: Checking for dependency issues.."
dep version
dep check
changelog:
@scripts/changelog.sh v$(PREV_VERSION) v$(BASE_VERSION)
docker-images:
docker pull $(BASE_DOCKER_NS)/fabric-javaenv:$(FABRIC_RELEASE)
docker tag $(BASE_DOCKER_NS)/fabric-javaenv:$(FABRIC_RELEASE) $(BASE_DOCKER_NS)/fabric-javaenv:$(ARCH)-latest
docker pull $(BASE_DOCKER_NS)/fabric-couchdb:$(BASE_DOCKER_TAG)
docker tag $(BASE_DOCKER_NS)/fabric-couchdb:$(BASE_DOCKER_TAG) $(BASE_DOCKER_NS)/fabric-couchdb
docker pull $(BASE_DOCKER_NS)/fabric-zookeeper:$(BASE_DOCKER_TAG)
docker tag $(BASE_DOCKER_NS)/fabric-zookeeper:$(BASE_DOCKER_TAG) $(BASE_DOCKER_NS)/fabric-zookeeper
docker pull $(BASE_DOCKER_NS)/fabric-kafka:$(BASE_DOCKER_TAG)
docker tag $(BASE_DOCKER_NS)/fabric-kafka:$(BASE_DOCKER_TAG) $(BASE_DOCKER_NS)/fabric-kafka
.PHONY: integration-test
integration-test: docker-images gotool.ginkgo
@echo "Running integration-test"
@scripts/run-integration-tests.sh
fab3: bin/fab3
.PHONY: bin/fab3 # let 'go build' handle caching and whether to rebuild
bin/fab3:
mkdir -p bin/
go build -o bin/fab3 github.com/hyperledger/fabric-chaincode-evm/fab3/cmd
.PHONY: bin/evmcc # let 'go build' handle caching and whether to rebuild
bin/evmcc:
mkdir -p bin/
go build -o bin/evmcc github.com/hyperledger/fabric-chaincode-evm/evmcc
rm bin/evmcc # checking that it compiled, evmcc not meant to be run directly
.PHONY:
update-mocks: gotool.counterfeiter
go generate ./fab3/
counterfeiter -o mocks/evmcc/mockstub.go --fake-name MockStub vendor/github.com/hyperledger/fabric/core/chaincode/shim/interfaces.go ChaincodeStubInterface