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>
This commit is contained in:
Andrea Luzzardi
2022-01-18 19:13:07 -08:00
parent 44335b5818
commit 568cd194a4
12 changed files with 96 additions and 44 deletions

View File

@@ -24,7 +24,7 @@ golint:
.PHONY: cuefmt
cuefmt:
@(find . -name '*.cue' -exec cue fmt -s {} \;)
find . -name '*.cue' -not -path '*/cue.mod/*' -print | time xargs -n 1 -P 8 cue fmt -s
.PHONY: cuelint
cuelint: cuefmt
@@ -32,8 +32,7 @@ cuelint: cuefmt
.PHONY: shellcheck
shellcheck:
shellcheck ./tests/*.bats ./tests/*.bash
shellcheck ./universe/*.bats ./universe/*.bash
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
@@ -51,6 +50,11 @@ 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