115 lines
2.8 KiB
Makefile
115 lines
2.8 KiB
Makefile
|
|
.PHONY: all build release run test test-integration bench clean docker-build docker-shell docker-run docker-test fmt help
|
||
|
|
|
||
|
|
# Default target
|
||
|
|
all: build
|
||
|
|
|
||
|
|
# === Build Targets ===
|
||
|
|
build:
|
||
|
|
zig build
|
||
|
|
|
||
|
|
release:
|
||
|
|
zig build -Doptimize=ReleaseFast
|
||
|
|
|
||
|
|
clean:
|
||
|
|
rm -rf zig-out .zig-cache data
|
||
|
|
|
||
|
|
fmt:
|
||
|
|
zig fmt src/ tests/
|
||
|
|
|
||
|
|
# === Run Targets ===
|
||
|
|
run: build
|
||
|
|
zig build run
|
||
|
|
|
||
|
|
run-port: build
|
||
|
|
zig build run -- --port $(PORT)
|
||
|
|
|
||
|
|
# === Test Targets ===
|
||
|
|
test:
|
||
|
|
zig build test
|
||
|
|
|
||
|
|
test-integration:
|
||
|
|
zig build test-integration
|
||
|
|
|
||
|
|
test-all: test test-integration
|
||
|
|
|
||
|
|
bench:
|
||
|
|
zig build bench
|
||
|
|
|
||
|
|
# === Docker Targets ===
|
||
|
|
docker-build:
|
||
|
|
docker-compose build dev
|
||
|
|
|
||
|
|
docker-shell:
|
||
|
|
docker-compose run --rm dev
|
||
|
|
|
||
|
|
docker-run:
|
||
|
|
docker-compose up server
|
||
|
|
|
||
|
|
docker-test:
|
||
|
|
docker-compose run --rm dev zig build test
|
||
|
|
|
||
|
|
docker-bench:
|
||
|
|
docker-compose run --rm dev zig build bench
|
||
|
|
|
||
|
|
docker-clean:
|
||
|
|
docker-compose down -v
|
||
|
|
docker rmi dynamodb-zig-dev 2>/dev/null || true
|
||
|
|
|
||
|
|
# === AWS CLI Test ===
|
||
|
|
aws-test:
|
||
|
|
@echo "Creating table..."
|
||
|
|
aws dynamodb create-table \
|
||
|
|
--endpoint-url http://localhost:8000 \
|
||
|
|
--table-name TestTable \
|
||
|
|
--key-schema AttributeName=pk,KeyType=HASH \
|
||
|
|
--attribute-definitions AttributeName=pk,AttributeType=S \
|
||
|
|
--billing-mode PAY_PER_REQUEST || true
|
||
|
|
@echo "\nListing tables..."
|
||
|
|
aws dynamodb list-tables --endpoint-url http://localhost:8000
|
||
|
|
@echo "\nPutting item..."
|
||
|
|
aws dynamodb put-item \
|
||
|
|
--endpoint-url http://localhost:8000 \
|
||
|
|
--table-name TestTable \
|
||
|
|
--item '{"pk":{"S":"test1"},"data":{"S":"hello world"}}'
|
||
|
|
@echo "\nGetting item..."
|
||
|
|
aws dynamodb get-item \
|
||
|
|
--endpoint-url http://localhost:8000 \
|
||
|
|
--table-name TestTable \
|
||
|
|
--key '{"pk":{"S":"test1"}}'
|
||
|
|
@echo "\nScanning table..."
|
||
|
|
aws dynamodb scan \
|
||
|
|
--endpoint-url http://localhost:8000 \
|
||
|
|
--table-name TestTable
|
||
|
|
|
||
|
|
# === Local DynamoDB (for comparison) ===
|
||
|
|
dynamodb-local:
|
||
|
|
docker-compose up dynamodb-local
|
||
|
|
|
||
|
|
# === Help ===
|
||
|
|
help:
|
||
|
|
@echo "ZynamoDB Development Commands"
|
||
|
|
@echo ""
|
||
|
|
@echo "Build & Run:"
|
||
|
|
@echo " make build - Build debug version"
|
||
|
|
@echo " make release - Build optimized release"
|
||
|
|
@echo " make run - Build and run server"
|
||
|
|
@echo " make run-port PORT=8080 - Run on custom port"
|
||
|
|
@echo ""
|
||
|
|
@echo "Testing:"
|
||
|
|
@echo " make test - Run unit tests"
|
||
|
|
@echo " make test-integration - Run integration tests"
|
||
|
|
@echo " make test-all - Run all tests"
|
||
|
|
@echo " make bench - Run benchmarks"
|
||
|
|
@echo ""
|
||
|
|
@echo "Docker:"
|
||
|
|
@echo " make docker-build - Build Docker image"
|
||
|
|
@echo " make docker-shell - Open shell in container"
|
||
|
|
@echo " make docker-run - Run server in Docker"
|
||
|
|
@echo " make docker-test - Run tests in Docker"
|
||
|
|
@echo ""
|
||
|
|
@echo "Utilities:"
|
||
|
|
@echo " make clean - Remove build artifacts"
|
||
|
|
@echo " make fmt - Format source code"
|
||
|
|
@echo " make aws-test - Test with AWS CLI"
|
||
|
|
@echo " make help - Show this help"
|