-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add test runs for examples * Add mypy linting
- Loading branch information
Showing
10 changed files
with
159 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
export COMPONENTIZE_PY_TEST_COUNT=0 | ||
export COMPONENTIZE_PY_TEST_SEED=bc6ad1950594f1fe477144ef5b3669dd5962e49de4f3b666e5cbf9072507749a | ||
export WASMTIME_BACKTRACE_DETAILS=1 | ||
|
||
cargo build --release | ||
|
||
# CLI | ||
(cd examples/cli \ | ||
&& rm -rf command || true \ | ||
&& ../../target/release/componentize-py -d ../../wit -w wasi:cli/[email protected] bindings . \ | ||
&& mypy --strict .) | ||
|
||
# HTTP | ||
# poll_loop.py has many errors that might not be worth adjusting at the moment, so ignore for now | ||
(cd examples/http \ | ||
&& rm -rf proxy || true \ | ||
&& ../../target/release/componentize-py -d ../../wit -w wasi:http/[email protected] bindings . \ | ||
&& mypy --strict --ignore-missing-imports -m app -p proxy) | ||
|
||
# # Matrix Math | ||
(cd examples/matrix-math \ | ||
&& rm -rf matrix_math || true \ | ||
&& curl -OL https://github.com/dicej/wasi-wheels/releases/download/v0.0.1/numpy-wasi.tar.gz \ | ||
&& tar xf numpy-wasi.tar.gz \ | ||
&& ../../target/release/componentize-py -d ../../wit -w matrix-math bindings . \ | ||
&& mypy --strict --follow-imports silent -m app -p matrix_math) | ||
|
||
# Sandbox | ||
(cd examples/sandbox \ | ||
&& rm -rf sandbox || true \ | ||
&& ../../target/release/componentize-py -d sandbox.wit bindings . \ | ||
&& mypy --strict -m guest -p sandbox) | ||
|
||
# TCP | ||
(cd examples/tcp \ | ||
&& rm -rf command || true \ | ||
&& ../../target/release/componentize-py -d ../../wit -w wasi:cli/[email protected] bindings . \ | ||
&& mypy --strict .) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
export COMPONENTIZE_PY_TEST_COUNT=0 | ||
export COMPONENTIZE_PY_TEST_SEED=bc6ad1950594f1fe477144ef5b3669dd5962e49de4f3b666e5cbf9072507749a | ||
export WASMTIME_BACKTRACE_DETAILS=1 | ||
|
||
cargo build --release | ||
|
||
# CLI | ||
(cd examples/cli \ | ||
&& ../../target/release/componentize-py -d ../../wit -w wasi:cli/[email protected] componentize app -o cli.wasm \ | ||
&& wasmtime run cli.wasm) | ||
|
||
# HTTP | ||
# Just compiling for now | ||
(cd examples/http \ | ||
&& ../../target/release/componentize-py -d ../../wit -w wasi:http/[email protected] componentize app -o http.wasm) | ||
|
||
# Matrix Math | ||
(cd examples/matrix-math \ | ||
&& curl -OL https://github.com/dicej/wasi-wheels/releases/download/v0.0.1/numpy-wasi.tar.gz \ | ||
&& tar xf numpy-wasi.tar.gz \ | ||
&& ../../target/release/componentize-py -d ../../wit -w matrix-math componentize app -o matrix-math.wasm \ | ||
&& wasmtime run matrix-math.wasm '[[1, 2], [4, 5], [6, 7]]' '[[1, 2, 3], [4, 5, 6]]') | ||
|
||
# Sandbox | ||
(cd examples/sandbox \ | ||
&& ../../target/release/componentize-py -d sandbox.wit componentize --stub-wasi guest -o sandbox.wasm \ | ||
&& python -m wasmtime.bindgen sandbox.wasm --out-dir sandbox \ | ||
&& python host.py "2 + 2") | ||
|
||
# TCP | ||
# Just compiling for now | ||
(cd examples/tcp \ | ||
&& ../../target/release/componentize-py -d ../../wit -w wasi:cli/[email protected] componentize app -o tcp.wasm) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
from command import exports | ||
|
||
|
||
class Run(exports.Run): | ||
def run(self): | ||
def run(self) -> None: | ||
print("Hello, world!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters