mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-11 07:36:53 +00:00
Add: rust installation in Makefile (#1188)
Signed-off-by: Ali Mehraji <a.mehraji75@gmail.com> Signed-off-by: houseme <housemecn@gmail.com> Co-authored-by: houseme <housemecn@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -9,30 +9,53 @@ CONTAINER_NAME ?= rustfs-dev
|
|||||||
DOCKERFILE_PRODUCTION = Dockerfile
|
DOCKERFILE_PRODUCTION = Dockerfile
|
||||||
DOCKERFILE_SOURCE = Dockerfile.source
|
DOCKERFILE_SOURCE = Dockerfile.source
|
||||||
|
|
||||||
|
# Fatal check
|
||||||
|
# Checks all required dependencies and exits with error if not found
|
||||||
|
# (e.g., cargo, rustfmt)
|
||||||
|
check-%:
|
||||||
|
@command -v $* >/dev/null 2>&1 || { \
|
||||||
|
echo >&2 "❌ '$*' is not installed."; \
|
||||||
|
exit 1; \
|
||||||
|
}
|
||||||
|
|
||||||
|
# Warning-only check
|
||||||
|
# Checks for optional dependencies and issues a warning if not found
|
||||||
|
# (e.g., cargo-nextest for enhanced testing)
|
||||||
|
warn-%:
|
||||||
|
@command -v $* >/dev/null 2>&1 || { \
|
||||||
|
echo >&2 "⚠️ '$*' is not installed."; \
|
||||||
|
}
|
||||||
|
|
||||||
|
# For checking dependencies use check-<dep-name> or warn-<dep-name>
|
||||||
|
.PHONY: core-deps fmt-deps test-deps
|
||||||
|
core-deps: check-cargo
|
||||||
|
fmt-deps: check-rustfmt
|
||||||
|
test-deps: warn-cargo-nextest
|
||||||
|
|
||||||
# Code quality and formatting targets
|
# Code quality and formatting targets
|
||||||
.PHONY: fmt
|
.PHONY: fmt
|
||||||
fmt:
|
fmt: core-deps fmt-deps
|
||||||
@echo "🔧 Formatting code..."
|
@echo "🔧 Formatting code..."
|
||||||
cargo fmt --all
|
cargo fmt --all
|
||||||
|
|
||||||
.PHONY: fmt-check
|
.PHONY: fmt-check
|
||||||
fmt-check:
|
fmt-check: core-deps fmt-deps
|
||||||
@echo "📝 Checking code formatting..."
|
@echo "📝 Checking code formatting..."
|
||||||
cargo fmt --all --check
|
cargo fmt --all --check
|
||||||
|
|
||||||
.PHONY: clippy
|
.PHONY: clippy
|
||||||
clippy:
|
clippy: core-deps
|
||||||
@echo "🔍 Running clippy checks..."
|
@echo "🔍 Running clippy checks..."
|
||||||
cargo clippy --fix --allow-dirty
|
cargo clippy --fix --allow-dirty
|
||||||
cargo clippy --all-targets --all-features -- -D warnings
|
cargo clippy --all-targets --all-features -- -D warnings
|
||||||
|
|
||||||
.PHONY: check
|
.PHONY: check
|
||||||
check:
|
check: core-deps
|
||||||
@echo "🔨 Running compilation check..."
|
@echo "🔨 Running compilation check..."
|
||||||
cargo check --all-targets
|
cargo check --all-targets
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test: core-deps test-deps
|
||||||
@echo "🧪 Running tests..."
|
@echo "🧪 Running tests..."
|
||||||
@if command -v cargo-nextest >/dev/null 2>&1; then \
|
@if command -v cargo-nextest >/dev/null 2>&1; then \
|
||||||
cargo nextest run --all --exclude e2e_test; \
|
cargo nextest run --all --exclude e2e_test; \
|
||||||
@@ -42,16 +65,16 @@ test:
|
|||||||
fi
|
fi
|
||||||
cargo test --all --doc
|
cargo test --all --doc
|
||||||
|
|
||||||
.PHONY: pre-commit
|
|
||||||
pre-commit: fmt clippy check test
|
|
||||||
@echo "✅ All pre-commit checks passed!"
|
|
||||||
|
|
||||||
.PHONY: setup-hooks
|
.PHONY: setup-hooks
|
||||||
setup-hooks:
|
setup-hooks:
|
||||||
@echo "🔧 Setting up git hooks..."
|
@echo "🔧 Setting up git hooks..."
|
||||||
chmod +x .git/hooks/pre-commit
|
chmod +x .git/hooks/pre-commit
|
||||||
@echo "✅ Git hooks setup complete!"
|
@echo "✅ Git hooks setup complete!"
|
||||||
|
|
||||||
|
.PHONY: pre-commit
|
||||||
|
pre-commit: fmt clippy check test
|
||||||
|
@echo "✅ All pre-commit checks passed!"
|
||||||
|
|
||||||
.PHONY: e2e-server
|
.PHONY: e2e-server
|
||||||
e2e-server:
|
e2e-server:
|
||||||
sh $(shell pwd)/scripts/run.sh
|
sh $(shell pwd)/scripts/run.sh
|
||||||
@@ -186,8 +209,6 @@ docker-dev-push:
|
|||||||
--push \
|
--push \
|
||||||
.
|
.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Local production builds using direct buildx (alternative to docker-buildx.sh)
|
# Local production builds using direct buildx (alternative to docker-buildx.sh)
|
||||||
.PHONY: docker-buildx-production-local
|
.PHONY: docker-buildx-production-local
|
||||||
docker-buildx-production-local:
|
docker-buildx-production-local:
|
||||||
@@ -247,8 +268,6 @@ dev-env-stop:
|
|||||||
.PHONY: dev-env-restart
|
.PHONY: dev-env-restart
|
||||||
dev-env-restart: dev-env-stop dev-env-start
|
dev-env-restart: dev-env-stop dev-env-start
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ========================================================================================
|
# ========================================================================================
|
||||||
# Build Utilities
|
# Build Utilities
|
||||||
# ========================================================================================
|
# ========================================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user