[router] enable sccache in ci and local build (#10099)

This commit is contained in:
Simo Lin
2025-09-12 12:43:48 -04:00
committed by GitHub
parent 4634fd5953
commit 8c86595c93
5 changed files with 194 additions and 29 deletions

View File

@@ -1,6 +1,15 @@
# SGLang Router Makefile
# Provides convenient shortcuts for common development tasks
# Check if sccache is available and set RUSTC_WRAPPER accordingly
SCCACHE := $(shell which sccache 2>/dev/null)
ifdef SCCACHE
export RUSTC_WRAPPER := $(SCCACHE)
$(info Using sccache for compilation caching)
else
$(info sccache not found. Install it for faster builds: cargo install sccache)
endif
.PHONY: help bench bench-quick bench-baseline bench-compare test build clean
help: ## Show this help message
@@ -90,3 +99,33 @@ perf-monitor: ## Run continuous performance monitoring
else \
echo "Warning: 'watch' command not found. Install it or run 'make bench-quick' manually."; \
fi
# sccache management targets
setup-sccache: ## Install and configure sccache
@echo "Setting up sccache..."
@./scripts/setup-sccache.sh
sccache-stats: ## Show sccache statistics
@if [ -n "$(SCCACHE)" ]; then \
echo "sccache statistics:"; \
sccache -s; \
else \
echo "sccache not installed. Run 'make setup-sccache' to install it."; \
fi
sccache-clean: ## Clear sccache cache
@if [ -n "$(SCCACHE)" ]; then \
echo "Clearing sccache cache..."; \
sccache -C; \
echo "sccache cache cleared"; \
else \
echo "sccache not installed"; \
fi
sccache-stop: ## Stop the sccache server
@if [ -n "$(SCCACHE)" ]; then \
echo "Stopping sccache server..."; \
sccache --stop-server || true; \
else \
echo "sccache not installed"; \
fi