File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed
Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build WebAssembly Hello World
2+
3+ on :
4+ push :
5+ branches : ["main"]
6+ pull_request :
7+ branches : ["main"]
8+
9+ jobs :
10+ build :
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ - name : Check out repository
15+ uses : actions/checkout@v4
16+
17+ - name : Download wasi-sdk
18+ run : |
19+ WASI_VERSION=20.0
20+ WASI_RELEASE="wasi-sdk-${WASI_VERSION}"
21+ WASI_PACKAGE="${WASI_RELEASE}-linux.tar.xz"
22+ curl -L "https://github.com/WebAssembly/wasi-sdk/releases/download/${WASI_RELEASE}/${WASI_PACKAGE}" -o wasi-sdk.tar.xz
23+ tar -xJf wasi-sdk.tar.xz
24+ mv "${WASI_RELEASE}" wasi-sdk
25+
26+ - name : Compile C89 hello world to WebAssembly
27+ run : |
28+ ./wasi-sdk/bin/clang \
29+ --sysroot=./wasi-sdk/share/wasi-sysroot \
30+ -std=c89 \
31+ wasm/hello.c \
32+ -o wasm/hello.wasm
33+
34+ - name : Upload WebAssembly artifact
35+ uses : actions/upload-artifact@v4
36+ with :
37+ name : hello-wasm
38+ path : wasm/hello.wasm
Original file line number Diff line number Diff line change 1+ #include <stdio.h>
2+
3+ int main (void )
4+ {
5+ printf ("Hello, world!\n" );
6+ return 0 ;
7+ }
You can’t perform that action at this time.
0 commit comments