File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,8 +3,6 @@ name: pages
33on :
44 push :
55 branches : [main]
6- release :
7- types : [published]
86 workflow_dispatch :
97
108permissions :
2523 steps :
2624 - uses : actions/checkout@v5
2725
26+ - name : Cache Rust
27+ uses : Swatinem/rust-cache@v2
28+ with :
29+ workspaces : compiler
30+
31+ - uses : dtolnay/rust-toolchain@stable
32+
33+ - name : Install wasm target
34+ run : rustup target add wasm32-unknown-unknown
35+ working-directory : compiler
36+
37+ - name : Install wasm-opt
38+ run : sudo apt-get update && sudo apt-get install -y binaryen
39+
40+ - name : Build wasm
41+ run : cargo build --target wasm32-unknown-unknown --features wasm --lib --release
42+ working-directory : compiler
43+
44+ - name : Optimize wasm
45+ run : |
46+ wasm-opt -Oz --converge --strip-debug \
47+ --enable-bulk-memory \
48+ --enable-nontrapping-float-to-int \
49+ --enable-sign-ext \
50+ -o compiler/target/wasm32-unknown-unknown/release/compiler_lib.wasm \
51+ compiler/target/wasm32-unknown-unknown/release/compiler_lib.wasm
52+
53+ - name : Stage demo
54+ run : cp compiler/target/wasm32-unknown-unknown/release/compiler_lib.wasm demo/
55+
2856 - name : Setup Pages
2957 uses : actions/configure-pages@v5
3058 with :
Original file line number Diff line number Diff line change 5656 </ div >
5757
5858 < script >
59- const WASM_URL = 'https://github.com/dylan-sutton-chavez/edge-python/releases/latest/download/compiler_lib.wasm' ;
6059 const SZ = 1 << 20 ;
6160
6261 const ed = document . getElementById ( 'ed' ) ;
6968
7069 async function loadWasm ( ) {
7170 try {
72- status . textContent = 'fetching latest wasm…' ;
73- const res = await fetch ( WASM_URL , { cache : 'no-cache' } ) ;
71+ status . textContent = 'loading wasm…' ;
72+ const res = await fetch ( './compiler_lib.wasm' ) ;
7473 if ( ! res . ok ) throw new Error ( `HTTP ${ res . status } ` ) ;
75- const bytes = await res . arrayBuffer ( ) ;
76- const { instance } = await WebAssembly . instantiate ( bytes , { } ) ;
74+ const { instance } = await WebAssembly . instantiateStreaming ( res , { } ) ;
7775 wasm = instance . exports ;
7876 btn . disabled = false ;
7977 status . textContent = 'ready' ;
You can’t perform that action at this time.
0 commit comments