1919 os : " ubuntu-latest" ,
2020 arch : " amd64" ,
2121 wasiSDK : " linux" ,
22+ extension : " " ,
2223 buildArgs : " " ,
2324 target : " " ,
2425 targetDir : " target/release" ,
2728 os : " macos-latest" ,
2829 arch : " amd64" ,
2930 wasiSDK : " macos" ,
31+ extension : " " ,
3032 buildArgs : " " ,
3133 target : " " ,
3234 targetDir : " target/release" ,
@@ -35,10 +37,20 @@ jobs:
3537 os : " macos-latest" ,
3638 arch : " aarch64" ,
3739 wasiSDK : " macos" ,
40+ extension : " " ,
3841 buildArgs : " \" --target aarch64-apple-darwin\" " ,
3942 target : " aarch64-apple-darwin" ,
4043 targetDir : " target/aarch64-apple-darwin/release/" ,
4144 }
45+ - {
46+ os : " windows-latest" ,
47+ arch : " amd64" ,
48+ wasiSDK : " " ,
49+ extension : " .exe" ,
50+ buildArgs : " " ,
51+ target : " " ,
52+ targetDir : " target/release" ,
53+ }
4254 steps :
4355 - uses : actions/checkout@v3
4456 - name : Install latest Rust stable toolchain
4961 target : ${{ matrix.config.target }}
5062
5163 - name : " Install Wasm Rust target"
64+ shell : bash
5265 run : rustup target add wasm32-wasi
5366
5467 - uses : Swatinem/rust-cache@v2
@@ -63,24 +76,44 @@ jobs:
6376 - name : Setup cmake
64776578 with :
66- cmake-version : ' 3.16 .x'
79+ cmake-version : ' 3.25 .x'
6780
68- - name : Download WASI-SDK
81+ - name : Setup WASI-SDK
82+ if : runner.os != 'Windows'
83+ shell : bash
6984 run : |
7085 cd /tmp
7186 wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sdk-16.0-${{ matrix.config.wasiSDK }}.tar.gz
7287 tar -xvf wasi-sdk-16.0-${{ matrix.config.wasiSDK }}.tar.gz
7388 sudo cp -v -r wasi-sdk-16.0 /opt/wasi-sdk
7489
90+ - name : Setup WASI-SDK on Windows
91+ if : runner.os == 'Windows'
92+ shell : bash
93+ run : |
94+ curl -kLSs https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sdk-16.0-mingw.tar.gz -o wasi-sdk-16.0-mingw.tar.gz
95+ tar -xvf wasi-sdk-16.0-mingw.tar.gz
96+ export WASI_SDK=./wasi-sdk-16.0
97+
7598 - name : Install NPM dependancies for SDK
76- run :
77- npm install --prefix crates/spin-js-engine/src/js_sdk
99+ shell : bash
100+ run : |
101+ cd crates/spin-js-engine/src/js_sdk
102+ npm install -
78103
79104 - name : Build spinjs
80- run : make BUILD_TARGET=${{ matrix.config.buildArgs }}
105+ shell : bash
106+ run : |
107+ if [ "${{ runner.os}}" == "Windows" ]; then
108+ mv wasi-sdk-16.0 wasi-sdk
109+ export WASI_SDK=$(pwd)/wasi-sdk
110+ fi
111+ echo $WASI_SDK
112+ make BUILD_TARGET=${{ matrix.config.buildArgs }}
113+
81114
82115 - name : Upload build artifact
83116 uses : actions/upload-artifact@v3
84117 with :
85118 name : spinjs-${{ runner.os }}-${{ matrix.config.arch }}
86- path : ${{ matrix.config.targetDir }}/spinjs
119+ path : ${{ matrix.config.targetDir }}/spinjs${{ matrix.config.extension }}
0 commit comments