Add a new make target that provisions dagger-ci declaratively
While at it, add help make target & make it the default. This explains all make targets. Run `make help` to see it in action 😉 dagger-ci-pr1499-2022-01-26 API token was added as an AGE secret. It can be accessed only by the intended recipients are able to decrypt it with their private SSH keys. echo "TOKEN" | age -R .age.recipients.txt -o .do.dagger-ci-pr1499-2022-01-26.age Do not assume that /bin/true exists on hosts running Docker. Use "true" and let the system resolve the path. Re-enable all ssh Universe tests. Signed-off-by: Gerhard Lazu <gerhard@lazu.co.uk>
This commit is contained in:
62
Makefile
62
Makefile
@@ -1,78 +1,92 @@
|
||||
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: all
|
||||
all: dagger
|
||||
|
||||
.PHONY: dagger
|
||||
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:
|
||||
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: dagger # Build & install a dev dagger binary
|
||||
go install ./cmd/dagger
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
test: # Run all tests
|
||||
go test -race -v ./...
|
||||
|
||||
.PHONY: golint
|
||||
golint:
|
||||
golint: # Go lint
|
||||
golangci-lint run --timeout 3m
|
||||
|
||||
.PHONY: cuefmt
|
||||
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: cuefmt
|
||||
cuelint: cuefmt # Lint and format all cue files
|
||||
@test -z "$$(git status -s . | grep -e "^ M" | grep .cue | cut -d ' ' -f3 | tee /dev/stderr)"
|
||||
|
||||
.PHONY: shellcheck
|
||||
shellcheck:
|
||||
shellcheck: # Run shellcheck
|
||||
shellcheck $$(find . -type f \( -iname \*.bats -o -iname \*.bash -o -iname \*.sh \) -not -path "*/node_modules/*" -not -path "*/bats-*/*")
|
||||
|
||||
.PHONY: lint
|
||||
lint: shellcheck cuelint golint docslint
|
||||
lint: shellcheck cuelint golint docslint # Lint everything
|
||||
|
||||
.PHONY: integration
|
||||
integration: core-integration universe-test doc-test
|
||||
integration: core-integration universe-test doc-test # Run all integration tests
|
||||
|
||||
.PHONY: core-integration
|
||||
core-integration: dagger-debug
|
||||
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
|
||||
universe-test: dagger-debug # Run universe tests
|
||||
yarn --cwd "./universe" install
|
||||
DAGGER_BINARY="$(shell pwd)/cmd/dagger/dagger-debug" yarn --cwd "./universe" test
|
||||
|
||||
.PHONY: europa-universe-test
|
||||
europa-universe-test: dagger-debug
|
||||
europa-universe-test: dagger-debug # Run Europa 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
|
||||
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: install
|
||||
install: dagger
|
||||
go install ./cmd/dagger
|
||||
|
||||
.PHONY: docs
|
||||
docs: dagger
|
||||
docs: dagger # Generate docs
|
||||
./cmd/dagger/dagger doc --output ./docs/reference --format md
|
||||
|
||||
.PHONY: docslint
|
||||
docslint: docs
|
||||
docslint: docs # Generate & lint docs
|
||||
@test -z "$$(git status -s . | grep -e "^ M" | grep docs/reference | cut -d ' ' -f3 | tee /dev/stderr)"
|
||||
|
||||
.PHONY: web
|
||||
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)
|
||||
|
Reference in New Issue
Block a user