Skip to content

Commit

Permalink
📦 create release v0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
k33g committed Aug 15, 2023
1 parent aa83f56 commit 43c2221
Show file tree
Hide file tree
Showing 98 changed files with 5,232 additions and 116 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ aiven.sh
deploy
release
slingshot-server/tmp
tmp
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"workbench.iconTheme": "material-icon-theme",
"workbench.colorTheme": "GitHub Light Monochrome Focused",
"workbench.colorTheme": "GitHub Light Default",
"terminal.integrated.fontSize": 14,
"editor.fontSize": 14,
"files.autoSave": "afterDelay",
Expand Down
2 changes: 2 additions & 0 deletions 00-hello-go/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.wasm
slingshot
38 changes: 38 additions & 0 deletions 00-hello-go/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3'

description: >
task slingshot-build
task wasm-build
task wasm-run
tasks:
# task slingshot-build
slingshot-build:
cmds:
- |
target=$(pwd)
cd ../slingshot-server
env CGO_ENABLED=0 go build -ldflags="-s -w" -o ${target}/slingshot
# task wasm-build
wasm-build:
cmds:
- |
tinygo build -scheduler=none --no-debug \
-o hello.wasm \
-target wasi main.go
ls -lh *.wasm
# task wasm-run
wasm-run:
cmds:
- |
./slingshot cli --wasm=./hello.wasm --handler=hello --input="Bob 🤓"
# task all
all:
cmds:
- task slingshot-build
- task wasm-build
- task wasm-run
3 changes: 3 additions & 0 deletions 00-hello-go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module hello

go 1.20
18 changes: 18 additions & 0 deletions 00-hello-go/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main

import (
"github.com/extism/go-pdk"
)

//export hello
func hello() {
// read function argument from the shared memory
input := pdk.Input()
output := "👋 Hello " + string(input)

// copy output to shared memory
mem := pdk.AllocateString(output)
pdk.OutputMemory(mem)
}

func main() {}
2 changes: 2 additions & 0 deletions 00-hello-rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.wasm
slingshot*
185 changes: 185 additions & 0 deletions 00-hello-rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions 00-hello-rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[package]
name = "hello"
version = "0.1.0"
edition = "2021"

[lib]
crate_type = ["cdylib"]

[dependencies]
extism-pdk = "0.3.3"
38 changes: 38 additions & 0 deletions 00-hello-rust/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3'

description: >
task slingshot-build
task wasm-build
task wasm-run
tasks:
# task slingshot-build
slingshot-build:
cmds:
- |
target=$(pwd)
cd ../slingshot-server
env CGO_ENABLED=0 go build -ldflags="-s -w" -o ${target}/slingshot
# task wasm-build
wasm-build:
cmds:
- |
cargo clean
cargo build --release --target wasm32-wasi #--offline
# ls -lh *.wasm
ls -lh ./target/wasm32-wasi/release/*.wasm
cp ./target/wasm32-wasi/release/*.wasm .
# task wasm-run
wasm-run:
cmds:
- |
./slingshot cli --wasm=./hello.wasm --handler=hello --input="Bob 🤓"
# task all
all:
cmds:
- task slingshot-build
- task wasm-build
- task wasm-run
9 changes: 9 additions & 0 deletions 00-hello-rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use extism_pdk::*;

#[plugin_fn]
pub fn hello(input: String) -> FnResult<String> {

let output : String = "👋 Hello ".to_string() + &input;

Ok(output)
}
1 change: 1 addition & 0 deletions 00-hello-rust/target/.rustc_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc_fingerprint":15056852261292534572,"outputs":{"15729799797837862367":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/k33g/.rustup/toolchains/stable-aarch64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_arch=\"aarch64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"neon\"\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":""},"17351682911112135739":{"success":true,"status":"","code":0,"stdout":"___.wasm\nlib___.rlib\n___.wasm\nlib___.a\n/home/k33g/.rustup/toolchains/stable-aarch64-unknown-linux-gnu\noff\n___\ndebug_assertions\npanic=\"abort\"\nproc_macro\ntarget_arch=\"wasm32\"\ntarget_endian=\"little\"\ntarget_env=\"\"\ntarget_family=\"wasm\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"wasi\"\ntarget_pointer_width=\"32\"\ntarget_vendor=\"unknown\"\n","stderr":"warning: dropping unsupported crate type `dylib` for target `wasm32-wasi`\n\nwarning: dropping unsupported crate type `proc-macro` for target `wasm32-wasi`\n\nwarning: 2 warnings emitted\n\n"},"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.71.1 (eb26296b5 2023-08-03)\nbinary: rustc\ncommit-hash: eb26296b556cef10fb713a38f3d16b9886080f26\ncommit-date: 2023-08-03\nhost: aarch64-unknown-linux-gnu\nrelease: 1.71.1\nLLVM version: 16.0.5\n","stderr":""}},"successes":{}}
3 changes: 3 additions & 0 deletions 00-hello-rust/target/CACHEDIR.TAG
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/
3 changes: 3 additions & 0 deletions 00-hello-rust/target/wasm32-wasi/CACHEDIR.TAG
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/
2 changes: 2 additions & 0 deletions 00-print-go/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.wasm
slingshot
38 changes: 38 additions & 0 deletions 00-print-go/Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3'

description: >
task slingshot-build
task wasm-build
task wasm-run
tasks:
# task slingshot-build
slingshot-build:
cmds:
- |
target=$(pwd)
cd ../slingshot-server
env CGO_ENABLED=0 go build -ldflags="-s -w" -o ${target}/slingshot
# task wasm-build
wasm-build:
cmds:
- |
tinygo build -scheduler=none --no-debug \
-o print.wasm \
-target wasi main.go
ls -lh *.wasm
# task wasm-run
wasm-run:
cmds:
- |
./slingshot cli --wasm=./print.wasm --handler=hello --input="🤓 I'm a geek"
# task all
all:
cmds:
- task slingshot-build
- task wasm-build
- task wasm-run
3 changes: 3 additions & 0 deletions 00-print-go/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module print

go 1.20
Loading

0 comments on commit 43c2221

Please sign in to comment.