working on fixing dialing issue with http library
CI / Detect changed paths (pull_request) Successful in 4s
CI / Odin unit tests and build (pull_request) Successful in 1m16s
CI / API unit tests and lint (pull_request) Failing after 1m12s
CI / Infra unit tests, vet, and preview (pull_request) Successful in 51s

This commit is contained in:
2026-09-13 13:26:27 -06:00
parent de842fdc2d
commit c6bfb966b7
5 changed files with 172 additions and 57 deletions
+20 -8
View File
@@ -16,13 +16,25 @@ RESOURCE_DIR := $(CURDIR)/resources/dev
GUI_ENV_FILE ?= $(RESOURCE_DIR)/gui.env.example
API_ENV_FILE ?= $(RESOURCE_DIR)/api.env.example
API_DESI_DATA ?= $(RESOURCE_DIR)/desi_subset.json
# The API binds here for local dev (see api/src/config.rs); `make run` passes
# it through and waits for $(API_HEALTH_URL) to respond before launching the
# GUI, so the renderer never races the API on startup. A bind host of
# 0.0.0.0 is probed via 127.0.0.1. Adjust API_WAIT_TIMEOUT (seconds) if the
# API takes longer than 60s to become healthy on a given machine.
# The API binds here for local dev (see api/src/config.rs); `make run` waits
# for $(API_HEALTH_URL) to respond before launching the GUI, so the renderer
# never races the API on startup. A bind host of 0.0.0.0 is probed via
# 127.0.0.1. Adjust API_WAIT_TIMEOUT (seconds) if the API takes longer than
# 60s to become healthy on a given machine.
#
# API_BIND_ADDR is only forwarded to the API when the user sets it explicitly
# (command line / environment). When it is left unset, the API reads it from
# $(API_ENV_FILE) (dotenvy applies env-file values that aren't already in the
# process environment), so the Makefile must not inject its own default here
# or it would shadow the env file. The effective bind address is read back
# from $(API_ENV_FILE) so the health check always polls the right port.
API_BIND_ADDR ?= 127.0.0.1:8080
API_HEALTH_URL := http://$(subst 0.0.0.0,127.0.0.1,$(API_BIND_ADDR))/health
API_BIND_EXPLICIT := $(filter command line environment,$(origin API_BIND_ADDR))
API_BIND_FROM_FILE := $(if $(API_BIND_EXPLICIT),,$(shell \
grep -E '^[[:space:]]*API_BIND_ADDR[[:space:]]*=' '$(API_ENV_FILE)' 2>/dev/null | \
tail -n 1 | sed 's/^[[:space:]]*API_BIND_ADDR[[:space:]]*=[[:space:]]*//; s/[[:space:]]*#.*$$//'))
API_BIND_EFFECTIVE := $(if $(API_BIND_EXPLICIT),$(API_BIND_ADDR),$(or $(API_BIND_FROM_FILE),$(API_BIND_ADDR)))
API_HEALTH_URL := http://$(subst 0.0.0.0,127.0.0.1,$(API_BIND_EFFECTIVE))/health
API_WAIT_TIMEOUT ?= 60
.PHONY: help setup run run-web build build-debug build-web test clean fmt \
@@ -48,7 +60,7 @@ setup: ## Setup all sub-projects (submodules, gui deps, api deps, infra deps)
## ---- Renderer (Odin) -----------------------------------------------------
run: ## Run the native app (gui/); waits for the API to be healthy first
@API_ENV_FILE="$(API_ENV_FILE)" API_DESI_DATA="$(API_DESI_DATA)" API_BIND_ADDR="$(API_BIND_ADDR)" $(MAKE) -C $(API) run & api_pid=$$!; \
@API_ENV_FILE="$(API_ENV_FILE)" API_DESI_DATA="$(API_DESI_DATA)" $(if $(API_BIND_EXPLICIT),API_BIND_ADDR="$(API_BIND_ADDR)",) $(MAKE) -C $(API) run & api_pid=$$!; \
trap 'kill $$api_pid 2>/dev/null' INT TERM EXIT; \
$(MAKE) api-wait || { kill $$api_pid 2>/dev/null; exit 1; }; \
GUI_ENV_FILE="$(GUI_ENV_FILE)" $(MAKE) -C $(GUI) run; \
@@ -66,7 +78,7 @@ build-web: ## WebAssembly build -> build/web (gui/, needs emscripten)
@$(MAKE) -C $(GUI) build-web
run-web: ## Start WASM build + API server for web dev (waits for API health)
@API_ENV_FILE="$(API_ENV_FILE)" API_DESI_DATA="$(API_DESI_DATA)" API_BIND_ADDR="$(API_BIND_ADDR)" $(MAKE) -C $(API) run & api_pid=$$!; \
@API_ENV_FILE="$(API_ENV_FILE)" API_DESI_DATA="$(API_DESI_DATA)" $(if $(API_BIND_EXPLICIT),API_BIND_ADDR="$(API_BIND_ADDR)",) $(MAKE) -C $(API) run & api_pid=$$!; \
trap 'kill $$api_pid 2>/dev/null' INT TERM EXIT; \
$(MAKE) api-wait || { kill $$api_pid 2>/dev/null; exit 1; }; \
GUI_ENV_FILE="$(GUI_ENV_FILE)" $(MAKE) -C $(GUI) build-web; \