forked from rabbitmq/rabbitmq-perf-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
133 lines (104 loc) · 4.5 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
SHELL := bash# we want bash behaviour in all shell invocations
.DEFAULT_GOAL = help
### VARIABLES ###
#
export PATH := $(CURDIR):$(CURDIR)/scripts:$(PATH)
OS := $$(uname -s | tr '[:upper:]' '[:lower:]')
HARDWARE := $$(uname -m | tr '[:upper:]' '[:lower:]')
GPG_KEYNAME := $$(awk -F'[<>]' '/<gpg.keyname>/ { print $$3 }' pom.xml)
TODAY := $(shell date -u +'%Y.%m.%d')
RELEASE_VERSION ?= 2.14.0
### TARGETS ###
#
.PHONY: binary
binary: clean ## Build the binary distribution
@mvnw package -Dmaven.test.skip -Dgpg.skip=true
@mvnw assembly:single -P assemblies -Dmaven.test.skip
.PHONY: native-image
native-image: clean ## Build the native image
@mvnw -q package -DskipTests -P native-image -P '!java-packaging'
native-image -jar target/perf-test.jar -H:Features="com.rabbitmq.perf.NativeImageFeature" \
--initialize-at-build-time=io.micrometer \
--initialize-at-build-time=com.rabbitmq.client \
--initialize-at-build-time=org.eclipse.jetty \
--initialize-at-build-time=javax.servlet \
--initialize-at-build-time=org.slf4j \
--no-fallback \
-H:IncludeResources="rabbitmq-perf-test.properties"
.PHONY: docker-image-dev
docker-image-dev: binary ## Build Docker image with the local PerfTest version
@docker build \
--file Dockerfile-ubuntu \
--tag pivotalrabbitmq/perf-test:dev-$(TODAY) \
.
.PHONY: test-docker-image-dev
test-docker-image-dev: ## Test the Docker image with the local PerfTest version
@docker run -it --rm pivotalrabbitmq/perf-test:dev-$(TODAY) --version
.PHONY: push-docker-image-dev
push-docker-image-dev: ## Push the Docker image with the local PerfTest version
@docker push pivotalrabbitmq/perf-test:dev-$(TODAY)
.PHONY: docker-image-alpine
docker-image-alpine: binary ## Build Alpine-based Docker image
@docker build \
--file Dockerfile-alpine \
--tag pivotalrabbitmq/perf-test:$(RELEASE_VERSION)-alpine \
.
.PHONY: test-docker-image-alpine
test-docker-image-alpine: ## Test the Alpine-based Docker image
@docker run -it --rm pivotalrabbitmq/perf-test:$(RELEASE_VERSION)-alpine --version
.PHONY: docker-image-ubuntu
docker-image-ubuntu: binary ## Build Ubuntu-based Docker image
@docker build \
--file Dockerfile-ubuntu \
--tag pivotalrabbitmq/perf-test:$(RELEASE_VERSION)-ubuntu \
--tag pivotalrabbitmq/perf-test:$(RELEASE_VERSION) \
--tag pivotalrabbitmq/perf-test:latest \
.
.PHONY: test-docker-image-ubuntu
test-docker-image-ubuntu: ## Test the Ubuntu-based Docker image
@docker run -it --rm pivotalrabbitmq/perf-test:$(RELEASE_VERSION)-ubuntu --version
.PHONY: docker-images
docker-images: docker-image-alpine docker-image-ubuntu ## Build Docker images
.PHONY: test-docker-images
test-docker-images: test-docker-image-alpine test-docker-image-ubuntu ## Test the Docker images
.PHONY: push-docker-images
push-docker-images: ## Push docker images to Docker Hub
@docker push pivotalrabbitmq/perf-test:$(RELEASE_VERSION)-ubuntu
@docker push pivotalrabbitmq/perf-test:$(RELEASE_VERSION)
@docker push pivotalrabbitmq/perf-test:latest
@docker push pivotalrabbitmq/perf-test:$(RELEASE_VERSION)-alpine
.PHONY: delete-docker-images
delete-docker-images: ## Delete the created Docker images from the local machine
@docker rmi pivotalrabbitmq/perf-test:$(RELEASE_VERSION)-ubuntu
@docker rmi pivotalrabbitmq/perf-test:$(RELEASE_VERSION)
@docker rmi pivotalrabbitmq/perf-test:latest
@docker rmi pivotalrabbitmq/perf-test:$(RELEASE_VERSION)-alpine
.PHONY: package-native-image
package-native-image: native-image ## Package the native image
cp perf-test target/perf-test_$(OS)_$(HARDWARE)
@mvnw -q checksum:files -P native-image
gpg --armor --local-user $(GPG_KEYNAME) --detach-sign target/perf-test_$(OS)_$(HARDWARE)
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-24s\033[0m %s\n", $$1, $$2}'
.PHONY: clean
clean: ## Clean all build artefacts
@mvnw clean
.PHONY: compile
compile: ## Compile the source code
@mvnw compile
.PHONY: install
install: clean ## Create and copy the binaries into the local Maven repository
@mvnw install -Dmaven.test.skip
.PHONY: jar
jar: clean ## Build the JAR file
@mvnw package -Dmaven.test.skip
.PHONY: run
run: compile ## Run PerfTest, pass exec arguments via ARGS, e.g. ARGS="-x 1 -y 1 -r 1"
@mvnw exec:java -Dexec.mainClass="com.rabbitmq.perf.PerfTest" -Dexec.args="$(ARGS)"
.PHONY: signed-binary
signed-binary: clean ## Build a GPG signed binary
@mvnw package -P assemblies
.PHONY: doc
doc: ## Generate PerfTest documentation
@mvnw asciidoctor:process-asciidoc