Vellum/Makefile
mithral c91fae1256 Replace the CI workflow with a make gate target
Gitea Actions is enabled on the instance and the workflow file was
correct, but no act_runner is registered: the push produced zero workflow
runs and the job would queue forever. A workflow that cannot run is worse
than none, because it implies pushes are gated when they are not.

`make gate` runs the same checks locally and is verify-only - gofmt -l must
print nothing and the file is never rewritten. The existing `check` target
stays and keeps its rewriting behaviour; its comment now says so, because
conflating a fixer with a gate is how an unformatted file reaches main.

The workflow is in history at 43116fa if a runner ever appears.
2026-10-12 00:57:56 -04:00

63 lines
1.5 KiB
Makefile

# Vellum — developer commands.
#
# Requires Go >= 1.26 and pnpm. On Fedora: sudo dnf install golang
# Frontend: cd web && pnpm install
BINARY := vellum
VERSION ?= 0.4.0-dev
LDFLAGS := -s -w -X main.version=$(VERSION)
.PHONY: build web build-go dev run test fmt vet tidy check gate docker clean
# Backend + Vite dev server together, with hot reload. Ctrl-C stops both.
dev:
./scripts/dev.sh
# Build the frontend first: the Go build embeds web/dist.
build: web
CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o $(BINARY) ./cmd/vellum
web:
cd web && pnpm install --silent && pnpm build
# Go-only build, for when the frontend is unchanged.
build-go:
CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o $(BINARY) ./cmd/vellum
run:
go run ./cmd/vellum
test:
go test ./...
fmt:
gofmt -w .
vet:
go vet ./...
tidy:
go mod tidy
# Fix formatting, then vet and test. Rewrites files, so it is a fixer, not a
# gate — use `gate` before pushing.
check: fmt vet test
# The same checks as check, but verify-only: gate never rewrites a file.
gate:
gofmt_out=$$(gofmt -l .); if [ -n "$$gofmt_out" ]; then echo "gofmt: not formatted:"; echo "$$gofmt_out"; exit 1; fi
echo "go build"
go build ./...
echo "go vet"
go vet ./...
echo "go test"
go test ./...
echo "web check"
cd web && pnpm install --frozen-lockfile && pnpm check
docker:
podman build --build-arg VERSION=$(VERSION) -t localhost/vellum:$(VERSION) .
clean:
rm -f $(BINARY)
rm -rf data config web/dist/*.js web/dist/*.css web/dist/assets web/dist/index.html