Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
166 lines (120 loc) · 5.54 KB
/
Copy pathMakefile
File metadata and controls
166 lines (120 loc) · 5.54 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
SHELL := /bin/sh
.DEFAULT_GOAL := help
CARGO ?= cargo
BUN ?= bun
DOCKER_COMPOSE ?= docker compose
FRONTEND_DIR := frontend-panel
DOCS_DIR := docs
FILTER ?=
TEST ?=
BACKEND ?=
TEST_ARGS ?=
E2E_ARGS ?=
RUN_ARGS ?=
TEST_ENV = $(if $(strip $(BACKEND)),ASTER_TEST_DATABASE_BACKEND=$(BACKEND),)
.PHONY: \
help setup setup-all backend-deps frontend-deps docs-deps \
dev dev-backend dev-frontend run \
build build-backend build-frontend build-release \
check check-backend check-frontend typecheck \
format format-check clippy \
test test-backend test-frontend test-lib test-integration test-e2e \
coverage coverage-backend coverage-frontend \
openapi openapi-check \
docs-dev docs-build docs-preview \
docker-build docker-up docker-down docker-logs \
ci
help: ## Show available targets
@awk 'BEGIN {FS = ":.*## "; printf "Usage: make <target> [VARIABLE=value]\n\nTargets:\n"} /^[a-zA-Z0-9_-]+:.*## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@printf '\nExamples:\n'
@printf ' make test-lib FILTER=services::auth\n'
@printf ' make test-integration TEST=test_auth FILTER=test_login\n'
@printf ' make test-integration TEST=test_database_backends BACKEND=postgres\n'
setup: backend-deps frontend-deps ## Fetch backend and frontend dependencies
setup-all: setup docs-deps ## Fetch all dependencies, including documentation
backend-deps: ## Fetch Rust dependencies
$(CARGO) fetch
frontend-deps: ## Install frontend dependencies from the lockfile
cd $(FRONTEND_DIR) && $(BUN) install --frozen-lockfile
docs-deps: ## Install documentation dependencies from the lockfile
cd $(DOCS_DIR) && $(BUN) install --frozen-lockfile
dev: ## Run backend and frontend development servers
@set -eu; \
$(CARGO) run & backend_pid=$$!; \
(cd $(FRONTEND_DIR) && $(BUN) run dev) & frontend_pid=$$!; \
trap 'kill $$backend_pid $$frontend_pid 2>/dev/null || true' INT TERM EXIT; \
wait
dev-backend: ## Run the backend development server
$(CARGO) run
dev-frontend: ## Run the frontend development server
cd $(FRONTEND_DIR) && $(BUN) run dev
run: build-frontend ## Build the embedded frontend and run AsterDrive
$(CARGO) run -- $(RUN_ARGS)
build: build-frontend build-backend ## Build frontend and backend debug artifacts
build-backend: ## Build the backend
$(CARGO) build
build-frontend: ## Type-check and build the frontend
cd $(FRONTEND_DIR) && $(BUN) run build
build-release: build-frontend ## Build the frontend and optimized backend binary
$(CARGO) build --release
check: check-backend check-frontend ## Run standard backend and frontend checks
check-backend: format-check ## Check backend compilation and Rust formatting
$(CARGO) check
check-frontend: ## Run frontend type checking and Biome checks
cd $(FRONTEND_DIR) && $(BUN) run check
typecheck: ## Run frontend TypeScript checks
cd $(FRONTEND_DIR) && $(BUN) run typecheck
format: ## Format Rust and frontend sources
$(CARGO) fmt --all
cd $(FRONTEND_DIR) && $(BUN) run format
format-check: ## Verify Rust formatting
$(CARGO) fmt --all -- --check
clippy: ## Run Clippy with the same strict settings as CI
$(CARGO) clippy --workspace --all-targets --all-features -- -D warnings
test: test-backend test-frontend ## Run the complete backend and frontend test suites
test-backend: ## Run all Rust workspace tests
$(TEST_ENV) $(CARGO) test --workspace --no-fail-fast $(TEST_ARGS)
test-frontend: ## Run frontend unit tests
cd $(FRONTEND_DIR) && $(BUN) run test
test-lib: ## Run a targeted Rust library test (requires FILTER)
@test -n "$(strip $(FILTER))" || { echo "FILTER is required, for example: make test-lib FILTER=services::auth"; exit 2; }
$(TEST_ENV) $(CARGO) test --lib $(FILTER) $(TEST_ARGS)
test-integration: ## Run a targeted integration test (requires TEST; optional FILTER/BACKEND)
@test -n "$(strip $(TEST))" || { echo "TEST is required, for example: make test-integration TEST=test_auth"; exit 2; }
$(TEST_ENV) $(CARGO) test --test $(TEST) $(FILTER) $(TEST_ARGS)
test-e2e: ## Run Playwright end-to-end tests (use E2E_ARGS for extra arguments)
cd $(FRONTEND_DIR) && $(BUN) run test:e2e -- $(E2E_ARGS)
coverage: coverage-backend coverage-frontend ## Generate backend and frontend coverage reports
coverage-backend: ## Generate Rust LCOV and HTML coverage reports
mkdir -p coverage/rust
$(CARGO) llvm-cov --workspace --no-fail-fast --lcov --output-path coverage/rust/lcov.info
$(CARGO) llvm-cov report --html --output-dir coverage/rust/html
coverage-frontend: ## Generate frontend coverage reports
cd $(FRONTEND_DIR) && $(BUN) run test:coverage
openapi: ## Regenerate the OpenAPI document and TypeScript SDK
$(CARGO) test --features openapi --test generate_openapi
cd $(FRONTEND_DIR) && $(BUN) run generate-api
openapi-check: openapi ## Verify generated OpenAPI and SDK files have no drift
git diff --exit-code -- \
$(FRONTEND_DIR)/generated/openapi.json \
$(FRONTEND_DIR)/src/services/api.generated.ts
docs-dev: ## Run the documentation development server
cd $(DOCS_DIR) && $(BUN) run docs:dev
docs-build: ## Build the documentation site
cd $(DOCS_DIR) && $(BUN) run docs:build
docs-preview: ## Preview the built documentation site
cd $(DOCS_DIR) && $(BUN) run docs:preview
docker-build: ## Build the local Docker image
$(DOCKER_COMPOSE) build
docker-up: ## Start the Docker Compose services
$(DOCKER_COMPOSE) up -d
docker-down: ## Stop the Docker Compose services
$(DOCKER_COMPOSE) down
docker-logs: ## Follow AsterDrive Docker Compose logs
$(DOCKER_COMPOSE) logs -f asterdrive
ci: ## Run the main local CI verification bundle
$(MAKE) check
$(MAKE) clippy
$(MAKE) test
$(MAKE) openapi-check
$(MAKE) build-frontend