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 <noreply@anthropic.com>
This commit is contained in:
1 parent
98499e7226
commit
46199922f4
2 files changed
+12
-4
No files matched your search
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in new issue
Block a user