forked from dagger/dagger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
93 lines (73 loc) · 3.01 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
SHELL := bash# we want bash behaviour in all shell invocations
# https://stackoverflow.com/questions/4842424/list-of-ansi-color-escape-sequences
BOLD := \033[1m
NORMAL := \033[0m
GREEN := \033[1;32m
XDG_CONFIG_HOME ?= $(CURDIR)/.config
export XDG_CONFIG_HOME
.DEFAULT_GOAL := help
HELP_TARGET_DEPTH ?= \#
.PHONY: help
help: # Show how to get started & what targets are available
@printf "This is a list of all the make targets that you can run, e.g. $(BOLD)make dagger$(NORMAL) - or $(BOLD)m dagger$(NORMAL)\n\n"
@awk -F':+ |$(HELP_TARGET_DEPTH)' '/^[0-9a-zA-Z._%-]+:+.+$(HELP_TARGET_DEPTH).+$$/ { printf "$(GREEN)%-20s\033[0m %s\n", $$1, $$3 }' $(MAKEFILE_LIST) | sort
@echo
GIT_REVISION := $(shell git rev-parse --short HEAD)
.PHONY: dagger
dagger: # Build a dev dagger binary
CGO_ENABLED=0 go build -o ./cmd/dagger/ -ldflags '-s -w -X go.dagger.io/dagger/version.Revision=$(GIT_REVISION)' ./cmd/dagger/
.PHONY: dagger-debug
dagger-debug: # Build a debug version of the dev dagger binary
go build -race -o ./cmd/dagger/dagger-debug -ldflags '-X go.dagger.io/dagger/version.Revision=$(GIT_REVISION)' ./cmd/dagger/
.PHONY: install
install: # Install a dev dagger binary
go install -ldflags '-X go.dagger.io/dagger/version.Revision=$(GIT_REVISION)' ./cmd/dagger
.PHONY: test
test: # Run all tests
go test -race -v ./...
.PHONY: golint
golint: dagger # Go lint
./cmd/dagger/dagger do lint go
.PHONY: cuefmt
cuefmt: # Format all cue files
find . -name '*.cue' -not -path '*/cue.mod/*' -print | time xargs -n 1 -P 8 cue fmt -s
.PHONY: cuelint
cuelint: dagger # Lint all cue files
./cmd/dagger/dagger do lint cue
.PHONY: shellcheck
shellcheck: dagger # Run shellcheck
./cmd/dagger/dagger do lint shell
.PHONY: lint
lint: dagger # Lint everything
./cmd/dagger/dagger do lint
.PHONY: integration
integration: core-integration universe-test doc-test # Run all integration tests
.PHONY: core-integration
core-integration: dagger-debug # Run core integration tests
yarn --cwd "./tests" install
DAGGER_BINARY="$(shell pwd)/cmd/dagger/dagger-debug" yarn --cwd "./tests" test
# .PHONY: universe-test
# universe-test: dagger-debug # Run universe tests
# yarn --cwd "./universe" install
# DAGGER_BINARY="$(shell pwd)/cmd/dagger/dagger-debug" yarn --cwd "./universe" test
.PHONY: universe-test
universe-test: dagger-debug # Run universe tests
yarn --cwd "./pkg/universe.dagger.io" install
DAGGER_BINARY="$(shell pwd)/cmd/dagger/dagger-debug" yarn --cwd "./pkg/universe.dagger.io" test
.PHONY: doc-test
doc-test: dagger-debug # Test docs
yarn --cwd "./docs/learn/tests" install
DAGGER_BINARY="$(shell pwd)/cmd/dagger/dagger-debug" yarn --cwd "./docs/learn/tests" test
.PHONY: docs
docs: dagger # Generate docs
DAGGER_TELEMETRY_DISABLE=1 ./cmd/dagger/dagger doc --output ./docs/reference --format md
.PHONY: mdlint
mdlint: # Markdown lint for web
@markdownlint ./docs README.md
.PHONY: web
web: # Run the website locally
yarn --cwd "./website" install
yarn --cwd "./website" start
.PHONY: todo
todo: # Find all TODO items
grep -r -A 1 "TODO:" $(CURDIR)