Skip to content

Commit e647c54

Browse files
author
Bailey Hayes
committed
ci: add writ tests
- changed make target for test to depend on a wasm module. That way we can test both release and debug in the CI. - If I spied rust unit tests, I added those to the make target. We could also consider gtests for C++ examples in the future. - only run pages when files change
1 parent c8ada79 commit e647c54

File tree

11 files changed

+36
-18
lines changed

11 files changed

+36
-18
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@ name: CI
22

33
on:
44
push:
5-
branches: [main]
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '**.md'
9+
- '**.html'
610
pull_request:
7-
branches: [main]
11+
paths-ignore:
12+
- '**.md'
13+
- '**.html'
814

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

27+
- uses: actions/setup-python@v4
28+
with:
29+
python-version: '3.x'
30+
- run: pip install mypy wasmtime
31+
32+
- uses: actions/checkout@v3
33+
with:
34+
repository: singlestore-labs/writ
35+
path: writ
36+
- run: |
37+
echo "$GITHUB_WORKSPACE/writ/bin" >> $GITHUB_PATH
38+
chmod +x $GITHUB_WORKSPACE/writ/bin/writ
39+
2140
- uses: actions-rs/toolchain@v1
2241
with:
2342
toolchain: stable
@@ -36,11 +55,6 @@ jobs:
3655
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/
3756
echo "$GITHUB_WORKSPACE/wasi-sdk-16.0/bin" >> $GITHUB_PATH
3857
39-
- uses: actions/setup-python@v4
40-
with:
41-
python-version: '3.x'
42-
- run: pip install mypy wasmtime
43-
4458
- name: Test cpp build
4559
run: make cpp-debug cpp-release
4660
working-directory: ./examples

.github/workflows/gh-pages.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ on:
44
push:
55
paths:
66
- '**.md'
7+
- '**.html'
78
branches:
89
- main
910
pull_request:
10-
11+
paths:
12+
- '**.md'
13+
- '**.html'
1114
jobs:
1215
deploy:
1316
runs-on: ubuntu-latest

examples/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ cpp:
2121
echo "=====================================================" ; \
2222
echo "Building CPP example '`basename $$D`'" ; \
2323
echo "=====================================================" ; \
24-
make -C $$D $(TARGET) ; \
24+
make -C $$D $(TARGET) test; \
2525
done
2626

2727
##############################################################################
@@ -40,7 +40,7 @@ rust:
4040
echo "=====================================================" ; \
4141
echo "Building Rust example '`basename $$D`'" ; \
4242
echo "=====================================================" ; \
43-
make -C $$D $(TARGET) ; \
43+
make -C $$D $(TARGET) test; \
4444
done
4545

4646
##############################################################################

examples/cpp/power/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ power.wasm: gen
1616
power.c
1717

1818
.PHONY: test
19-
test: debug
19+
test: power.wasm
2020
writ --expect 8 --wit power.wit power.wasm power-of 2 3
2121
@echo PASS
2222
writ --expect 1 --wit power.wit power.wasm power-of 2 0

examples/cpp/split/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ split.wasm: gen
1717
split_impl.cpp
1818

1919
.PHONY: test
20-
test: debug
20+
test: split.wasm
2121
writ \
2222
-e '[{"str": "hello", "idx": 0}, {"str": "there", "idx": 6}, {"str": "people", "idx": 12}]' \
2323
--wit split.wit split.wasm split-str "hello there people" " "

examples/rust/dates/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ wasm:
1414
cargo wasi build --lib $(RELFLAGS)
1515

1616
.PHONY: test
17-
test: debug
17+
test: wasm
1818
writ \
1919
-e "2022-07-30" \
2020
--wit $(MODULE).wit target/wasm32-wasi/debug/$(MODULE).wasm next-saturday \
2121
"2022-07-23"
22+
cargo wasi test
2223
@echo PASS
2324

2425
.PHONY: clean

examples/rust/echo-remote-debug/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ wasm:
1414
cargo wasi build --lib $(RELFLAGS)
1515

1616
.PHONY: test
17-
test: debug
17+
test: wasm
1818
writ \
1919
-e "hello there hello there" \
2020
--wit $(MODULE).wit target/wasm32-wasi/debug/$(MODULE).wasm echo \

examples/rust/sentimentable/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ wasm:
1414
cargo wasi build --lib $(RELFLAGS)
1515

1616
.PHONY: test
17-
test: debug
17+
test: wasm
1818
writ \
1919
-e '[{"compound": 0.5573704017131537, "positive": 0.5454545454545455, "negative": 0.0, "neutral": 0.4545454545454546 }]' \
2020
--wit $(MODULE).wit target/wasm32-wasi/debug/$(MODULE).wasm sentimentable\

examples/rust/split/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ wasm:
1414
cargo wasi build --lib $(RELFLAGS)
1515

1616
.PHONY: test
17-
test: debug
17+
test: wasm
1818
writ \
1919
-e '[{"str": "hello", "idx": 0}, {"str": "there", "idx": 6}, {"str": "people", "idx": 12}]' \
2020
--wit $(MODULE).wit target/wasm32-wasi/debug/$(MODULE).wasm split-str \

examples/rust/usergenerator-remote-debug/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ wasm:
1616
# This function produces random output, so we can't check it against a
1717
# standard. Instead, just verify that it runs without error.
1818
.PHONY: test
19-
test: debug
19+
test: wasm
2020
writ --wit $(MODULE).wit target/wasm32-wasi/debug/$(MODULE).wasm gen-users 3
2121
@echo PASS
2222

0 commit comments

Comments
 (0)