Adding rust
This commit is contained in:
parent
f496357522
commit
412574659d
@ -19,8 +19,7 @@ import (
|
||||
|
||||
docker.#Run & {
|
||||
input: *_image.output | docker.#Image
|
||||
workdir: "/src"
|
||||
command: name: "rust"
|
||||
workdir: _sourcePath
|
||||
mounts: "source": {
|
||||
dest: _sourcePath
|
||||
contents: source
|
||||
|
@ -9,26 +9,25 @@ import (
|
||||
// Source code
|
||||
source: dagger.#FS
|
||||
|
||||
// Target package to publish
|
||||
package: *"." | string
|
||||
|
||||
env: [string]: string
|
||||
|
||||
container: #Container & {
|
||||
"source": source
|
||||
"env": {
|
||||
env
|
||||
CARGO_TARGET_DIR: "/output/"
|
||||
}
|
||||
command: {
|
||||
args: [package]
|
||||
name: "cargo"
|
||||
flags: {
|
||||
publish: true
|
||||
"-o": "/output/"
|
||||
"build": true
|
||||
"--release": true
|
||||
"--manifest-path": "/src/Cargo.toml"
|
||||
}
|
||||
}
|
||||
export: directories: "/output": _
|
||||
}
|
||||
|
||||
// Directory containing the output of the publish
|
||||
output: container.export.directories."/output"
|
||||
output: container.export.directories."/output/target/release"
|
||||
}
|
||||
|
@ -3,12 +3,8 @@ package rust
|
||||
|
||||
// Test a rust package
|
||||
#Test: {
|
||||
// Package to test
|
||||
package: *"." | string
|
||||
|
||||
#Container & {
|
||||
command: {
|
||||
args: [package]
|
||||
flags: test: true
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
FROM rust:1.60-alpine
|
||||
|
||||
ENV CARGO_TARGET_DIR "/output/"
|
||||
|
||||
CMD cargo build --manifest-path "/src/Cargo.toml" --release
|
7
pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/data/hello/Cargo.lock
generated
Normal file
7
pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/data/hello/Cargo.lock
generated
Normal file
@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "hello_world"
|
||||
version = "0.1.0"
|
@ -0,0 +1 @@
|
||||
{"rustc_fingerprint":6791022512809778958,"outputs":{"931469667778813386":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.a\nlib___.so\n/usr/local/rustup/toolchains/1.60.0-aarch64-unknown-linux-musl\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"musl\"\ntarget_family=\"unix\"\ntarget_has_atomic=\"128\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":"warning: dropping unsupported crate type `dylib` for target `aarch64-unknown-linux-musl`\n\nwarning: dropping unsupported crate type `cdylib` for target `aarch64-unknown-linux-musl`\n\nwarning: 2 warnings emitted\n\n"},"5309432699494263626":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.a\nlib___.so\n","stderr":"{\"message\":\"dropping unsupported crate type `dylib` for target `aarch64-unknown-linux-musl`\",\"code\":null,\"level\":\"warning\",\"spans\":[],\"children\":[],\"rendered\":\"warning: dropping unsupported crate type `dylib` for target `aarch64-unknown-linux-musl`\\n\\n\"}\n{\"message\":\"dropping unsupported crate type `cdylib` for target `aarch64-unknown-linux-musl`\",\"code\":null,\"level\":\"warning\",\"spans\":[],\"children\":[],\"rendered\":\"warning: dropping unsupported crate type `cdylib` for target `aarch64-unknown-linux-musl`\\n\\n\"}\n{\"message\":\"2 warnings emitted\",\"code\":null,\"level\":\"warning\",\"spans\":[],\"children\":[],\"rendered\":\"warning: 2 warnings emitted\\n\\n\"}\n"},"2797684049618456168":{"success":false,"status":"exit status: 1","code":1,"stdout":"","stderr":"error: `-Csplit-debuginfo` is unstable on this platform\n\n"},"17598535894874457435":{"success":true,"status":"","code":0,"stdout":"rustc 1.60.0 (7737e0b5c 2022-04-04)\nbinary: rustc\ncommit-hash: 7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\ncommit-date: 2022-04-04\nhost: aarch64-unknown-linux-musl\nrelease: 1.60.0\nLLVM version: 14.0.0\n","stderr":""}},"successes":{}}
|
@ -0,0 +1 @@
|
||||
b2e13b44d430fdf9
|
@ -0,0 +1 @@
|
||||
{"rustc":9685964557043657374,"features":"[]","target":6051735750501971553,"profile":6269190295429226618,"path":1684066648322511884,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"release/.fingerprint/hello_world-12d244dedbde71e2/dep-bin-hello_world"}}],"rustflags":[],"metadata":7797948686568424061,"config":2202906307356721367,"compile_kind":0}
|
Binary file not shown.
@ -0,0 +1 @@
|
||||
This file has an mtime of when this was started.
|
Binary file not shown.
@ -0,0 +1,5 @@
|
||||
/output/release/deps/hello_world-12d244dedbde71e2: src/main.rs
|
||||
|
||||
/output/release/deps/hello_world-12d244dedbde71e2.d: src/main.rs
|
||||
|
||||
src/main.rs:
|
BIN
pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/hello_world
Executable file
BIN
pkg/universe.dagger.io/x/contact@kjuulh.io/rust/test/output/release/hello_world
Executable file
Binary file not shown.
@ -0,0 +1 @@
|
||||
/output/release/hello_world: /src/src/main.rs
|
@ -2,57 +2,51 @@ package rust
|
||||
|
||||
import (
|
||||
"dagger.io/dagger"
|
||||
"dagger.io/dagger/core"
|
||||
// "dagger.io/dagger/core"
|
||||
"universe.dagger.io/x/contact@kjuulh.io/rust"
|
||||
"universe.dagger.io/docker"
|
||||
// "universe.dagger.io/docker"
|
||||
"universe.dagger.io/alpine"
|
||||
)
|
||||
|
||||
dagger.#Plan & {
|
||||
client: filesystem: "./data/hello_world": read: contents: dagger.#FS
|
||||
client: {
|
||||
filesystem: {
|
||||
".": {
|
||||
read: {
|
||||
contents: dagger.#FS
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actions: test: {
|
||||
_baseImage: {
|
||||
build: alpine.#Build & {
|
||||
packages: {
|
||||
"ca-certificates": {}
|
||||
"krb5-libs": {}
|
||||
libgcc: {}
|
||||
libintl: {}
|
||||
"libssl1.1": {}
|
||||
"libstdc++": {}
|
||||
zlib: {}
|
||||
}
|
||||
}
|
||||
output: build.output
|
||||
}
|
||||
actions: {
|
||||
test: {
|
||||
_baseImage: alpine.#Build
|
||||
|
||||
simple: {
|
||||
publish: rust.#Publish & {
|
||||
source: client.filesystem."./data".read.contents
|
||||
package: "hello"
|
||||
source: client.filesystem.".".read.contents
|
||||
}
|
||||
|
||||
exec: docker.#Run & {
|
||||
input: _baseImage.output
|
||||
command: {
|
||||
name: "/bin/sh"
|
||||
args: ["-c", "/app/hello_world >> /output.txt"]
|
||||
}
|
||||
env: NAME: "dagger"
|
||||
mounts: binary: {
|
||||
dest: "/app"
|
||||
contents: publish.output
|
||||
source: "/"
|
||||
}
|
||||
}
|
||||
// exec: docker.#Run & {
|
||||
// input: _baseImage.output
|
||||
// command: {
|
||||
// name: "/bin/sh"
|
||||
// args: ["-c", "/app/hello_world >> /output.txt"]
|
||||
// }
|
||||
// env: NAME: "dagger"
|
||||
// mounts: binary: {
|
||||
// dest: "/app"
|
||||
// contents: publish.output
|
||||
// source: "/"
|
||||
// }
|
||||
// }
|
||||
|
||||
verify: core.#ReadFile & {
|
||||
input: exec.output.rootfs
|
||||
path: "/output.txt"
|
||||
} & {
|
||||
contents: "Hi dagger!"
|
||||
}
|
||||
}
|
||||
// verify: core.#ReadFile & {
|
||||
// input: exec.output.rootfs
|
||||
// path: "/output.txt"
|
||||
// } & {
|
||||
// contents: "Hi dagger!"
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user