Adding rust
This commit is contained in:
parent
f496357522
commit
412574659d
@ -19,8 +19,7 @@ import (
|
|||||||
|
|
||||||
docker.#Run & {
|
docker.#Run & {
|
||||||
input: *_image.output | docker.#Image
|
input: *_image.output | docker.#Image
|
||||||
workdir: "/src"
|
workdir: _sourcePath
|
||||||
command: name: "rust"
|
|
||||||
mounts: "source": {
|
mounts: "source": {
|
||||||
dest: _sourcePath
|
dest: _sourcePath
|
||||||
contents: source
|
contents: source
|
||||||
|
@ -9,26 +9,25 @@ import (
|
|||||||
// Source code
|
// Source code
|
||||||
source: dagger.#FS
|
source: dagger.#FS
|
||||||
|
|
||||||
// Target package to publish
|
|
||||||
package: *"." | string
|
|
||||||
|
|
||||||
env: [string]: string
|
env: [string]: string
|
||||||
|
|
||||||
container: #Container & {
|
container: #Container & {
|
||||||
"source": source
|
"source": source
|
||||||
"env": {
|
"env": {
|
||||||
env
|
env
|
||||||
|
CARGO_TARGET_DIR: "/output/"
|
||||||
}
|
}
|
||||||
command: {
|
command: {
|
||||||
args: [package]
|
name: "cargo"
|
||||||
flags: {
|
flags: {
|
||||||
publish: true
|
"build": true
|
||||||
"-o": "/output/"
|
"--release": true
|
||||||
|
"--manifest-path": "/src/Cargo.toml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export: directories: "/output": _
|
export: directories: "/output": _
|
||||||
}
|
}
|
||||||
|
|
||||||
// Directory containing the output of the publish
|
// 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 a rust package
|
||||||
#Test: {
|
#Test: {
|
||||||
// Package to test
|
|
||||||
package: *"." | string
|
|
||||||
|
|
||||||
#Container & {
|
#Container & {
|
||||||
command: {
|
command: {
|
||||||
args: [package]
|
|
||||||
flags: test: true
|
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 (
|
import (
|
||||||
"dagger.io/dagger"
|
"dagger.io/dagger"
|
||||||
"dagger.io/dagger/core"
|
// "dagger.io/dagger/core"
|
||||||
"universe.dagger.io/x/contact@kjuulh.io/rust"
|
"universe.dagger.io/x/contact@kjuulh.io/rust"
|
||||||
"universe.dagger.io/docker"
|
// "universe.dagger.io/docker"
|
||||||
"universe.dagger.io/alpine"
|
"universe.dagger.io/alpine"
|
||||||
)
|
)
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
client: filesystem: "./data/hello_world": read: contents: dagger.#FS
|
client: {
|
||||||
|
filesystem: {
|
||||||
|
".": {
|
||||||
|
read: {
|
||||||
|
contents: dagger.#FS
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
actions: test: {
|
actions: {
|
||||||
_baseImage: {
|
test: {
|
||||||
build: alpine.#Build & {
|
_baseImage: alpine.#Build
|
||||||
packages: {
|
|
||||||
"ca-certificates": {}
|
|
||||||
"krb5-libs": {}
|
|
||||||
libgcc: {}
|
|
||||||
libintl: {}
|
|
||||||
"libssl1.1": {}
|
|
||||||
"libstdc++": {}
|
|
||||||
zlib: {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
output: build.output
|
|
||||||
}
|
|
||||||
|
|
||||||
simple: {
|
|
||||||
publish: rust.#Publish & {
|
publish: rust.#Publish & {
|
||||||
source: client.filesystem."./data".read.contents
|
source: client.filesystem.".".read.contents
|
||||||
package: "hello"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exec: docker.#Run & {
|
// exec: docker.#Run & {
|
||||||
input: _baseImage.output
|
// input: _baseImage.output
|
||||||
command: {
|
// command: {
|
||||||
name: "/bin/sh"
|
// name: "/bin/sh"
|
||||||
args: ["-c", "/app/hello_world >> /output.txt"]
|
// args: ["-c", "/app/hello_world >> /output.txt"]
|
||||||
}
|
// }
|
||||||
env: NAME: "dagger"
|
// env: NAME: "dagger"
|
||||||
mounts: binary: {
|
// mounts: binary: {
|
||||||
dest: "/app"
|
// dest: "/app"
|
||||||
contents: publish.output
|
// contents: publish.output
|
||||||
source: "/"
|
// source: "/"
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
verify: core.#ReadFile & {
|
// verify: core.#ReadFile & {
|
||||||
input: exec.output.rootfs
|
// input: exec.output.rootfs
|
||||||
path: "/output.txt"
|
// path: "/output.txt"
|
||||||
} & {
|
// } & {
|
||||||
contents: "Hi dagger!"
|
// contents: "Hi dagger!"
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user