2022-01-25 20:17:18 +01:00
|
|
|
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
|
2021-01-08 17:16:00 +01:00
|
|
|
|
2022-01-25 20:17:18 +01:00
|
|
|
GIT_REVISION := $(shell git rev-parse --short HEAD)
|
2020-12-30 03:45:16 +01:00
|
|
|
.PHONY: dagger
|
2022-01-25 20:17:18 +01:00
|
|
|
dagger: # Build a dev dagger binary
|
2021-07-19 17:43:45 +02:00
|
|
|
CGO_ENABLED=0 go build -o ./cmd/dagger/ -ldflags '-s -w -X go.dagger.io/dagger/version.Revision=$(GIT_REVISION)' ./cmd/dagger/
|
2021-01-08 17:16:00 +01:00
|
|
|
|
2021-05-28 00:52:30 +02:00
|
|
|
.PHONY: dagger-debug
|
2022-01-25 20:17:18 +01:00
|
|
|
dagger-debug: # Build a debug version of the dev dagger binary
|
2021-07-19 17:43:45 +02:00
|
|
|
go build -race -o ./cmd/dagger/dagger-debug -ldflags '-X go.dagger.io/dagger/version.Revision=$(GIT_REVISION)' ./cmd/dagger/
|
2021-01-21 03:44:29 +01:00
|
|
|
|
2021-11-09 02:12:46 +01:00
|
|
|
.PHONY: install
|
2022-02-04 12:51:54 +01:00
|
|
|
install: # Install a dev dagger binary
|
|
|
|
go install -ldflags '-X go.dagger.io/dagger/version.Revision=$(GIT_REVISION)' ./cmd/dagger
|
2021-11-09 02:12:46 +01:00
|
|
|
|
2021-01-14 03:21:56 +01:00
|
|
|
.PHONY: test
|
2022-01-25 20:17:18 +01:00
|
|
|
test: # Run all tests
|
2021-01-21 03:44:29 +01:00
|
|
|
go test -race -v ./...
|
2021-01-14 03:21:56 +01:00
|
|
|
|
2021-04-02 23:15:49 +02:00
|
|
|
.PHONY: golint
|
2022-01-25 20:17:18 +01:00
|
|
|
golint: # Go lint
|
2021-04-02 23:15:49 +02:00
|
|
|
golangci-lint run --timeout 3m
|
|
|
|
|
2021-01-08 17:16:00 +01:00
|
|
|
.PHONY: cuefmt
|
2022-01-25 20:17:18 +01:00
|
|
|
cuefmt: # Format all cue files
|
2022-01-19 04:13:07 +01:00
|
|
|
find . -name '*.cue' -not -path '*/cue.mod/*' -print | time xargs -n 1 -P 8 cue fmt -s
|
2021-01-08 17:16:00 +01:00
|
|
|
|
2021-04-02 23:15:49 +02:00
|
|
|
.PHONY: cuelint
|
2022-01-25 20:17:18 +01:00
|
|
|
cuelint: cuefmt # Lint and format all cue files
|
2022-03-23 19:32:08 +01:00
|
|
|
@test -z "$$(git status -s . | grep -e "^ M" | grep "\.cue" | cut -d ' ' -f3 | tee /dev/stderr)"
|
2021-01-14 22:50:54 +01:00
|
|
|
|
2021-04-14 23:47:46 +02:00
|
|
|
.PHONY: shellcheck
|
2022-01-25 20:17:18 +01:00
|
|
|
shellcheck: # Run shellcheck
|
2022-01-19 04:13:07 +01:00
|
|
|
shellcheck $$(find . -type f \( -iname \*.bats -o -iname \*.bash -o -iname \*.sh \) -not -path "*/node_modules/*" -not -path "*/bats-*/*")
|
2021-04-14 23:47:46 +02:00
|
|
|
|
2021-04-02 23:15:49 +02:00
|
|
|
.PHONY: lint
|
2022-03-23 19:32:08 +01:00
|
|
|
lint: shellcheck cuelint golint docslint mdlint # Lint everything
|
2021-03-03 01:14:53 +01:00
|
|
|
|
2021-01-14 22:50:54 +01:00
|
|
|
.PHONY: integration
|
2022-01-25 20:17:18 +01:00
|
|
|
integration: core-integration universe-test doc-test # Run all integration tests
|
2021-07-01 18:47:32 +02:00
|
|
|
|
|
|
|
.PHONY: core-integration
|
2022-01-25 20:17:18 +01:00
|
|
|
core-integration: dagger-debug # Run core integration tests
|
2021-04-14 23:47:46 +02:00
|
|
|
yarn --cwd "./tests" install
|
2021-12-13 16:10:00 +01:00
|
|
|
DAGGER_BINARY="$(shell pwd)/cmd/dagger/dagger-debug" yarn --cwd "./tests" test
|
2021-03-03 03:59:07 +01:00
|
|
|
|
2022-02-22 01:02:37 +01:00
|
|
|
# .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
|
|
|
|
|
2021-06-09 21:08:03 +02:00
|
|
|
.PHONY: universe-test
|
2022-01-25 20:17:18 +01:00
|
|
|
universe-test: dagger-debug # Run universe tests
|
2022-01-19 04:13:07 +01:00
|
|
|
yarn --cwd "./pkg/universe.dagger.io" install
|
|
|
|
DAGGER_BINARY="$(shell pwd)/cmd/dagger/dagger-debug" yarn --cwd "./pkg/universe.dagger.io" test
|
|
|
|
|
2021-08-12 12:47:50 +02:00
|
|
|
.PHONY: doc-test
|
2022-01-25 20:17:18 +01:00
|
|
|
doc-test: dagger-debug # Test docs
|
2021-08-12 12:47:50 +02:00
|
|
|
yarn --cwd "./docs/learn/tests" install
|
|
|
|
DAGGER_BINARY="$(shell pwd)/cmd/dagger/dagger-debug" yarn --cwd "./docs/learn/tests" test
|
|
|
|
|
2021-06-09 03:57:45 +02:00
|
|
|
.PHONY: docs
|
2022-01-25 20:17:18 +01:00
|
|
|
docs: dagger # Generate docs
|
2021-09-08 15:19:19 +02:00
|
|
|
./cmd/dagger/dagger doc --output ./docs/reference --format md
|
2021-06-09 02:35:18 +02:00
|
|
|
|
2021-06-09 03:57:45 +02:00
|
|
|
.PHONY: docslint
|
2022-01-25 20:17:18 +01:00
|
|
|
docslint: docs # Generate & lint docs
|
2021-09-08 15:19:19 +02:00
|
|
|
@test -z "$$(git status -s . | grep -e "^ M" | grep docs/reference | cut -d ' ' -f3 | tee /dev/stderr)"
|
2021-06-09 02:35:18 +02:00
|
|
|
|
2022-03-23 19:32:08 +01:00
|
|
|
.PHONY: mdlint
|
|
|
|
mdlint: # Markdown lint for web
|
|
|
|
@markdownlint ./docs README.md
|
|
|
|
|
2021-06-09 03:57:45 +02:00
|
|
|
.PHONY: web
|
2022-01-25 20:17:18 +01:00
|
|
|
web: # Run the website locally
|
2021-06-04 22:28:38 +02:00
|
|
|
yarn --cwd "./website" install
|
|
|
|
yarn --cwd "./website" start
|
2022-01-25 20:17:18 +01:00
|
|
|
|
|
|
|
.PHONY: todo
|
|
|
|
todo: # Find all TODO items
|
|
|
|
grep -r -A 1 "TODO:" $(CURDIR)
|