--version/-V on the CLI, version in /api/health via Server.SetVersion, Makefile/Dockerfile ldflags stamping from git describe, and a release workflow on v* tags: both binaries for linux/darwin (amd64+arm64) and windows/amd64 with SHA256SUMS attached to the Gitea release (idempotent — reuses an existing hand-written release and skips already-uploaded assets), plus version-tagged Docker images. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
41 lines
969 B
Makefile
41 lines
969 B
Makefile
BINARY_NAME=exploredns
|
|
SERVER_BINARY_NAME=exploredns-server
|
|
BUILD_DIR=bin
|
|
GO=go
|
|
GOFLAGS=-v
|
|
VERSION?=$(shell git describe --tags --always 2>/dev/null || echo dev)
|
|
LDFLAGS=-ldflags "-X main.version=$(VERSION)"
|
|
|
|
.PHONY: build build-server build-all test lint clean cover deploy deploy-status
|
|
|
|
build:
|
|
$(GO) build $(GOFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/exploredns
|
|
|
|
build-server:
|
|
$(GO) build $(GOFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/$(SERVER_BINARY_NAME) ./cmd/server
|
|
|
|
build-all: build build-server
|
|
|
|
test:
|
|
$(GO) test -v -race -coverprofile=coverage.out ./...
|
|
|
|
cover: test
|
|
$(GO) tool cover -func=coverage.out
|
|
$(GO) tool cover -html=coverage.out -o coverage.html
|
|
|
|
lint:
|
|
$(GO) vet ./...
|
|
|
|
clean:
|
|
rm -rf $(BUILD_DIR)
|
|
rm -f coverage.out coverage.html
|
|
|
|
# Deploy the web server to Fly.io (requires flyctl and a configured app;
|
|
# see "Deploying to Fly.io" in README.md).
|
|
deploy:
|
|
flyctl deploy --remote-only
|
|
|
|
deploy-status:
|
|
flyctl status
|
|
flyctl checks list
|