-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (34 loc) · 873 Bytes
/
Makefile
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
GO := go
GO_LINKER_FLAGS ?=
GO_BUILD_FLAGS ?=
IMAGE_TAG := main
DOCKER_FLAGS ?=
TEST_FLAGS ?=
TEST_PACKAGES ?= ./...
VERSION ?= $(shell git describe --tags --always)
BINARY ?= yfg
default: yfg
all: check test yfg
.PHONY: yfg
yfg: schema yfg-bin
.PHONY: yfg-bin
yfg-bin:
$(GO) build -ldflags="-X 'github.com/chancez/yamlforge/cmd.Version=$(VERSION)' $(GO_LINKER_FLAGS)" $(GO_BUILD_FLAGS) -o $(BINARY) .
schema:
$(GO) run ./tools/gen-jsonschema pkg/config/schema/schema.json
.PHONY: test
test:
$(GO) test $(TEST_FLAGS) $(TEST_PACKAGES)
.PHONY: check
check:
golangci-lint run
.PHONY: image
image:
docker build $(DOCKER_FLAGS) -t quay.io/ecnahc515/yfg:$(IMAGE_TAG) .
.PHONY: release
release:
for GOOS in darwin linux windows; do \
for GOARCH in arm64 amd64; do \
env GOOS=$$GOOS GOARCH=$$GOARCH $(MAKE) yfg-bin BINARY=yfg-$$GOOS-$$GOARCH; \
done \
done