feat(workflow): release tool, make deploy and make verify per AGENTS.md
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+27
-1
@@ -74,7 +74,7 @@ EXAMPLE_INC = -I$(EXAMPLE_DIR) -I$(EXAMPLE_BUILD) -Isrc
|
||||
EXAMPLE_REAL_LIBS = build/google/libgoogle.a build/clients/libclients.a \
|
||||
build/liboperability.a
|
||||
|
||||
.PHONY: example example-real-libs example-assets example-test example-clean example-locust
|
||||
.PHONY: example-deploy example-verify deploy verify example example-real-libs example-assets example-test example-clean example-locust
|
||||
|
||||
# Asset embedding is part of the build: example/assets (Chart.js included)
|
||||
# becomes generated C++ under build/example/gen via the MoloApp embedder.
|
||||
@@ -134,6 +134,32 @@ example-locust:
|
||||
example-clean:
|
||||
rm -rf $(EXAMPLE_BUILD)
|
||||
|
||||
# Deploy: loopback single binary (AGENTS.md "Deploy"). Restarts the server from
|
||||
# build/ with a pid file; fails if it is not healthy within 15 s. Runs from
|
||||
# the repo root so .env.json(.local) and example/static resolve.
|
||||
EXAMPLE_PORT ?= 8080
|
||||
EXAMPLE_RUN = $(EXAMPLE_BUILD)/run
|
||||
|
||||
example-deploy: example
|
||||
mkdir -p $(EXAMPLE_RUN)
|
||||
if [ -f $(EXAMPLE_RUN)/server.pid ] && kill -0 `cat $(EXAMPLE_RUN)/server.pid` 2>/dev/null; then \
|
||||
kill `cat $(EXAMPLE_RUN)/server.pid`; \
|
||||
for i in 1 2 3 4 5 6 7 8 9 10; do kill -0 `cat $(EXAMPLE_RUN)/server.pid` 2>/dev/null || break; sleep 0.5; done; \
|
||||
fi
|
||||
setsid nohup $(EXAMPLE_BUILD)/living-server $(EXAMPLE_PORT) --no-locust \
|
||||
> $(EXAMPLE_RUN)/server.log 2>&1 < /dev/null & echo $$! > $(EXAMPLE_RUN)/server.pid
|
||||
ok=0; for i in `seq 1 30`; do \
|
||||
if curl -fsS http://127.0.0.1:$(EXAMPLE_PORT)/health > /dev/null 2>&1; then ok=1; break; fi; sleep 0.5; \
|
||||
done; \
|
||||
if [ $$ok -ne 1 ]; then echo "deploy: server not healthy in 15 s"; cat $(EXAMPLE_RUN)/server.log; exit 1; fi; \
|
||||
echo "deployed: http://127.0.0.1:$(EXAMPLE_PORT) pid `cat $(EXAMPLE_RUN)/server.pid`"
|
||||
|
||||
example-verify:
|
||||
python3 -I tools/verify_deploy.py http://127.0.0.1:$(EXAMPLE_PORT)
|
||||
|
||||
deploy: example-deploy
|
||||
verify: example-verify
|
||||
|
||||
# Root Makefile aggregation points (double-colon: safe with other parts).
|
||||
all:: example
|
||||
test:: example-test
|
||||
|
||||
Reference in New Issue
Block a user