Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add writ tests #39

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ name: CI

on:
push:
branches: [main]
branches:
- main
paths-ignore:
- '**.md'
- '**.html'
pull_request:
branches: [main]
paths-ignore:
- '**.md'
- '**.html'

# Cancel any in-flight jobs for the same PR/branch so there's only one active at a time
concurrency:
Expand All @@ -18,6 +24,19 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
with:
python-version: '3.x'
- run: pip install mypy wasmtime

- uses: actions/checkout@v3
with:
repository: singlestore-labs/writ
path: writ
- run: |
echo "$GITHUB_WORKSPACE/writ/bin" >> $GITHUB_PATH
chmod +x $GITHUB_WORKSPACE/writ/bin/writ

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
Expand All @@ -36,11 +55,6 @@ jobs:
curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sdk-16.0-linux.tar.gz -L | tar xzvf - -C $GITHUB_WORKSPACE/
echo "$GITHUB_WORKSPACE/wasi-sdk-16.0/bin" >> $GITHUB_PATH

- uses: actions/setup-python@v4
with:
python-version: '3.x'
- run: pip install mypy wasmtime

- name: Test cpp build
run: make cpp-debug cpp-release
working-directory: ./examples
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ on:
push:
paths:
- '**.md'
- '**.html'
branches:
- main
pull_request:

paths:
- '**.md'
- '**.html'
jobs:
deploy:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cpp:
echo "=====================================================" ; \
echo "Building CPP example '`basename $$D`'" ; \
echo "=====================================================" ; \
make -C $$D $(TARGET) ; \
make -C $$D $(TARGET) test; \
done

##############################################################################
Expand All @@ -40,7 +40,7 @@ rust:
echo "=====================================================" ; \
echo "Building Rust example '`basename $$D`'" ; \
echo "=====================================================" ; \
make -C $$D $(TARGET) ; \
make -C $$D $(TARGET) test; \
done

##############################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/power/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ power.wasm: gen
power.c

.PHONY: test
test: debug
test:
writ --expect 8 --wit power.wit power.wasm power-of 2 3
@echo PASS
writ --expect 1 --wit power.wit power.wasm power-of 2 0
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/split/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ split.wasm: gen
split_impl.cpp

.PHONY: test
test: debug
test:
writ \
-e '[{"str": "hello", "idx": 0}, {"str": "there", "idx": 6}, {"str": "people", "idx": 12}]' \
--wit split.wit split.wasm split-str "hello there people" " "
Expand Down
3 changes: 2 additions & 1 deletion examples/rust/dates/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ wasm:
cargo wasi build --lib $(RELFLAGS)

.PHONY: test
test: debug
test:
writ \
-e "2022-07-30" \
--wit $(MODULE).wit target/wasm32-wasi/debug/$(MODULE).wasm next-saturday \
"2022-07-23"
cargo wasi test
@echo PASS

.PHONY: clean
Expand Down
2 changes: 1 addition & 1 deletion examples/rust/echo-remote-debug/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ wasm:
cargo wasi build --lib $(RELFLAGS)

.PHONY: test
test: debug
test:
writ \
-e "hello there hello there" \
--wit $(MODULE).wit target/wasm32-wasi/debug/$(MODULE).wasm echo \
Expand Down
2 changes: 1 addition & 1 deletion examples/rust/sentimentable/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ wasm:
cargo wasi build --lib $(RELFLAGS)

.PHONY: test
test: debug
test:
writ \
-e '[{"compound": 0.5573704017131537, "positive": 0.5454545454545455, "negative": 0.0, "neutral": 0.4545454545454546 }]' \
--wit $(MODULE).wit target/wasm32-wasi/debug/$(MODULE).wasm sentimentable\
Expand Down
2 changes: 1 addition & 1 deletion examples/rust/split/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ wasm:
cargo wasi build --lib $(RELFLAGS)

.PHONY: test
test: debug
test:
writ \
-e '[{"str": "hello", "idx": 0}, {"str": "there", "idx": 6}, {"str": "people", "idx": 12}]' \
--wit $(MODULE).wit target/wasm32-wasi/debug/$(MODULE).wasm split-str \
Expand Down
2 changes: 1 addition & 1 deletion examples/rust/usergenerator-remote-debug/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ wasm:
# This function produces random output, so we can't check it against a
# standard. Instead, just verify that it runs without error.
.PHONY: test
test: debug
test:
writ --wit $(MODULE).wit target/wasm32-wasi/debug/$(MODULE).wasm gen-users 3
@echo PASS

Expand Down
2 changes: 1 addition & 1 deletion examples/rust/usergenerator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ wasm:
# This function produces random output, so we can't check it against a
# standard. Instead, just verify that it runs without error.
.PHONY: test
test: debug
test:
writ --wit $(MODULE).wit target/wasm32-wasi/debug/$(MODULE).wasm gen-users 3
@echo PASS

Expand Down