diff --git a/Taskfile.yml b/Taskfile.yml index a48f5d97..3f2b8384 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -56,7 +56,7 @@ tasks: RUNTIME="{{.BASEIMG}}/runtime-{{.RT}}-{{.VER}}:{{.TAG}}" if test -n "{{.PUSH}}" then {{.DRY}} docker buildx build -t "$RUNTIME" --build-arg COMMON="{{.COMMON}}" --platform linux/amd64,linux/arm64 . --push - else {{.DRY}} docker buildx build -t "$RUNTIME" --build-arg COMMON="{{.COMMON}}" . --load + else {{.DRY}} docker buildx build -t "$RUNTIME" --build-arg COMMON="{{.COMMON}}" . --push fi echo "Built $RUNTIME" @@ -76,6 +76,7 @@ tasks: - task: docker-login - task build-lang RT=golang - task build-lang RT=python + - task build-lang RT=nodejs run-runtime: requires: { vars: [RT, VER] } @@ -99,3 +100,10 @@ tasks: desc: run a command, provide a jons with '-- ' cmds: - nuv ide run J={{.CLI_ARGS}} + + test-runtime: + requires: { vars: [RT, VER] } + dir: "runtime/{{.RT}}/{{.VER}}" + cmds: + - docker run -p 8080:8080 -d --name=test-runtime "{{.BASEIMG}}/runtime-{{.RT}}-{{.VER}}:{{.TAG}}" + - nuv init A={{.RT}}/{{.ITEM}} diff --git a/packages/nodejs/hello.js b/packages/nodejs/hello.js index 1425d22a..4e26a86e 100644 --- a/packages/nodejs/hello.js +++ b/packages/nodejs/hello.js @@ -1,7 +1,8 @@ //--web true -//--kind nodejs:default +//--docker ghcr.io/nuvolaris/runtime-nodejs-v21:3.1.0-mastrogpt.2402201748 function main(args) { let name = args.name || "world" return { body: `Hello, ${name}` } } + diff --git a/packages/nodejs/multifile/hello.js b/packages/nodejs/multifile/hello.js index 1df0d006..5248baf9 100644 --- a/packages/nodejs/multifile/hello.js +++ b/packages/nodejs/multifile/hello.js @@ -1,6 +1,6 @@ -function hello() { - return "hello world" +function hello(args) { + let name = args.name || "world". + return `Hello, ${name}.` } -module.exports = hello - +module.exports = hello \ No newline at end of file diff --git a/packages/nodejs/multifile/index.js b/packages/nodejs/multifile/index.js index e08dd6cb..db6b17a2 100644 --- a/packages/nodejs/multifile/index.js +++ b/packages/nodejs/multifile/index.js @@ -1,5 +1,6 @@ //--web true -//--kind nodejs:default +//--docker ghcr.io/nuvolaris/runtime-nodejs-v21:3.1.0-mastrogpt.2402201748 + const hello = require("./hello") @@ -9,4 +10,4 @@ function main(args) { } } -module.exports = main +module.exports = main \ No newline at end of file diff --git a/packages/nodejs/withreqs/index.js b/packages/nodejs/withreqs/index.js index f715c011..5f08b53a 100644 --- a/packages/nodejs/withreqs/index.js +++ b/packages/nodejs/withreqs/index.js @@ -1,10 +1,12 @@ //--web true -//--kind nodejs:default +//--docker ghcr.io/nuvolaris/runtime-nodejs-v21:3.1.0-mastrogpt.2402201748 + const marked = require("marked"); function main(args) { - let text = `# Welcome\n\nHello, *world*.` + let name = args.name || "world". + let text = `# Welcome\n\nHello, ${name}.` return { body: marked.parse(text) } diff --git a/packages/python/multifile/__main__.py b/packages/python/multifile/__main__.py index 9ad72281..aa3a6387 100644 --- a/packages/python/multifile/__main__.py +++ b/packages/python/multifile/__main__.py @@ -5,5 +5,5 @@ def main(args): return { - "body": hello.hello() + "body": hello.hello(args) } \ No newline at end of file diff --git a/packages/python/multifile/hello.py b/packages/python/multifile/hello.py index c0a82a05..167c29aa 100644 --- a/packages/python/multifile/hello.py +++ b/packages/python/multifile/hello.py @@ -1,2 +1,3 @@ -def hello(): - return "hello world" \ No newline at end of file +def hello(args): + name = args.get("name", "world") + return "Hello, f{name}." \ No newline at end of file diff --git a/packages/python/withreqs/__main__.py b/packages/python/withreqs/__main__.py index e2fac284..38265bc5 100644 --- a/packages/python/withreqs/__main__.py +++ b/packages/python/withreqs/__main__.py @@ -4,7 +4,8 @@ import htmlgenerator as hg def main(args): - page = hg.HTML(hg.HEAD(), hg.BODY(hg.H1("Hello, world"))) + name = args.get("name", "world") + page = hg.HTML(hg.HEAD(), hg.BODY(hg.H1(f"Hello, {name}."))) return { "body": hg.render(page, {}) } \ No newline at end of file diff --git a/runtime/python/v3.12/requirements_common.txt b/runtime/python/v3.12/requirements_common.txt index 1eedfcb3..eb029ee3 100644 --- a/runtime/python/v3.12/requirements_common.txt +++ b/runtime/python/v3.12/requirements_common.txt @@ -8,7 +8,7 @@ scrapy==2.5.0 simplejson==3.17.5 twisted==21.7.0 netifaces==0.11.0 -pyyaml==6.0 +pyyaml==6.0.1 redis==4.4.2 boto3==1.28.25 psycopg==3.1.10 diff --git a/packages/common/hello.sh b/tests/common/hello.sh similarity index 100% rename from packages/common/hello.sh rename to tests/common/hello.sh diff --git a/packages/common/standalone/build.sh b/tests/common/standalone/build.sh similarity index 100% rename from packages/common/standalone/build.sh rename to tests/common/standalone/build.sh diff --git a/packages/common/standalone/exec.go b/tests/common/standalone/exec.go similarity index 100% rename from packages/common/standalone/exec.go rename to tests/common/standalone/exec.go diff --git a/packages/golang/hello.go b/tests/golang/hello.go similarity index 100% rename from packages/golang/hello.go rename to tests/golang/hello.go diff --git a/packages/golang/multifile/go.mod b/tests/golang/multifile/go.mod similarity index 100% rename from packages/golang/multifile/go.mod rename to tests/golang/multifile/go.mod diff --git a/packages/golang/multifile/hello.go b/tests/golang/multifile/hello.go similarity index 100% rename from packages/golang/multifile/hello.go rename to tests/golang/multifile/hello.go diff --git a/packages/golang/multifile/hello_test.go b/tests/golang/multifile/hello_test.go similarity index 100% rename from packages/golang/multifile/hello_test.go rename to tests/golang/multifile/hello_test.go diff --git a/packages/golang/multifile/main.go b/tests/golang/multifile/main.go similarity index 100% rename from packages/golang/multifile/main.go rename to tests/golang/multifile/main.go diff --git a/packages/golang/withreqs/main.go b/tests/golang/withreqs/main.go similarity index 100% rename from packages/golang/withreqs/main.go rename to tests/golang/withreqs/main.go diff --git a/packages/golang/withreqs/main_test.go b/tests/golang/withreqs/main_test.go similarity index 100% rename from packages/golang/withreqs/main_test.go rename to tests/golang/withreqs/main_test.go diff --git a/packages/java/Hello.java b/tests/java/Hello.java similarity index 100% rename from packages/java/Hello.java rename to tests/java/Hello.java