Skip to content

Commit 07c8f17

Browse files
mstrathmanclaude
andcommitted
ci: verify Windows (MinGW) and WebAssembly (emscripten) builds
Adds two CI jobs so 'runs anywhere' is backed, not asserted: - windows: MSYS2/MinGW builds the loadable DLL, builds and runs the static soak driver (the portability proof, no load_extension needed), and loads the DLL through the SQLite CLI. - wasm: emscripten compiles the soak to WebAssembly and runs it under node, proving the operations are correct in a wasm runtime. Makefile: -lm on the Windows config (MinGW math), and a soak-wasm target. The static soak is the core check on both platforms because it needs no Python (whose Windows sqlite3 often can't load extensions) and no browser. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: mstrathman <matthew.strathman@gmail.com>
1 parent 54a72d2 commit 07c8f17

2 files changed

Lines changed: 42 additions & 1 deletion

File tree

‎.github/workflows/ci.yml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,36 @@ jobs:
6666
predict-tabular.c predict-receipts.c vendor/sha256.c \
6767
vendor/sqlite3.c -o fuzz_predict -lm -lpthread -ldl
6868
./fuzz_predict -max_total_time=60 -max_len=512 fuzz/seeds
69+
70+
windows:
71+
name: windows (mingw)
72+
runs-on: windows-latest
73+
defaults:
74+
run:
75+
shell: msys2 {0}
76+
steps:
77+
- uses: actions/checkout@v4
78+
- uses: msys2/setup-msys2@v2
79+
with:
80+
msystem: MINGW64
81+
update: true
82+
install: >-
83+
mingw-w64-x86_64-gcc make curl unzip mingw-w64-x86_64-sqlite3
84+
- name: Build loadable DLL
85+
run: make loadable
86+
- name: Build + run soak (static, portability proof)
87+
run: make soak && ./dist/soak
88+
- name: Load the DLL via the SQLite CLI
89+
run: |
90+
sqlite3 ":memory:" ".load ./dist/predict0" "SELECT predict_version();"
91+
92+
wasm:
93+
name: wasm (emscripten)
94+
runs-on: ubuntu-latest
95+
steps:
96+
- uses: actions/checkout@v4
97+
- uses: mymindstorm/setup-emsdk@v14
98+
- name: Compile soak to WebAssembly
99+
run: make soak-wasm CC=emcc
100+
- name: Run under node
101+
run: node dist/soak.js

‎Makefile‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ endif
2929

3030
ifdef CONFIG_WINDOWS
3131
LOADABLE_EXTENSION=dll
32+
LDFLAGS+=-lm
3233
endif
3334

3435
CC?=gcc
@@ -111,11 +112,18 @@ test-valgrind: vendor/sqlite3ext.h sqlite-predict.h
111112
valgrind --leak-check=full --error-exitcode=9 --errors-for-leak-kinds=definite \
112113
./dist/soak-linux"
113114

114-
# standalone soak binary (used by CI valgrind, and runnable directly)
115+
# standalone soak binary (used by CI valgrind + Windows, runnable directly)
115116
soak: $(prefix) vendor/sqlite3ext.h sqlite-predict.h
116117
$(CC) -std=c99 -g -O0 -Ivendor/ -I./ -DSQLITE_CORE -DSQLITE_PREDICT_STATIC \
117118
tests/soak.c $(OBJS) vendor/sqlite3.c -o $(prefix)/soak $(LDFLAGS)
118119

120+
# WebAssembly soak (emscripten): compiles the static soak to wasm. CI runs
121+
# it under node to prove the code is wasm-portable and correct there.
122+
soak-wasm: $(prefix) vendor/sqlite3ext.h sqlite-predict.h
123+
emcc -std=c99 -O1 -Ivendor/ -I./ -DSQLITE_CORE -DSQLITE_PREDICT_STATIC \
124+
-sALLOW_MEMORY_GROWTH -sEXIT_RUNTIME=1 -sSTACK_SIZE=1048576 \
125+
tests/soak.c $(OBJS) vendor/sqlite3.c -o $(prefix)/soak.js
126+
119127
clean:
120128
rm -rf $(prefix) sqlite-predict.h
121129

0 commit comments

Comments
 (0)