From 46199922f471f9051bbb758201cdf0f19c32b70f Mon Sep 17 00:00:00 2001 From: Narrator Date: Thu, 29 Oct 2026 19:18:52 +0100 Subject: [PATCH] make builds get a version self-update understands, and a test target The default VERSION was the date, which parses as version 2026.10.29 and outranks every release, so a make build never saw an update. It's now 'git describe', or "dev". 'make test' runs what CI runs, and CI runs the tests with -race. The CI comment about Forgejo said the opposite of .forgejo/workflows/README.md. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 5 +++-- Makefile | 11 +++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d13b34..c10fe62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,11 +20,12 @@ jobs: - name: gofmt run: test -z "$(gofmt -l .)" || { gofmt -l .; exit 1; } - run: go vet ./... - - run: go test ./... + - run: go test -race ./... release: # A v* tag builds the release binaries and publishes them, on GitHub - # only: Forgejo reads this directory too and has its own releases. + # only. Forgejo has its own releases, and skips this file anyway: see + # .forgejo/workflows/README.md. if: startsWith(github.ref, 'refs/tags/v') && github.server_url == 'https://github.com' needs: test runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 28fb534..97efa38 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,13 @@ -VERSION ?= $(shell date +%Y.%m.%d) +# The nearest tag, so self-update can tell a newer release apart; a date +# would read as version 2026.10.29 and outrank every release. +VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev) interzone: CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=$(VERSION)" -o interzone . -.PHONY: interzone +test: + test -z "$$(gofmt -l .)" || { gofmt -l .; exit 1; } + go vet ./... + go test -race ./... + +.PHONY: interzone test