-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (46 loc) · 2.13 KB
/
Copy pathMakefile
File metadata and controls
57 lines (46 loc) · 2.13 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
53
54
55
56
57
.DEFAULT_GOAL := verify
.PHONY: build build-controller build-garm-derivative fmt-check garm-derivative-script test test-race vet verify
# The controller and observer that ship to the hosts. Stamped, because an
# unstamped binary reports `version: dev, commit: unknown` -- which is what all
# five hosts reported, since `build` compiles without ldflags and no other
# target ever produced these. runProviderRelease's own comment already claimed
# the Makefile stamped them; this is that claim made true.
#
# The version is the provider derivative version, read from the manifest rather
# than written here, so the binary and the manifest are one statement. The
# commit is the exact tree, and a dirty tree is refused rather than stamped with
# a commit it does not match.
CONTROLLER_VERSION = $(shell go run ./cmd/gha-fleet provider-release --field derivative_version)
CONTROLLER_COMMIT = $(shell git rev-parse HEAD)
CONTROLLER_LDFLAGS = -buildid= -s -w -X main.version=$(CONTROLLER_VERSION) -X main.commit=$(CONTROLLER_COMMIT)
build:
go build -trimpath ./...
build-controller:
@test -z "$$(git status --porcelain)" || { \
echo "refusing to stamp a dirty tree: the commit would not describe these bytes" >&2; \
git status --short >&2; \
exit 1; \
}
@test -n "$(CONTROLLER_VERSION)" || { echo "provider release manifest gave no version" >&2; exit 1; }
mkdir -p dist
CGO_ENABLED=0 go build -trimpath -buildvcs=false -ldflags "$(CONTROLLER_LDFLAGS)" -o dist/gha-fleet ./cmd/gha-fleet
CGO_ENABLED=0 go build -trimpath -buildvcs=false -ldflags "$(CONTROLLER_LDFLAGS)" -o dist/gha-fleet-observer ./cmd/gha-fleet-observer
CGO_ENABLED=0 go build -trimpath -buildvcs=false -ldflags "$(CONTROLLER_LDFLAGS)" -o dist/gha-cache-broker ./cmd/gha-cache-broker
@./dist/gha-fleet version
@./dist/gha-cache-broker -version
garm-derivative-script:
go run ./cmd/gha-fleet render-garm-build
build-garm-derivative:
scripts/build-garm-nddev.sh
fmt-check:
@test -z "$$(gofmt -l cmd internal third_party)" || { \
gofmt -d cmd internal third_party; \
exit 1; \
}
test:
go test ./...
test-race:
go test -race ./...
vet:
go vet ./...
verify: fmt-check vet test-race build