This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/Makefile
Andrea Luzzardi 568cd194a4 tests: Basic test infrastructure for Europa Universe
- Each package can include its own bats file (e.g. `universe.dagger.io/yarn/test/yarn.bats`)
- universe.dagger.io includes a common bash helper file
- bats is installed/launched through yarn with minimal setup
- shellcheck is done across the entire repo
- Integrated into our CI

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2022-01-19 12:39:39 -08:00

79 lines
2.1 KiB
Makefile

GIT_REVISION := $(shell git rev-parse --short HEAD)
.PHONY: all
all: dagger
.PHONY: dagger
dagger:
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:
go build -race -o ./cmd/dagger/dagger-debug -ldflags '-X go.dagger.io/dagger/version.Revision=$(GIT_REVISION)' ./cmd/dagger/
.PHONY: install
go install ./cmd/dagger
.PHONY: test
test:
go test -race -v ./...
.PHONY: golint
golint:
golangci-lint run --timeout 3m
.PHONY: cuefmt
cuefmt:
find . -name '*.cue' -not -path '*/cue.mod/*' -print | time xargs -n 1 -P 8 cue fmt -s
.PHONY: cuelint
cuelint: cuefmt
@test -z "$$(git status -s . | grep -e "^ M" | grep .cue | cut -d ' ' -f3 | tee /dev/stderr)"
.PHONY: shellcheck
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
.PHONY: integration
integration: core-integration universe-test doc-test
.PHONY: core-integration
core-integration: dagger-debug
yarn --cwd "./tests" install
DAGGER_BINARY="$(shell pwd)/cmd/dagger/dagger-debug" yarn --cwd "./tests" test
.PHONY: universe-test
universe-test: dagger-debug
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
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
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
./cmd/dagger/dagger doc --output ./docs/reference --format md
.PHONY: docslint
docslint: docs
@test -z "$$(git status -s . | grep -e "^ M" | grep docs/reference | cut -d ' ' -f3 | tee /dev/stderr)"
.PHONY: web
web:
yarn --cwd "./website" install
yarn --cwd "./website" start