SHELL := bash
.ONESHELL:
.PHONY: check test vet build smoke fmt image

# Lint + unit tests. Mirrors the `test` CI job; runs green inside `nix develop`.
check: vet test
	shellcheck scripts/*.sh
	yamllint .gitea

vet:
	go vet ./...

test:
	go test ./...

# Build every cmd/* binary into ./bin (gitignored — binaries are CI artifacts).
build:
	scripts/build-binaries.sh

smoke: build
	scripts/crucible-smoke.sh

fmt:
	gofmt -l -w cmd internal

# Build the Crucible image locally. Requires docker; mirrors build-image CI.
IMAGE ?= crucible
GIT_SHA ?= $(shell git rev-parse --short=12 HEAD 2>/dev/null || echo unknown)
image:
	docker build --build-arg GIT_SHA=$(GIT_SHA) -f docker/Dockerfile -t $(IMAGE):$(GIT_SHA) .
