Merge pull request #1455 from aluzzardi/europa-universe-test
tests: Basic test infrastructure for Europa Universe
This commit is contained in:
commit
8b2ee53016
23
.github/workflows/ci.yml
vendored
23
.github/workflows/ci.yml
vendored
@ -168,6 +168,29 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
make universe-test
|
make universe-test
|
||||||
|
|
||||||
|
europa:
|
||||||
|
name: Universe (Europa)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 20
|
||||||
|
steps:
|
||||||
|
- name: Check out
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v1
|
||||||
|
with:
|
||||||
|
go-version: 1.16
|
||||||
|
|
||||||
|
- name: Expose GitHub Runtime
|
||||||
|
uses: crazy-max/ghaction-github-runtime@v1
|
||||||
|
|
||||||
|
- name: Universe Test
|
||||||
|
env:
|
||||||
|
DAGGER_CACHE_TO: "type=gha,mode=max,scope=test-universe"
|
||||||
|
DAGGER_CACHE_FROM: "type=gha,mode=max,scope=test-universe"
|
||||||
|
run: |
|
||||||
|
make europa-universe-test
|
||||||
|
|
||||||
doc:
|
doc:
|
||||||
name: Documentation
|
name: Documentation
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
10
Makefile
10
Makefile
@ -24,7 +24,7 @@ golint:
|
|||||||
|
|
||||||
.PHONY: cuefmt
|
.PHONY: cuefmt
|
||||||
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
|
.PHONY: cuelint
|
||||||
cuelint: cuefmt
|
cuelint: cuefmt
|
||||||
@ -32,8 +32,7 @@ cuelint: cuefmt
|
|||||||
|
|
||||||
.PHONY: shellcheck
|
.PHONY: shellcheck
|
||||||
shellcheck:
|
shellcheck:
|
||||||
shellcheck ./tests/*.bats ./tests/*.bash
|
shellcheck $$(find . -type f \( -iname \*.bats -o -iname \*.bash -o -iname \*.sh \) -not -path "*/node_modules/*" -not -path "*/bats-*/*")
|
||||||
shellcheck ./universe/*.bats ./universe/*.bash
|
|
||||||
|
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint: shellcheck cuelint golint docslint
|
lint: shellcheck cuelint golint docslint
|
||||||
@ -51,6 +50,11 @@ universe-test: dagger-debug
|
|||||||
yarn --cwd "./universe" install
|
yarn --cwd "./universe" install
|
||||||
DAGGER_BINARY="$(shell pwd)/cmd/dagger/dagger-debug" yarn --cwd "./universe" test
|
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
|
.PHONY: doc-test
|
||||||
doc-test: dagger-debug
|
doc-test: dagger-debug
|
||||||
yarn --cwd "./docs/learn/tests" install
|
yarn --cwd "./docs/learn/tests" install
|
||||||
|
2
pkg/universe.dagger.io/.gitignore
vendored
Normal file
2
pkg/universe.dagger.io/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
report.xml
|
25
pkg/universe.dagger.io/bats_helpers.bash
Normal file
25
pkg/universe.dagger.io/bats_helpers.bash
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
common_setup() {
|
||||||
|
load "$(dirname "${BASH_SOURCE[0]}")/node_modules/bats-support/load.bash"
|
||||||
|
load "$(dirname "${BASH_SOURCE[0]}")/node_modules/bats-assert/load.bash"
|
||||||
|
|
||||||
|
# Dagger Binary
|
||||||
|
# FIXME: `command -v` must be wrapped in a sub-bash,
|
||||||
|
# otherwise infinite recursion when DAGGER_BINARY is not set.
|
||||||
|
export DAGGER="${DAGGER_BINARY:-$(bash -c 'command -v dagger')}"
|
||||||
|
|
||||||
|
# Force Europa mode
|
||||||
|
DAGGER_EUROPA="1"
|
||||||
|
export DAGGER_EUROPA
|
||||||
|
|
||||||
|
# Force plain printing for error reporting
|
||||||
|
DAGGER_LOG_FORMAT="plain"
|
||||||
|
export DAGGER_LOG_FORMAT
|
||||||
|
|
||||||
|
# cd into the directory containing the bats file
|
||||||
|
cd "$BATS_TEST_DIRNAME" || exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# dagger helper to execute the right binary
|
||||||
|
dagger() {
|
||||||
|
"${DAGGER}" "$@"
|
||||||
|
}
|
@ -1 +0,0 @@
|
|||||||
../../../dagger.io
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
find . -name '*.cue' -exec cue fmt -s {} \;
|
|
11
pkg/universe.dagger.io/package.json
Normal file
11
pkg/universe.dagger.io/package.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"scripts": {
|
||||||
|
"test": "bats --report-formatter junit --jobs 4 $(find . -type f -name '*.bats' -not -path '*/node_modules/*')"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"bats": "^1.5.0",
|
||||||
|
"bats-assert": "^2.0.0",
|
||||||
|
"bats-support": "^0.3.0"
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
find . -name '*.cue' -exec grep -H "$1" {} \;
|
|
@ -1,33 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
targets=(
|
|
||||||
dagger.io/dagger
|
|
||||||
dagger.io/dagger/engine
|
|
||||||
|
|
||||||
./docker
|
|
||||||
./docker/test/build
|
|
||||||
|
|
||||||
./alpine
|
|
||||||
./alpine/tests/simple
|
|
||||||
|
|
||||||
./yarn
|
|
||||||
./yarn/tests/simple
|
|
||||||
|
|
||||||
./bash
|
|
||||||
./python
|
|
||||||
./git
|
|
||||||
./nginx
|
|
||||||
./netlify
|
|
||||||
./netlify/test/simple
|
|
||||||
|
|
||||||
./examples/todoapp
|
|
||||||
./examples/todoapp/dev
|
|
||||||
./examples/todoapp/staging
|
|
||||||
)
|
|
||||||
|
|
||||||
for t in "${targets[@]}"; do
|
|
||||||
echo "-- $t"
|
|
||||||
cue eval "$t" >/dev/null
|
|
||||||
done
|
|
18
pkg/universe.dagger.io/yarn.lock
Normal file
18
pkg/universe.dagger.io/yarn.lock
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||||
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
|
bats-assert@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/bats-assert/-/bats-assert-2.0.0.tgz#ba1b4eeee2c7848f1a25948b623790dd41a2b94b"
|
||||||
|
integrity sha512-qO3kNilWxW8iCONu9NDUfvsCiC6JzL6DPOc/DGq9z3bZ9/A7wURJ+FnFMxGbofOmWbCoy7pVhofn0o47A95qkQ==
|
||||||
|
|
||||||
|
bats-support@^0.3.0:
|
||||||
|
version "0.3.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/bats-support/-/bats-support-0.3.0.tgz#a1f6b8878d2a51837911fdffa0750036f60701ef"
|
||||||
|
integrity sha512-z+2WzXbI4OZgLnynydqH8GpI3+DcOtepO66PlK47SfEzTkiuV9hxn9eIQX+uLVFbt2Oqoc7Ky3TJ/N83lqD+cg==
|
||||||
|
|
||||||
|
bats@^1.5.0:
|
||||||
|
version "1.5.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/bats/-/bats-1.5.0.tgz#683f522e89df7d8fc99bf3631d35501f35445166"
|
||||||
|
integrity sha512-83YgQw24Yi2c1ctB0Vd7WCsACUMSWuEtOboxQZyFQYfiv9hDMW7nk7bdloqGLg3vK5pOODCBGBQjhvRmHKsJuA==
|
9
pkg/universe.dagger.io/yarn/test/yarn.bats
Normal file
9
pkg/universe.dagger.io/yarn/test/yarn.bats
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
setup() {
|
||||||
|
load '../../bats_helpers'
|
||||||
|
|
||||||
|
common_setup
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "yarn.#Build" {
|
||||||
|
dagger up ./yarn-test.cue
|
||||||
|
}
|
@ -1,3 +1,3 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
echo -n hello world > /test.txt
|
printf "hello world" > /test.txt
|
Reference in New Issue
Block a user