Skip to content

tests: fix loading wasm when targeting external deps (#94) #52

tests: fix loading wasm when targeting external deps (#94)

tests: fix loading wasm when targeting external deps (#94) #52

Workflow file for this run

name: Test
on:
push:
pull_request:
branches: main
jobs:
build:
runs-on: ubuntu-latest
env:
WASI_SDK_VERSION: "21"
WASI_SDK_PATH: /opt/wasi-sdk
WABT_VERSION: "1.0.34"
WABT_PATH: /opt/wabt
BINARYEN_VERSION: "117"
BINARYEN_PATH: /opt/binaryen
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
cache: 'npm'
- name: Install
run: npm ci
- name: "Restore WASI SDK"
id: cache-wasi-sdk
uses: actions/cache@v4
with:
path: ${{ env.WASI_SDK_PATH }}
key: ${{ runner.os }}-wasi-sdk-${{ env.WASI_SDK_VERSION }}
- name: "Install WASI SDK"
if: steps.cache-wasi-sdk.outputs.cache-hit != 'true'
run: |
mkdir ${{ env.WASI_SDK_PATH }} && \
curl -s -S --location https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${{ env.WASI_SDK_VERSION }}/wasi-sdk-${{ env.WASI_SDK_VERSION }}.0-linux.tar.gz | \
tar --strip-components 1 --directory ${{ env.WASI_SDK_PATH }} --extract --gunzip
- name: "Restore WABT"
id: cache-wabt
uses: actions/cache@v4
with:
path: ${{ env.WABT_PATH }}
key: ${{ runner.os }}-wabt-${{ env.WABT_VERSION }}
- name: "Install WABT"
if: steps.cache-wabt.outputs.cache-hit != 'true'
run: |
mkdir ${{ env.WABT_PATH }} && \
curl -s -S --location https://github.com/WebAssembly/wabt/releases/download/${{ env.WABT_VERSION }}/wabt-${{ env.WABT_VERSION }}-ubuntu.tar.gz | \
tar --strip-components 1 --directory ${{ env.WABT_PATH }} --extract --gunzip
- name: "Restore Binaryen"
id: cache-binaryen
uses: actions/cache@v4
with:
path: ${{ env.BINARYEN_PATH }}
key: ${{ runner.os }}-binaryen-${{ env.BINARYEN_VERSION }}
- name: "Install Binaryen"
if: steps.cache-binaryen.outputs.cache-hit != 'true'
run: |
mkdir ${{ env.BINARYEN_PATH }} && \
curl -s -S --location https://github.com/WebAssembly/binaryen/releases/download/version_${{ env.BINARYEN_VERSION }}/binaryen-version_${{ env.BINARYEN_VERSION }}-x86_64-linux.tar.gz | \
tar --strip-components 1 --directory ${{ env.WABT_PATH }} --extract --gunzip
- name: Compile to Wasm & Test Wasm
run: |
rm lib/lexer.wasm;
npm run build-wasm;
npm run build;
# test
npm run test;
- name: Benchmark Wasm
run: npm run bench;