Skip to content

Commit

Permalink
Merge pull request #362 from myfreeer/patch-1
Browse files Browse the repository at this point in the history
ci: initial support of meson and emscripten
  • Loading branch information
recp authored Dec 2, 2023
2 parents 9b26aff + e1a0892 commit 8754158
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/meson-wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Meson WebAssembly

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
wasmtime_version: v7.0.0
wasmer_version: v3.1.1

jobs:
build_emsdk:
strategy:
matrix:
BUILD_TYPE: [debug, debugoptimized, release, minsize]
C_FLAGS: ['', '-msimd128', '-msse -msse2 -msimd128', '-msse -msse2 -msse3 -msse4 -msimd128']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v13

- name: Verify emsdk
run: emcc -v

- name: Creating cross file
run: |
cat << EOF > ${{github.workspace}}/meson_cross_emsdk.txt
[binaries]
c = '`which emcc`'
cpp = '`which em++`'
ar = '`which emar`'
[built-in options]
c_args = ['-Wno-unused-parameter']
c_link_args = ['-s', 'STANDALONE_WASM']
cpp_args = ['-Wno-unused-parameter']
cpp_link_args = ['-s', 'STANDALONE_WASM']
[host_machine]
system = 'emscripten'
cpu_family = 'wasm32'
cpu = 'wasm32'
endian = 'little'
EOF
cat ${{github.workspace}}/meson_cross_emsdk.txt
- uses: actions/setup-python@v4

- name: Install meson
run: |
sudo python3 -m pip install meson ninja
- name: Build with meson
run: |
meson setup build -Dbuildtype=${{matrix.BUILD_TYPE}} --cross-file ${{github.workspace}}/meson_cross_emsdk.txt --default-library=static -Dbuild_tests=true
meson test -C build
- name: Test with wasmtime
run: |
cd ${{github.workspace}}
ls -lh ${{github.workspace}}/build/
wget --no-verbose https://github.com/bytecodealliance/wasmtime/releases/download/${{env.wasmtime_version}}/wasmtime-${{env.wasmtime_version}}-x86_64-linux.tar.xz
tar xf wasmtime-${{env.wasmtime_version}}-x86_64-linux.tar.xz
./wasmtime-${{env.wasmtime_version}}-x86_64-linux/wasmtime run --wasm-features simd ${{github.workspace}}/build/tests.wasm
- name: Test with wasmer
run: |
cd ${{github.workspace}}
mkdir wasmer
cd wasmer
wget --no-verbose https://github.com/wasmerio/wasmer/releases/download/${{env.wasmer_version}}/wasmer-linux-amd64.tar.gz
tar xf wasmer-linux-amd64.tar.gz
./bin/wasmer run --enable-simd ${{github.workspace}}/build/tests.wasm

0 comments on commit 8754158

Please sign in to comment.