Files
Heimdall/Makefile
T
Arnaud Dartois ad36d1d098 feat(release): GitVersion double central/agent + release notes auto + sécurité CI (Fixes #98 #99 #102, Refs #95 #96 #97 #103)
- GitVersion.yml (central, tags v*) + GitVersion.Agent.yml (agent, tags agent-v*)
- release.yml : 2 jobs — tag v* → release central, tag agent-v* → release agent (binaires natifs + image)
- ci.yml : gitversion-enabled, trivy-enabled, dependency-check-enabled (templates bloquants)
- Dockerfiles : ARG VERSION + -p:Version= (injection assembly)
- Endpoint GET /api/version (HealthController) + version agent depuis l'assembly (plus de hardcode)
- Makefile : targets version / version-tag / version-tag-agent
- Template PR + .gitignore corrigé (configs GitVersion commitables)
2026-08-12 11:39:20 +02:00

86 lines
4.3 KiB
Makefile

# ─── Heimdall — Development & Deployment ──────────────────────────
.DEFAULT_GOAL := help
.PHONY: help build test docker-up docker-down docker-build clean dev
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
build: ## Build the .NET solution
dotnet build
test: ## Run all tests
dotnet test
test-watch: ## Run tests in watch mode
dotnet watch test --project tests/Heimdall.Domain.Tests
clean: ## Clean build artifacts
dotnet clean && rm -rf src/**/bin src/**/obj tests/**/bin tests/**/obj
# ─── Docker ──────────────────────────────────────────────────────
docker-up: ## Start all services (dev)
docker compose -f docker/docker-compose.yml -f docker/docker-compose.override.yml up -d
docker-down: ## Stop all services
docker compose -f docker/docker-compose.yml down -v
docker-build: ## Rebuild images without cache
docker compose -f docker/docker-compose.yml build --no-cache
docker-logs: ## Tail logs
docker compose -f docker/docker-compose.yml logs -f
docker-ps: ## List running services
docker compose -f docker/docker-compose.yml ps
docker-reset: ## Stop and remove everything
docker compose -f docker/docker-compose.yml down -v --rmi all
# ─── Deployment ──────────────────────────────────────────────────
deploy: docker-build docker-up ## Build and deploy
# ─── Versioning / Release (GitVersion) ──────────────────────────
version: ## Show GitVersion versions (central + agent)
@export PATH="$$PATH:$$HOME/.dotnet/tools"; \
if ! command -v dotnet-gitversion >/dev/null 2>&1; then dotnet tool install --global GitVersion.Tool --version 6.8.1 >/dev/null; fi; \
echo "Central (GitVersion.yml):"; \
dotnet-gitversion -config GitVersion.yml -output json 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(' SemVer:', d['SemVer'], '| MajorMinorPatch:', d['MajorMinorPatch'])" 2>/dev/null || echo " (erreur — pas de tag v* ?)"; \
echo "Agent (GitVersion.Agent.yml):"; \
dotnet-gitversion -config GitVersion.Agent.yml -output json 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(' SemVer:', d['SemVer'], '| MajorMinorPatch:', d['MajorMinorPatch'])" 2>/dev/null || echo " (erreur — pas de tag agent-v* ? bug GitVersion tag-prefix)"
version-tag: ## Tag la version courante (usage: make version-tag TAG=v1.0.0)
@test -n "$(TAG)" || (echo "Usage: make version-tag TAG=v1.0.0"; exit 1); \
git tag "$(TAG)" && git push origin "$(TAG)"
version-tag-agent: ## Tag la version agent (usage: make version-tag-agent TAG=agent-v1.0.0)
@test -n "$(TAG)" || (echo "Usage: make version-tag-agent TAG=agent-v1.0.0"; exit 1); \
git tag "$(TAG)" && git push origin "$(TAG)"
# ─── Database ────────────────────────────────────────────────────
migration-add: ## Add a new EF migration (usage: make migration-add NAME=xxx)
dotnet ef migrations add $(NAME) -p src/Heimdall.Infrastructure
migration-remove: ## Remove last migration
dotnet ef migrations remove -p src/Heimdall.Infrastructure
# ─── Dev helpers ─────────────────────────────────────────────────
dev-api: ## Run combined API+Web in development mode (API and Blazor UI in one process)
DATABASE_URL="Host=localhost;Port=5432;Database=heimdall;Username=heimdall;Password=heimdall" \
JWT__Key="ThisIsADevKeyThatIsAtLeast32BytesLong!!" \
ASPNETCORE_ENVIRONMENT=Development \
Cors__AllowedOrigins="*" \
dotnet run --project src/Heimdall.Web
dev-web: ## Run combined API+Web+Jobs in development mode (single process)
DATABASE_URL="Host=localhost;Port=5432;Database=heimdall;Username=heimdall;Password=heimdall" \
JWT__Key="ThisIsADevKeyThatIsAtLeast32BytesLong!!" \
ASPNETCORE_ENVIRONMENT=Development \
Cors__AllowedOrigins="*" \
dotnet run --project src/Heimdall.Web