-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (44 loc) · 2.34 KB
/
Copy pathMakefile
File metadata and controls
52 lines (44 loc) · 2.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Aggregate Makefile for the gloo examples. Every immediate subdirectory that
# has its own Makefile is a module group (framework, scripts); `make test` runs
# each group's tests and `make check` runs each group's full quality gate. New
# groups are discovered automatically — no edits needed here.
.DELETE_ON_ERROR:
.DEFAULT_GOAL := help
# Absolute path to this Makefile's directory (trailing slash), so the wildcard
# and the sub-makes resolve from any caller's working directory.
here := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
# Each subdirectory holding a Makefile, as a bare group name.
MODULES := $(patsubst $(here)%/Makefile,%,$(wildcard $(here)*/Makefile))
.PHONY: help
help: ## List available targets
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-18s\033[0m %s\n", $$1, $$2}'
.PHONY: test
test: $(MODULES) ## Run tests for every module group
.PHONY: $(MODULES)
$(MODULES):
$(MAKE) -C $(here)$@ test
.PHONY: check
check: $(addprefix check-,$(MODULES)) ## Run the full quality gate for every module group
.PHONY: $(addprefix check-,$(MODULES))
$(addprefix check-,$(MODULES)):
$(MAKE) -C $(here)$(@:check-%=%) check
# The fleet go gate (nicerobot/tools.build ci/go `check`) runs `make ci` when
# the repo root is a Go module; this repo is an aggregate of nested example
# modules with no root go.mod, so the gate takes its no-root-packages fallback
# and runs `make tools-version` instead. A version print alone would turn the
# gate into a green badge that never compiles or tests the examples, so this
# target first runs the real aggregate gate (`check`, every module group's full
# quality gate) and then reports the pinned tool versions from ${GOBIN} exactly
# as the shared build/go/Makefile's tools-version does.
GO ?= go
GOBIN := $(strip $(shell $(GO) env GOBIN))
gobin-or-die = $(or $(GOBIN),$(error GOBIN is not set — install the pinned tool set via nicerobot/tools.build (go-tooling/install-tools.sh); the gate resolves tools from $${GOBIN} only))
.PHONY: tools-version
tools-version: check ## Run the aggregate gate, then print the pinned tool versions (from ${GOBIN})
$(gobin-or-die)/golangci-lint version
$(gobin-or-die)/staticcheck -version
$(gobin-or-die)/gofumpt --version
$(gobin-or-die)/gotestsum --version
$(gobin-or-die)/goreleaser --version
$(gobin-or-die)/yq --version