-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (32 loc) · 1013 Bytes
/
build-wasm.yml
File metadata and controls
38 lines (32 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: Build WebAssembly Hello World
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Download wasi-sdk
run: |
WASI_VERSION=20.0
WASI_RELEASE="wasi-sdk-${WASI_VERSION}"
WASI_PACKAGE="${WASI_RELEASE}-linux.tar.xz"
curl -L "https://github.com/WebAssembly/wasi-sdk/releases/download/${WASI_RELEASE}/${WASI_PACKAGE}" -o wasi-sdk.tar.xz
tar -xJf wasi-sdk.tar.xz
mv "${WASI_RELEASE}" wasi-sdk
- name: Compile C89 hello world to WebAssembly
run: |
./wasi-sdk/bin/clang \
--sysroot=./wasi-sdk/share/wasi-sysroot \
-std=c89 \
wasm/hello.c \
-o wasm/hello.wasm
- name: Upload WebAssembly artifact
uses: actions/upload-artifact@v4
with:
name: hello-wasm
path: wasm/hello.wasm