From e4474cfcda507dad97a65296d300833a2b2c67d1 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Thu, 18 May 2023 15:07:24 +0200 Subject: [PATCH] feat: add base bench --- .gitignore | 2 ++ Cargo.lock | 7 +++++++ Cargo.toml | 8 ++++++++ actions/bench.go | 27 +++++++++++++++++++++++++++ actions/go.mod | 3 +++ shuttle.yaml | 3 +++ src/main.rs | 3 +++ 7 files changed, 53 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 actions/bench.go create mode 100644 actions/go.mod create mode 100644 shuttle.yaml create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..37bfa82 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +.shuttle/ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..3afe0a2 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "dagger-runtime-benchmark" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..27624f5 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "dagger-runtime-benchmark" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/actions/bench.go b/actions/bench.go new file mode 100644 index 0000000..99b3394 --- /dev/null +++ b/actions/bench.go @@ -0,0 +1,27 @@ +package main + +import ( + "context" + "log" + "os" + "os/exec" +) + +func Bench(ctx context.Context) error { + output, err := exec.Command("cargo", "build").CombinedOutput() + log.Println(string(output)) + if err != nil { + return err + } + + cmd := exec.Command("dagger", "run", "target/debug/dagger-runtime-benchmark") + cmd.Stdin = os.Stdin + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + + if err = cmd.Run(); err != nil { + return err + } + + return nil +} diff --git a/actions/go.mod b/actions/go.mod new file mode 100644 index 0000000..35201f7 --- /dev/null +++ b/actions/go.mod @@ -0,0 +1,3 @@ +module actions + +go 1.20 diff --git a/shuttle.yaml b/shuttle.yaml new file mode 100644 index 0000000..fcea998 --- /dev/null +++ b/shuttle.yaml @@ -0,0 +1,3 @@ +plan: false +vars: + service: dagger-runtime-benchmark diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +}