-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Makefile
75 lines (61 loc) · 2.22 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
include ./ci/make.inc
CUE_FILES = $(shell find . -type f -name '*.cue' | grep -v 'cue.mod/pkg/' | sort)
GO_FILES = $(shell find . -type f -name '*.go' | grep -v 'cue.mod/pkg/' | sort)
GHA_FILES = $(shell ls ci/gha/*.cue | sort)
# First command incase users forget to supply one
# cat self as help for simplicity
help:
cat Makefile
.PHONY: help
.PHONY: github workflow devcontainer
github: workflow devcontainer
# GitHub Actions workflows
workflows = $(addprefix workflow_, $(GHA_FILES))
workflow: $(workflows)
$(workflows): workflow_%:
hof export --out yaml $(subst workflow_,,$@) -o $(subst ci/gha,.github/workflows,$(subst workflow_,,$(subst .cue,,$@))).yml
devcontainer: ci/devc/devcontainer.cue
@hof export ci/devc/devcontainer.cue -o .devcontainer/devcontainer.json
.PHONY: hack
hack:
CGO_ENABLED=0 go install ./hack
.PHONY: hof
hof:
go install ./cmd/hof
.PHONY: race
race:
go install -race ./cmd/hof
.PHONY: hof.build
hof.build:
go build -o hof ./cmd/hof
.PHONY: deps.check deps.update
deps.check:
go list -u -m all | grep '\[.*\]'
deps.update:
go get -u ./...
# formatter images
.PHONY: formatters fmtr.release
formatters:
make -C formatters images
fmtr.release:
make -C formatters marchs
fmt: cuefmt gofmt
.PHONY: cuefmt cuefiles
cuefiles:
find . -type f -name '*.cue' '!' -path '*/cue.mod/*' '!' -path '*/templates/*' '!' -path '*/partials/*' '!' -path '*/.hof/*' -print
cuefmt:
find . -type f -name '*.cue' '!' -path '*/cue.mod/*' '!' -path '*/templates/*' '!' -path '*/partials/*' '!' -path '*/.hof/*' -exec cue fmt {} \;
.PHONY: gofmt gofiles
gofiles:
find . -type f -name '*.go' '!' -path '*/cue.mod/*' '!' -path '*/templates/*' '!' -path '*/partials/*' '!' -path '*/.hof/*' -print
gofmt:
find . -type f -name '*.go' '!' -path '*/cue.mod/*' '!' -path '*/templates/*' '!' -path '*/partials/*' '!' -path '*/.hof/*' -exec gofmt -w {} \;
goreleaser.yml: cmd/hof/goreleaser.cue
cue export cmd/hof/goreleaser.cue -f -o cmd/hof/goreleaser.yml
snapshot: goreleaser.yml
cd cmd/hof && goreleaser release -f goreleaser.yml --rm-dist -p 1 --snapshot
release: goreleaser.yml
make -C formatters marchs
cd cmd/hof && goreleaser release -f goreleaser.yml --rm-dist -p 1
workdir.clean:
find . -type d -name '.workdir' -exec rm -rf {} \;