Skip to content

Instantly share code, notes, and snippets.

@goujonbe
Last active May 26, 2022 06:30
Show Gist options
  • Save goujonbe/d8a835045d6cb6624699989f70367570 to your computer and use it in GitHub Desktop.
Save goujonbe/d8a835045d6cb6624699989f70367570 to your computer and use it in GitHub Desktop.
package ci
import (
"dagger.io/dagger"
"universe.dagger.io/bash" // import this package to execute bash commands inside a docker container
"universe.dagger.io/docker" // import this package to set up docker
)
dagger.#Plan & {
// configure the client so that dagger takes only the files it needs
client: filesystem: "./": read: {
contents: dagger.#FS
exclude: [
"README.md",
"ci.cue",
"Vagrantfile",
"target/",
".vagrant/",
]
}
actions: {
// pull the official rust image and copy my code
deps: docker.#Build & {
steps: [
docker.#Pull & {
source: "rust:1.61.0"
},
docker.#Copy & {
contents: client.filesystem."./".read.contents
dest: "/src"
},
]
}
// run the test suite inside the docker container
test: bash.#Run & {
input: deps.output
workdir: "/src"
script: contents: #"""
cargo test
"""#
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment