Files
x/Makefile
T
sneak 7feb212d04
check / check (push) Successful in 1m3s
Adopt the scripts-to-rule-them-all layout and the canonical Docker gates
script/ holds the entrypoints and the Makefile targets shim to them.
Linting and testing are phases of the Dockerfile, built alone by
script/lint and script/test with a fresh CACHEBUST value and cache
mounts for Go's build cache and golangci-lint's; the build stage
depends on both, and the runtime stage ships the binary and the source
without .git. Formatting stays on the host in script/fmt and
script/fmt-check (gofmt and the prettier pinned in yarn.lock).
script/cibuild bootstraps, runs script/check and builds the tagged
image, and the Gitea workflow calls it. script/precommit refuses a
commit whose go.mod or go.sum is not tidy.

cgo stays off, so the test phase runs on the alpine Go image without
-race; that is the one departure from the canonical Go Dockerfile.

Re-vendored from the prompts repository's next branch: REPO_POLICIES.md
(2026-11-04), .golangci.yml (byte-identical, so the local
exhaustruct_v5 addition is gone now that canonical carries it),
.gitea/workflows/check.yml, .editorconfig, .gitignore and .dockerignore,
the last two followed by this repository's own entries. AGENTS.md holds
the repository-specific guidance for agents. The README gains the
Entrypoints section and describes the new gates.
2026-11-04 07:31:59 -08:00

59 lines
1.2 KiB
Makefile

.PHONY: bootstrap setup test lint fmt fmt-check check docker hooks \
build install tidy clean
# Makefile targets are thin shims; the implementations live in script/
# per the scripts-to-rule-them-all pattern (see the Entrypoints section
# of README.md). The targets after the shims are this repo's own.
bootstrap:
@script/bootstrap
setup:
@script/setup
test:
@script/test
lint:
@script/lint
fmt:
@script/fmt
fmt-check:
@script/fmt-check
check:
@script/check
docker:
@script/docker
hooks:
@script/install-precommit
# This repository's own targets.
BINARY := sutil
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo unknown)
GOLDFLAGS := -X main.Version=$(VERSION)
# cgo stays off everywhere: builds are static, and the test phase of the
# Dockerfile runs without -race, which would need a C toolchain.
export CGO_ENABLED := 0
# Build the sutil binary in the repo root with the git version embedded.
build:
go build -trimpath -ldflags "$(GOLDFLAGS)" -o $(BINARY) ./cmd/$(BINARY)
# Install sutil into $(go env GOBIN) (or $GOPATH/bin).
install:
go install -trimpath -ldflags "$(GOLDFLAGS)" ./cmd/$(BINARY)
# Tidy go.mod and go.sum; script/precommit refuses a commit that needs it.
tidy:
go mod tidy
clean:
rm -f $(BINARY)