diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e22017e..17bbd197 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -168,6 +168,29 @@ jobs: run: | 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: name: Documentation runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index 8c9eb4b3..ac0ebc5d 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/pkg/universe.dagger.io/.gitignore b/pkg/universe.dagger.io/.gitignore new file mode 100644 index 00000000..ff8f4176 --- /dev/null +++ b/pkg/universe.dagger.io/.gitignore @@ -0,0 +1,2 @@ +node_modules +report.xml diff --git a/pkg/universe.dagger.io/bats_helpers.bash b/pkg/universe.dagger.io/bats_helpers.bash new file mode 100644 index 00000000..c8a2eec2 --- /dev/null +++ b/pkg/universe.dagger.io/bats_helpers.bash @@ -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}" "$@" +} diff --git a/pkg/universe.dagger.io/cue.mod/pkg/dagger.io b/pkg/universe.dagger.io/cue.mod/pkg/dagger.io deleted file mode 120000 index cb095939..00000000 --- a/pkg/universe.dagger.io/cue.mod/pkg/dagger.io +++ /dev/null @@ -1 +0,0 @@ -../../../dagger.io \ No newline at end of file diff --git a/pkg/universe.dagger.io/fmt.sh b/pkg/universe.dagger.io/fmt.sh deleted file mode 100755 index b2121b3f..00000000 --- a/pkg/universe.dagger.io/fmt.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -find . -name '*.cue' -exec cue fmt -s {} \; diff --git a/pkg/universe.dagger.io/package.json b/pkg/universe.dagger.io/package.json new file mode 100644 index 00000000..bc23fdf5 --- /dev/null +++ b/pkg/universe.dagger.io/package.json @@ -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" + } +} diff --git a/pkg/universe.dagger.io/search.sh b/pkg/universe.dagger.io/search.sh deleted file mode 100755 index a6496286..00000000 --- a/pkg/universe.dagger.io/search.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -find . -name '*.cue' -exec grep -H "$1" {} \; diff --git a/pkg/universe.dagger.io/test.sh b/pkg/universe.dagger.io/test.sh deleted file mode 100755 index f66509b7..00000000 --- a/pkg/universe.dagger.io/test.sh +++ /dev/null @@ -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 diff --git a/pkg/universe.dagger.io/yarn.lock b/pkg/universe.dagger.io/yarn.lock new file mode 100644 index 00000000..34d678ca --- /dev/null +++ b/pkg/universe.dagger.io/yarn.lock @@ -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== diff --git a/pkg/universe.dagger.io/yarn/test/yarn.bats b/pkg/universe.dagger.io/yarn/test/yarn.bats new file mode 100644 index 00000000..3a6f2c03 --- /dev/null +++ b/pkg/universe.dagger.io/yarn/test/yarn.bats @@ -0,0 +1,9 @@ +setup() { + load '../../bats_helpers' + + common_setup +} + +@test "yarn.#Build" { + dagger up ./yarn-test.cue +} diff --git a/tests/tasks/source/test.sh b/tests/tasks/source/test.sh index 2d3ac979..42c5d217 100755 --- a/tests/tasks/source/test.sh +++ b/tests/tasks/source/test.sh @@ -1,3 +1,3 @@ #!/bin/sh -echo -n hello world > /test.txt +printf "hello world" > /test.txt \ No newline at end of file