.PHONY: build run test e2e fmt lint clean dev check all local\:me local\:get release\:build dev-build
LOCAL_API_URL := http://0.0.0.0:8000/api/v1
DEV_TOKEN_FILE := dev_token
DEV_TOKEN := $(shell cat $(DEV_TOKEN_FILE) 2>/dev/null)
define api_get
@if [ -z "$(DEV_TOKEN)" ]; then \
echo "Error: dev_token file not found or empty. See README.md for setup."; \
exit 1; \
fi
@curl -s -H "Authorization: Bearer $(DEV_TOKEN)" \
-H "Accept: application/json" \
"$(LOCAL_API_URL)$(1)" | jq
endef
local\:me:
$(call api_get,/user)
local\:get:
$(call api_get,$(ENDPOINT))
build:
cargo build
release:
cargo build --release
run:
cargo run
test:
cargo test
e2e:
cargo test --test e2e -- --ignored --nocapture
fmt:
cargo fmt
fmt-check:
cargo fmt -- --check
lint:
cargo clippy
fix:
cargo clippy --fix --allow-dirty --allow-staged
clean:
cargo clean
dev:
cargo watch -c -x run
dev-test:
cargo watch -c -x test
check: fmt-check lint test
all: fmt lint test build
dev-build:
docker run --rm -v .:/src -w /src rust:1.83-alpine sh -c "apk add musl-dev && cargo build"
cp target/debug/luxctl luxctl_dev
release\:build:
ifndef VERSION
$(error VERSION is required. Usage: make release:build VERSION=0.2.0)
endif
./scripts/release.sh $(VERSION)