A Bytecode Alliance project
This GitHub Action will install the WASI SDK toolchain for compiling to WebAssembly on a GitHub runner:
- Downloads and installs the specified version of WASI SDK (see releases)
- Optionally adds WASI SDK to the GitHub runner
PATH - Sets up environment variables and output variables
- uses: bytecodealliance/setup-wasi-sdk-action@v1
# Now, use `clang` or `$CC` to compile C/C++ to WebAssembly:
- run: $CC hello.c -o hello.wasmFor more advanced usage, see the following examples:
| Input | Description | Required | Default |
|---|---|---|---|
version |
WASI SDK version to install (e.g., 25) |
No | latest |
install-path |
Directory to install WASI SDK to | No | $RUNNER_TOOL_CACHE/wasi-sdk |
add-to-path |
Add WASI SDK bin directory to the PATH |
No | true |
github-token |
GitHub token for API requests | No | ${{ github.token }} |
Note that passing latest as the version will attempt to retrieve the latest release
tag. See GitHub's variables reference for a description of RUNNER_TOOL_CACHE; other
setup-* actions store their artifacts here.
| Output | Description |
|---|---|
wasi-sdk-path |
Path to the installed WASI SDK toolchain |
wasi-sdk-version |
Version of WASI SDK that was installed |
clang-path |
Path to the clang executable |
sysroot-path |
Path to the WASI sysroot |
The action always sets the following environment variables:
WASI_SDK_PATH: Path to the WASI SDK installationWASI_SDK_VERSION: Version of WASI SDK that was installed
When add-to-path is true (the default), the action also adds the WASI SDK bin directory to
the GitHub runner PATH and sets:
CC: Clang compiler with WASI sysroot configuredCXX: Clang++ compiler with WASI sysroot configured
This action should be usable on all GitHub runners; open an issue if this is not the case.
| OS | Architecture | Support |
|---|---|---|
| Linux | x86_64 | ✅ |
| Linux | arm64 | ✅ |
| macOS | Any | ✅ |
| Windows | Any | ✅ |
setup-wasi-sdk-action is released under the Apache License Version 2.0. By contributing to
the project, you agree to the license and copyright terms therein and release your contribution
under these terms.