forked from hyperledger/fabric-x-orderer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
111 lines (90 loc) · 3.47 KB
/
Makefile
File metadata and controls
111 lines (90 loc) · 3.47 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
111
# Copyright IBM Corp All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# This makefile defines the following targets
# - check-deps: check for vendored dependencies that are no longer used
# - linter: runs all code checks
# - binary: compiles arma and tools (armageddon) into ./bin directory
# - clean-binary: removes all contents of the ./bin directory
# - protos: generate all protobuf artifacts based on .proto files
# - linter-extra: runs extra lint checks on new changes since 'main'
# - check-license: checks files for Apache license header
# - check-dco: check that commits include Signed-off-by
# - docker-local: builds a single-platform image for the host’s OS/architecture
# - docker-multiarch: wrapper that triggers docker builds for multiple platforms
# Docker image vars
DOCKERFILE ?= images/multi-platform/Dockerfile
IMAGE_NAMESPACE = docker.io/hyperledger
IMAGE_NAME = fabric-x-orderer
VERSION = latest
ORDERER_REVISION = $(shell git rev-parse HEAD)
ORDERER_CREATED = $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
.PHONY: basic-checks
basic-checks: check-license check-dco check-protos linter
.PHONY: linter
linter: check-deps
@echo "LINT: Running code checks.."
./scripts/golinter.sh
.PHONY: check-deps
check-deps:
@echo "DEP: Checking for dependency issues.."
./scripts/check_deps.sh
.PHONY: binary
binary:
mkdir -p ./bin
go build -o ./bin/arma ./cmd/arma
go build -o ./bin/armageddon ./cmd/armageddon
.PHONY: clean-binary
clean-binary:
rm -rf ./bin/*
.PHONY: protos
protos:
@echo "Compiling non-API protos..."
(bash ./scripts/compile_protos.sh)
.PHONY: linter-extra
linter-extra: check-deps
@echo "LINT-Extra: Running code checks.."
@! golangci-lint run --color=always --sort-results --new-from-rev=main 2>&1 | tee /dev/tty | grep -qE "(gofmt|goimports|misspell|whitespace|gocritic)" || \
echo "\nRun 'golangci-lint run --fix --new-from-rev=main' to fix issues"
.PHONY: check-license
check-license:
@echo "Checking license headers..."
@./scripts/check_license.sh
.PHONY: check-dco
check-dco:
@echo "Checking DCO..."
@./scripts/check_dco.sh
.PHONY: check-protos
check-protos:
@echo "Checking protos..."
@./scripts/check_protos.sh
.PHONY: unit-tests
unit-tests:
go test -race -timeout 20m $$(go list ./... | grep -v /test)
.PHONY: integration-basic
integration-basic:
go test -race -timeout 30m ./test/basic/...
.PHONY: integration-faulttolerance
integration-faulttolerance:
go test -race -timeout 30m ./test/faulttolerance/...
.PHONY: integration-reconfig
integration-reconfig:
go test -race -timeout 30m ./test/reconfig/...
.PHONY: integration-tests
integration-tests: integration-basic integration-faulttolerance integration-reconfig
.PHONY: sample-tests
sample-tests:
set -e
(cd node/examples; bash ./scripts/build_docker.sh)
(bash ./node/examples/scripts/run_sample.sh)
# Build the HLFX Orderer image
.PHONY: build-image
build-image:
@echo "Building the image ${IMAGE_NAMESPACE}/${IMAGE_NAME}:${VERSION}..."
@./scripts/build_image.sh -t ${IMAGE_NAMESPACE}/${IMAGE_NAME}:${VERSION} -f ${DOCKERFILE} --build-arg REVISION=$(ORDERER_REVISION) --build-arg CREATED=$(ORDERER_CREATED)
# Build the HLFX Orderer multiplatform image
.PHONY: build-multiplatform-image
build-multiplatform-image:
@echo "Building the multiplatform image ${IMAGE_NAMESPACE}/${IMAGE_NAME}:${VERSION}..."
@./scripts/build_image.sh -t ${IMAGE_NAMESPACE}/${IMAGE_NAME}:${VERSION} -f ${DOCKERFILE} --multiplatform --build-arg REVISION=$(ORDERER_REVISION) --build-arg CREATED=$(ORDERER_CREATED)