-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (67 loc) · 3.74 KB
/
Copy pathMakefile
File metadata and controls
84 lines (67 loc) · 3.74 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
# =============================================================================
# Makefile — OpenCoroutineProxy developer task runner
#
# Designed for fast onboarding: clone → make setup → make test → make run
#
# Targets:
# setup First-time environment setup (generates Gradle wrapper)
# build Compile and package the fat JAR
# test Run all unit + integration tests with Gradle
# run Start the proxy locally on port 8080
# docker-build Build the Docker image
# docker-up Build image + start full stack (proxy + mocks + prometheus + grafana)
# docker-down Tear down the Docker stack
# smoke-test Run curl-based smoke tests against PROXY_URL (default: localhost:8080)
# docker-test Full Docker pipeline: build → up → smoke-test → verify shadow → down
# load-test Run Gatling simulation (proxy must already be running)
# clean Remove build artefacts
# =============================================================================
.DEFAULT_GOAL := help
PROXY_URL ?= http://localhost:8080
.PHONY: help setup build test run \
docker-build docker-up docker-down \
smoke-test docker-test load-test clean
help: ## Show this help
@echo ""
@echo "OpenCoroutineProxy — available targets"
@echo "──────────────────────────────────────"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-16s\033[0m %s\n", $$1, $$2}'
@echo ""
# ── Local development ─────────────────────────────────────────────────────────
setup: ## First-time setup: generate Gradle wrapper and prefetch deps
@bash setup.sh
build: ## Compile and produce the fat JAR in build/libs/
./gradlew bootJar --no-daemon
test: ## Run all unit + integration tests (WireMock, MockK)
./gradlew test --no-daemon
run: ## Start the proxy on localhost:8080 (reads application.yml)
./gradlew bootRun --no-daemon
clean: ## Remove Gradle build outputs
./gradlew clean --no-daemon
# ── Docker ────────────────────────────────────────────────────────────────────
docker-build: ## Build the Docker image (multi-stage, JRE 21 runtime)
docker compose build proxy
docker-up: docker-build ## Build + start proxy, mocks, Prometheus, Grafana
docker compose up -d
@echo ""
@echo "Services:"
@echo " Proxy → http://localhost:8080"
@echo " Primary → http://localhost:8081 (WireMock admin: /8081/__admin)"
@echo " Shadow → http://localhost:8082 (WireMock admin: /8082/__admin)"
@echo " Prometheus→ http://localhost:9090"
@echo " Grafana → http://localhost:3000 (admin / admin)"
@echo ""
docker-down: ## Tear down all Docker services and networks
docker compose down --remove-orphans
# ── Testing ───────────────────────────────────────────────────────────────────
smoke-test: ## Run curl smoke tests against PROXY_URL (default: http://localhost:8080)
PROXY_URL=$(PROXY_URL) bash scripts/smoke-test.sh
docker-test: ## End-to-end: build Docker image → start stack → smoke-test → verify shadow → teardown
bash scripts/docker-test.sh
load-test: ## Run Gatling simulation against PROXY_URL (proxy must be running)
cd load-tests && ../gradlew gatlingRun \
-DbaseUrl=$(PROXY_URL) \
-DtargetRps=200 \
--no-daemon
@echo "Gatling report: load-tests/build/reports/gatling/"