check / check (push) Failing after 2s
script/docker and script/cibuild are again byte-identical to the shared model scripts. Both compute the version on the host with git describe, pass it as the VERSION build arg and build with --no-cache; script/cibuild runs script/bootstrap and script/check first. The CI build now stamps a real version instead of unknown. make build compiles with -trimpath and -s -w, as the model Dockerfile does. script/version stays: the Makefile and the Dockerfile still use it. The README describes both scripts as they now are. Model: opus-5-5
84 lines
1.9 KiB
Makefile
84 lines
1.9 KiB
Makefile
.PHONY: bootstrap setup assets test test-browser lint fmt fmt-check check build run dev deps docker clean hooks css css-check version
|
|
|
|
# Default target
|
|
.DEFAULT_GOAL := check
|
|
|
|
# Version stamped into the binary. Derived from git by script/version;
|
|
# override it (`make build VERSION=v1.2.3`) to stamp a given value, which is
|
|
# how the Dockerfile passes its build arg in.
|
|
VERSION ?= $(shell script/version)
|
|
|
|
# An empty override (`make build VERSION=`, or the Dockerfile's `make build
|
|
# VERSION="$VERSION"` when no VERSION build arg was given) means unset,
|
|
# exactly as it does in script/version -- stamping "" would leave the binary
|
|
# reporting no version and the footer back on its "dev" fallback. `override`
|
|
# is required: a plain assignment loses to the command-line definition it
|
|
# exists to correct.
|
|
override VERSION := $(or $(strip $(VERSION)),$(shell script/version))
|
|
|
|
# Extra linker flags for the build target. The static relink in the
|
|
# Dockerfile adds -extldflags here rather than passing its own -ldflags,
|
|
# so composing flags cannot drop the version stamp.
|
|
GO_LDFLAGS ?=
|
|
|
|
bootstrap:
|
|
@script/bootstrap
|
|
|
|
setup:
|
|
@script/setup
|
|
|
|
assets:
|
|
@script/assets
|
|
|
|
test:
|
|
@script/test
|
|
|
|
test-browser:
|
|
@script/test-browser
|
|
|
|
lint:
|
|
@script/lint
|
|
|
|
fmt:
|
|
@script/fmt
|
|
|
|
fmt-check:
|
|
@script/fmt-check
|
|
|
|
check:
|
|
@script/check
|
|
|
|
# -trimpath keeps the build directory out of the binary, so two builds of one
|
|
# commit match wherever they ran; -s -w drop the symbol table and debug info,
|
|
# which panics and stack traces do not use.
|
|
build: assets
|
|
go build -trimpath -ldflags '$(strip -s -w -X main.version=$(VERSION) $(GO_LDFLAGS))' -o bin/webhooker ./cmd/webhooker
|
|
|
|
run: build
|
|
./bin/webhooker
|
|
|
|
dev: assets
|
|
go run ./cmd/webhooker
|
|
|
|
deps:
|
|
go mod download
|
|
go mod tidy
|
|
|
|
version:
|
|
@echo $(VERSION)
|
|
|
|
docker:
|
|
@script/docker
|
|
|
|
clean:
|
|
rm -rf bin/
|
|
|
|
hooks:
|
|
@script/install-precommit
|
|
|
|
css:
|
|
@script/css
|
|
|
|
css-check:
|
|
@script/css-check
|