sonda/Makefile
tgiachi a478c95536 ci: release by itself at every merge, with semantic-release
At every merge into main a workflow reads the Conventional Commits since the last release,
works out the version, writes CHANGELOG.md, tags the commit and makes the release on the
forge; when there is a release it builds the image from the tag and pushes it to
git.kmalloc.org/squid/sonda as X.Y.Z, X.Y and latest. The runner has no Docker, so the
image is built with kaniko.

The version is no longer written in the code: the release sets it (-X main.version) in the
Dockerfile and the Makefile, and a build that no release made says dev.
2026-11-16 13:07:17 +01:00

23 lines
812 B
Makefile

# Sonda with its web app inside the binary.
#
# make build build the web app, then sondad with the app embedded (bin/sondad)
# make web only the web app (it is written to internal/webui/dist)
# make test the Go tests and the web tests
#
# A plain `go build ./cmd/sondad` still works: it gives the API only, and / says how to build the app.
.PHONY: build web test
# The version is the last release tag, and how far this checkout is from it (v1.2.3-4-gabcdef), or "dev" outside git.
VERSION ?= $(shell git describe --tags --always 2>/dev/null | sed 's/^v//' || echo dev)
build: web
CGO_ENABLED=0 go build -tags webui -trimpath -ldflags="-s -w -X main.version=$(VERSION)" -o bin/sondad ./cmd/sondad
web:
cd web && npm ci && npm run build
test:
go vet ./...
go test ./...
cd web && npm test