mirror of
https://github.com/morten-olsen/morten-olsen.github.io.git
synced 2026-02-08 01:46:28 +01:00
update
This commit is contained in:
12
cue.mod/pkg/universe.dagger.io/yarn/test/data/bar/package.json
generated
Executable file
12
cue.mod/pkg/universe.dagger.io/yarn/test/data/bar/package.json
generated
Executable file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "test",
|
||||
"main": "index.js",
|
||||
"license": {
|
||||
"type": "Apache-2.0",
|
||||
"url": "https://opensource.org/licenses/apache2.0.php"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "mkdir -p ./build && cp /.env ./build/env"
|
||||
}
|
||||
}
|
||||
|
||||
11
cue.mod/pkg/universe.dagger.io/yarn/test/data/foo/package.json
generated
Executable file
11
cue.mod/pkg/universe.dagger.io/yarn/test/data/foo/package.json
generated
Executable file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "test",
|
||||
"main": "index.js",
|
||||
"license": {
|
||||
"type": "Apache-2.0",
|
||||
"url": "https://opensource.org/licenses/apache2.0.php"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "mkdir -p ./build && echo output > ./build/test && touch .env && cp .env ./build/"
|
||||
}
|
||||
}
|
||||
9
cue.mod/pkg/universe.dagger.io/yarn/test/test.bats
generated
Executable file
9
cue.mod/pkg/universe.dagger.io/yarn/test/test.bats
generated
Executable file
@@ -0,0 +1,9 @@
|
||||
setup() {
|
||||
load '../../bats_helpers'
|
||||
|
||||
common_setup
|
||||
}
|
||||
|
||||
@test "yarn" {
|
||||
dagger "do" test
|
||||
}
|
||||
91
cue.mod/pkg/universe.dagger.io/yarn/test/test.cue
generated
Executable file
91
cue.mod/pkg/universe.dagger.io/yarn/test/test.cue
generated
Executable file
@@ -0,0 +1,91 @@
|
||||
package yarn
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
|
||||
"universe.dagger.io/docker"
|
||||
"universe.dagger.io/yarn"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
client: filesystem: {
|
||||
"./data/foo": read: contents: dagger.#FS
|
||||
"./data/bar": read: contents: dagger.#FS
|
||||
}
|
||||
|
||||
actions: test: {
|
||||
|
||||
// Configuration for all tests
|
||||
common: {
|
||||
data: client.filesystem."./data/foo".read.contents
|
||||
}
|
||||
|
||||
// Run yarn.#Build
|
||||
simple: {
|
||||
build: yarn.#Build & {
|
||||
source: common.data
|
||||
}
|
||||
|
||||
verify: #AssertFile & {
|
||||
input: build.output
|
||||
path: "test"
|
||||
contents: "output\n"
|
||||
}
|
||||
}
|
||||
|
||||
// Run yarn.#Build with a custom name
|
||||
customName: {
|
||||
build: yarn.#Build & {
|
||||
name: "My Build"
|
||||
source: common.data
|
||||
}
|
||||
verify: #AssertFile & {
|
||||
input: build.output
|
||||
path: "test"
|
||||
contents: "output\n"
|
||||
}
|
||||
}
|
||||
|
||||
// Run yarn.#Build with a custom docker image
|
||||
customImage: {
|
||||
buildImage: docker.#Build & {
|
||||
steps: [
|
||||
docker.#Pull & {
|
||||
source: "alpine"
|
||||
},
|
||||
docker.#Run & {
|
||||
command: {
|
||||
name: "apk"
|
||||
args: ["add", "yarn", "bash"]
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
image: build.output
|
||||
|
||||
build: yarn.#Build & {
|
||||
source: common.data
|
||||
container: #input: buildImage.output
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make an assertion on the contents of a file
|
||||
#AssertFile: {
|
||||
input: dagger.#FS
|
||||
path: string
|
||||
contents: string
|
||||
|
||||
_read: core.#ReadFile & {
|
||||
"input": input
|
||||
"path": path
|
||||
}
|
||||
|
||||
actual: _read.contents
|
||||
|
||||
// Assertion
|
||||
contents: actual
|
||||
}
|
||||
Reference in New Issue
Block a user