Skip to content

gha test

gha test #10

name: Linux Build and Test
on:
create:
tags:
push:
branches:
- main
pull_request:
env:
LANG: "C.UTF-8"
EMSDK_NOTTY: "1"
EMTEST_WASI_SYSROOT: "/home/runner/wasi-sdk/wasi-sysroot"
EMTEST_DETECT_TEMPFILE_LEAKS: "1"
PYTHONUNBUFFERED: "1"
permissions:
contents: read
jobs:
build-linux:
runs-on: ubuntu-latest
env:
EMCC_CORES: "4"
EMCC_USE_NINJA: "1"
EM_COMPILER_WRAPPER: "ccache"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Get wasmer
run: |
wget https://github.com/wasmerio/wasmer/releases/download/v3.1.1/wasmer-linux-amd64.tar.gz
tar -xf wasmer-linux-amd64.tar.gz
mkdir -p ~/vms
cp bin/wasmer ~/vms
- name: Get wasmtime
run: |
export VERSION=v0.33.0
wget https://github.com/bytecodealliance/wasmtime/releases/download/$VERSION/wasmtime-$VERSION-x86_64-linux.tar.xz
tar -xf wasmtime-$VERSION-x86_64-linux.tar.xz
cp wasmtime-$VERSION-x86_64-linux/wasmtime ~/vms
- name: Get wasi-sdk-sysroot
run: |
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-11/libclang_rt.builtins-wasm32-wasi-11.0.tar.gz
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-11/wasi-sysroot-11.0.tar.gz
mkdir -p ~/wasi-sdk
tar xf libclang_rt.builtins-wasm32-wasi-11.0.tar.gz -C ~/wasi-sdk
tar xf wasi-sysroot-11.0.tar.gz -C ~/wasi-sdk/
- name: Install V8
uses: ./.github/actions/install-v8
- name: Install Emsdk
uses: emscripten-core/setup-emsdk@v16
with:
version: tot
- name: Set EM_CONFIG
run: |
echo "EM_CONFIG=$EMSDK/.emscripten" >> $GITHUB_ENV
- name: Setup cache config
run: |
echo "import os" >> $EMSDK/.emscripten
echo "CACHE = os.path.expanduser('~/cache')" >> $EMSDK/.emscripten
echo "V8_ENGINE = [os.path.expanduser('~/.jsvu/bin/v8')]" >> $EMSDK/.emscripten
echo "JS_ENGINES = [NODE_JS]" >> $EMSDK/.emscripten
echo "if os.path.exists(V8_ENGINE[0]): JS_ENGINES.append(V8_ENGINE)" >> $EMSDK/.emscripten
echo "WASM_ENGINES = []" >> $EMSDK/.emscripten
test -f ~/vms/wasmtime && echo "WASMTIME = os.path.expanduser(os.path.join('~', 'vms', 'wasmtime')) ; WASM_ENGINES.append(WASMTIME)" >> $EMSDK/.emscripten || true
test -f ~/vms/wasmer && echo "WASMER = os.path.expanduser(os.path.join('~', 'vms', 'wasmer')) ; WASM_ENGINES.append(WASMER)" >> $EMSDK/.emscripten || true
test -d ~/wasi-sdk && cp -a ~/wasi-sdk/lib/ $($EMSDK/upstream/bin/clang -print-resource-dir) || true
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y ninja-build ccache
- name: Pip install
run: python -m pip install -r requirements-dev.txt
- name: Bootstrap
run: ./bootstrap
- name: Build libraries
run: |
./emcc --clear-cache
./test/runner test_hello_world
- name: Clean build directory
run: rm -rf ~/cache/build
- name: Archive persistent directories
run: tar -czf ~/emscripten-cache.tar.gz -C ~/ .jsvu cache vms wasi-sdk
- name: Persist workspace
uses: actions/upload-artifact@v4
with:
name: emscripten-cache
path: ~/emscripten-cache.tar.gz
test-sanity:
needs: build-linux
runs-on: ubuntu-latest
env:
EMCC_CORES: "4"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Prepare for tests
uses: ./.github/actions/prepare-for-tests
- name: Run sanity tests
run: ./test/runner sanity
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-sanity
path: out/test-results.xml
test-core0:
needs: build-linux
runs-on: ubuntu-latest
env:
EMCC_CORES: "4"
EMTEST_SKIP_NODE_25: "1"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Prepare for tests
uses: ./.github/actions/prepare-for-tests
- name: Run core0 tests
run: ./test/runner core0
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-core0
path: out/test-results.xml
test-wasm64-4gb:
needs: build-linux
runs-on: ubuntu-latest
env:
EMCC_CORES: 4
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Prepare for tests
uses: ./.github/actions/prepare-for-tests
- name: Reinstall V8
run: rm -rf $HOME/.jsvu
shell: bash
- name: Install V8
uses: ./.github/actions/install-v8
- name: Install Node newest
uses: ./.github/actions/install-node
with:
node_version: newest
- name: Configure Node v25
run: echo "NODE_JS = NODE_JS_TEST" >> $EMSDK/.emscripten
shell: bash
- name: Run wasm64_4gb tests
run: ./test/runner wasm64_4gb
shell: bash
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-wasm64-4gb
path: out/test-results.xml
test-browser-chrome:
needs: build-linux
runs-on: ubuntu-latest
env:
EMTEST_LACKS_WEBGPU: "1"
EMTEST_DETECT_TEMPFILE_LEAKS: "0"
EMTEST_HEADLESS: "1"
EMTEST_BROWSER: "/usr/bin/google-chrome"
EMTEST_CORES: "2"
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Prepare for tests
uses: ./.github/actions/prepare-for-tests
- name: Install Chrome
uses: ./.github/actions/install-chrome
- name: Run browser chrome tests
run: |
export EM_FROZEN_CACHE=""
./test/runner \
browser.test_gl_stride \
browser.test_memory_growth_during_startup \
browser.test_pthread_large_pthread_allocation \
browser.test_pthread_sbrk* \
browser.test_pthread_asan* \
browser.test_webgl_multi_draw* \
browser.test_pthread_growth* \
browser.test_4gb \
browser.test_emmalloc_3gb* \
browser.test_dlmalloc_3gb \
browser.test_2gb_fail \
browser.test_audio_worklet*
shell: bash
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-browser-chrome
path: out/test-results.xml