Add a root Makefile (lint/build/unit/smoke/ci) as the single source of truth for the checks, and have each Gitea Actions job call the matching make target so local and CI cannot drift. `make ci` runs the full pipeline locally — the interim gate while no runner is registered. The smoke target auto-points DOCKER_HOST at the rootless Podman socket when present (and DOCKER_HOST is unset), leaving Docker/CI hosts alone. Document `make ci` and the Podman prerequisites in docs/runbooks/ci.md. Verified: `make ci` is green locally (lint, build, unit, container smoke). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
51 lines
1.6 KiB
Makefile
51 lines
1.6 KiB
Makefile
# Developer + CI entrypoints.
|
|
#
|
|
# These targets are the single source of truth for the checks. The Gitea
|
|
# Actions workflow (.gitea/workflows/ci.yaml) invokes the SAME targets, so
|
|
# `make ci` locally runs exactly what the pipeline runs — no drift. Until a
|
|
# self-hosted runner is registered, `make ci` is the gate (see docs/runbooks/ci.md).
|
|
|
|
SLN := services/bff/Bff.slnx
|
|
COMPOSE := infra/docker-compose.yml
|
|
HEALTH_URL := http://localhost:8080/health
|
|
|
|
# On a rootless Podman dev box, point Docker CLI/Compose at the Podman socket —
|
|
# but only if that socket exists and DOCKER_HOST isn't already set, so real
|
|
# Docker hosts and CI runners are left untouched.
|
|
PODMAN_SOCK := /run/user/$(shell id -u)/podman/podman.sock
|
|
ifeq ($(wildcard $(PODMAN_SOCK)),$(PODMAN_SOCK))
|
|
ifeq ($(origin DOCKER_HOST),undefined)
|
|
export DOCKER_HOST := unix://$(PODMAN_SOCK)
|
|
endif
|
|
endif
|
|
|
|
.PHONY: ci lint build unit smoke down help
|
|
|
|
## ci: run the full pipeline — lint, build, unit, smoke (mirrors Gitea Actions)
|
|
ci: lint build unit smoke
|
|
|
|
## lint: verify formatting (no changes)
|
|
lint:
|
|
dotnet format $(SLN) --verify-no-changes
|
|
|
|
## build: release build
|
|
build:
|
|
dotnet build $(SLN) -c Release
|
|
|
|
## unit: run unit tests
|
|
unit:
|
|
dotnet test $(SLN) -c Release
|
|
|
|
## smoke: compose up (wait for healthy), curl /health, then tear down
|
|
smoke:
|
|
docker compose -f $(COMPOSE) up -d --build --wait
|
|
bash -c 'curl -fsS $(HEALTH_URL); rc=$$?; docker compose -f $(COMPOSE) down --volumes; exit $$rc'
|
|
|
|
## down: stop and remove the local stack
|
|
down:
|
|
docker compose -f $(COMPOSE) down --volumes
|
|
|
|
## help: list available targets
|
|
help:
|
|
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/^## //'
|