Skip to content

readme

readme #10

Workflow file for this run

name: Build
on:
workflow_dispatch:
push:
pull_request:
env:
WASI_VERSION: '21'
WASI_VERSION_FULL: '21.0'
EM_VERSION: '3.1.44'
EM_CACHE_FOLDER: 'emsdk-cache'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
target:
- 'emscripten'
- 'wasi'
- 'wasm32'
thread:
- 'OFF'
- 'ON'
env:
WASI_SDK_PATH: ${{ github.workspace }}${{ (matrix.os == 'windows-latest' && '\') || '/' }}wasi-sdk
# WASI_SDK_PATH: ${{ (matrix.os == 'windows-latest' && 'C:/wasi-sdk') || (matrix.os == 'ubuntu-latest' && '/opt/wasi-sdk') || '/opt/wasi-sdk' }}
steps:
- uses: actions/checkout@v4
- name: Setup Emscripten cache
if: ${{ contains(matrix.target, 'emscripten') }}
id: cache-system-libraries
uses: actions/cache@v3
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{ runner.os }}-${{ matrix.target }}-${{ matrix.thread }}
- uses: mymindstorm/setup-emsdk@v13
if: ${{ contains(matrix.target, 'emscripten') }}
with:
version: ${{ env.EM_VERSION }}
# no-cache: true
actions-cache-folder: ${{ env.EM_CACHE_FOLDER }}
- name: Install wasi-sdk (Linux)
if: ${{ (matrix.target == 'wasm32' || matrix.target == 'wasi') && matrix.os == 'ubuntu-latest' }}
shell: bash
run: |
curl -OL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
mkdir -p $WASI_SDK_PATH
tar zxvf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz -C $WASI_SDK_PATH --strip 1
- name: Install wasi-sdk (Windows)
if: ${{ (matrix.target == 'wasm32' || matrix.target == 'wasi') && matrix.os == 'windows-latest' }}
shell: cmd
run: |
curl -OL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-%WASI_VERSION%/wasi-sdk-%WASI_VERSION_FULL%.m-mingw.tar.gz
mkdir %WASI_SDK_PATH%
tar zxvf wasi-sdk-%WASI_VERSION_FULL%.m-mingw.tar.gz -C %WASI_SDK_PATH% --strip 1
- name: Install wasi-sdk (macOS)
if: ${{ (matrix.target == 'wasm32' || matrix.target == 'wasi') && matrix.os == 'macos-latest' }}
shell: bash
run: |
curl -OL https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz
mkdir -p $WASI_SDK_PATH
tar zxvf wasi-sdk-${WASI_VERSION_FULL}-macos.tar.gz -C $WASI_SDK_PATH --strip 1
- uses: actions/setup-node@v3
with:
node-version: '20.9.0'
registry-url: 'https://registry.npmjs.org'
- name: NPM Install
shell: bash
run: npm install
- name: NPM Build
shell: bash
run: npm run build-${{ matrix.target }}${{ (matrix.thread == 'ON' && '-threads') || '' }}:${{ (matrix.os == 'windows-latest' && 'win') || 'unix' }}