From 325f069f3270cec02a528ed8fb14fee49923dfc2 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 31 Mar 2026 11:55:52 -0700 Subject: [PATCH 1/9] go --- .github/workflows/ci.yml | 21 ++++++++++++++++----- scripts/test/shared.py | 5 +++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64cf30f8413..05e9b5be3c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -219,19 +219,30 @@ jobs: - name: test run: python check.py --binaryen-bin=out/bin - # Build with gcc 6.3 and run tests on Alpine Linux (inside chroot). + # Run tests on Alpine Linux, which we use to make our release builds. # Note: Alpine uses musl libc. - # Keep in sync with build_release.yml + # Keep in sync with build_release.yml. The only difference is that here we + # do not have the "archive" and "upload tarball" jobs. build-alpine: name: alpine - runs-on: ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, ubuntu-24.04-arm] steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.x' - uses: actions/checkout@v4 with: submodules: true + - name: start docker run: | - docker run -w /src -dit --platform=linux/arm64 --name alpine -v $PWD:/src node:lts-alpine + if [[ "${{ matrix.docker_platform }}" == "ubuntu-24.04-arm" ]]; then + platform="--platform=linux/arm64" + fi + docker run -w /src -dit $platform --name alpine -v $PWD:/src node:lts-alpine echo 'docker exec alpine "$@";' > ./alpine.sh chmod +x ./alpine.sh @@ -249,7 +260,7 @@ jobs: - name: cmake run: | - ./alpine.sh cmake . -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_CXX_FLAGS="-static" -DCMAKE_C_FLAGS="-static" -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_LIB=ON -DBUILD_MIMALLOC=ON -DCMAKE_INSTALL_PREFIX=install + ./alpine.sh cmake . -G Ninja -DCMAKE_CXX_FLAGS="-static" -DCMAKE_C_FLAGS="-static" -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_LIB=ON -DBUILD_MIMALLOC=ON -DCMAKE_INSTALL_PREFIX=install - name: build run: | diff --git a/scripts/test/shared.py b/scripts/test/shared.py index 3d36fb35fa1..f444df6c4a4 100644 --- a/scripts/test/shared.py +++ b/scripts/test/shared.py @@ -443,6 +443,11 @@ def get_tests(test_dir, extensions=[], recursive=False): 'token.wast', # Lexer should require spaces between strings and non-paren tokens ] +if get_platform() == 'linux': + SPEC_TESTSUITE_TESTS_TO_SKIP += [ + # 'f32.wast', # Errors on Linux x86_64 with musl, https://github.com/WebAssembly/binaryen/pull/8557 + ] + def _can_run_spec_test(test): test = Path(test) From 5e273cc16f0ba58e5809a99f4ed13c1f0d00e7df Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 31 Mar 2026 12:38:49 -0700 Subject: [PATCH 2/9] enable disable --- scripts/test/shared.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test/shared.py b/scripts/test/shared.py index f444df6c4a4..246d45004d9 100644 --- a/scripts/test/shared.py +++ b/scripts/test/shared.py @@ -445,7 +445,7 @@ def get_tests(test_dir, extensions=[], recursive=False): if get_platform() == 'linux': SPEC_TESTSUITE_TESTS_TO_SKIP += [ - # 'f32.wast', # Errors on Linux x86_64 with musl, https://github.com/WebAssembly/binaryen/pull/8557 + 'f32.wast', # Errors on Linux x86_64 with musl, https://github.com/WebAssembly/binaryen/pull/8557 ] From 5244605d8a01717b43fbc49f3372372e9ef96f9b Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 31 Mar 2026 12:49:15 -0700 Subject: [PATCH 3/9] lint --- scripts/test/shared.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test/shared.py b/scripts/test/shared.py index 246d45004d9..a6b9af5f3e7 100644 --- a/scripts/test/shared.py +++ b/scripts/test/shared.py @@ -445,7 +445,7 @@ def get_tests(test_dir, extensions=[], recursive=False): if get_platform() == 'linux': SPEC_TESTSUITE_TESTS_TO_SKIP += [ - 'f32.wast', # Errors on Linux x86_64 with musl, https://github.com/WebAssembly/binaryen/pull/8557 + 'f32.wast', # Errors on Linux x86_64 with musl, https://github.com/WebAssembly/binaryen/pull/8557 ] From 109c28334a4fe62f970396412b5e37022c685cb0 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 31 Mar 2026 13:29:42 -0700 Subject: [PATCH 4/9] handle skipped tests; they are not stale --- scripts/test/wasm2js.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/test/wasm2js.py b/scripts/test/wasm2js.py index f75b2ba3269..4af2c55d837 100644 --- a/scripts/test/wasm2js.py +++ b/scripts/test/wasm2js.py @@ -42,10 +42,15 @@ def check_for_stale_files(): all_tests = basic_tests + spec_tests + wasm2js_tests all_tests = [os.path.basename(os.path.splitext(t)[0]) for t in all_tests] + assert_test_prefixes = [t.split('.')[0] for t in assert_tests] + skipped_test_prefixes = [t.split('.')[0] for t in shared.SPEC_TESTSUITE_TESTS_TO_SKIP] + all_files = os.listdir(shared.get_test_dir('wasm2js')) for f in all_files: prefix = f.split('.')[0] - if prefix in [t.split('.')[0] for t in assert_tests]: + if prefix in assert_test_prefixes: + continue + if prefix in skipped_test_prefixes: continue if prefix not in all_tests: shared.fail_with_error(f'orphan test output: {f}') From de98f96bbbdeb385dd3d7dd61fa6ef85ddf1b3e5 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 31 Mar 2026 13:46:26 -0700 Subject: [PATCH 5/9] f64.too --- scripts/test/shared.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/test/shared.py b/scripts/test/shared.py index a6b9af5f3e7..84667419bb9 100644 --- a/scripts/test/shared.py +++ b/scripts/test/shared.py @@ -446,6 +446,7 @@ def get_tests(test_dir, extensions=[], recursive=False): if get_platform() == 'linux': SPEC_TESTSUITE_TESTS_TO_SKIP += [ 'f32.wast', # Errors on Linux x86_64 with musl, https://github.com/WebAssembly/binaryen/pull/8557 + 'f64.wast', # Errors on Linux x86_64 with musl, https://github.com/WebAssembly/binaryen/pull/8557 ] From 3a202995fbc7cc91e8b4155f300e56eec01eac45 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 31 Mar 2026 16:00:05 -0700 Subject: [PATCH 6/9] moar --- scripts/test/shared.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/test/shared.py b/scripts/test/shared.py index 84667419bb9..72b64c762ad 100644 --- a/scripts/test/shared.py +++ b/scripts/test/shared.py @@ -445,8 +445,11 @@ def get_tests(test_dir, extensions=[], recursive=False): if get_platform() == 'linux': SPEC_TESTSUITE_TESTS_TO_SKIP += [ - 'f32.wast', # Errors on Linux x86_64 with musl, https://github.com/WebAssembly/binaryen/pull/8557 - 'f64.wast', # Errors on Linux x86_64 with musl, https://github.com/WebAssembly/binaryen/pull/8557 + # Errors on Linux x86_64 with musl, https://github.com/WebAssembly/binaryen/pull/8557 + 'f32.wast', + 'f64.wast', + 'simd_f32x4_rounding.wast', + 'simd_f64x2_rounding.wast', ] From e2334d2a381b902541b82a8b4d98700a25d1b813 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 31 Mar 2026 16:02:00 -0700 Subject: [PATCH 7/9] find.full.list --- .github/workflows/ci.yml | 350 +-------------------------------------- 1 file changed, 1 insertion(+), 349 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05e9b5be3c4..3c0cdb71a63 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,210 +15,6 @@ concurrency: jobs: - lint: - name: lint - if: ${{ github.event_name == 'pull_request' }} - runs-on: ubuntu-latest - env: - # Keep this in sync with clang-format-diff.sh - LLVM_VERSION: 21 - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 0 - - name: install tools - run: | - pip3 install -r requirements-dev.txt - sudo apt install lsb-release wget software-properties-common gnupg - wget https://apt.llvm.org/llvm.sh - sudo chmod +x llvm.sh - sudo ./llvm.sh ${LLVM_VERSION} - sudo apt-get install clang-format clang-format-${LLVM_VERSION} clang-tidy-${LLVM_VERSION} - - run: flake8 - - run: ruff check - - run: ./scripts/clang-format-diff.sh - - name: clang-tidy - run: | - # clang-tidy requires compile_commands.json generated by cmake - cmake . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - ./scripts/clang-tidy-diff.sh - - build: - name: build - runs-on: ${{ matrix.os }} - strategy: - matrix: - # Test on the oldest support Ubuntu version in addition to `latest`. - os: [ubuntu-22.04, ubuntu-latest, macos-latest, windows-latest, windows-11-arm] - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - uses: actions/checkout@v4 - with: - submodules: true - - - name: install Python dev dependencies - run: pip3 install -r requirements-dev.txt - - - name: gen-s-parser - run: ./scripts/gen-s-parser.py | diff src/gen-s-parser.inc - - if: startsWith(matrix.os, 'ubuntu') - - - name: install ninja (linux) - run: sudo apt-get install ninja-build - if: startsWith(matrix.os, 'ubuntu') - - - name: install ninja (macos) - run: brew install ninja - if: matrix.os == 'macos-latest' - - - name: install ninja (win) - run: choco install ninja - if: startsWith(matrix.os, 'windows') - - - name: install v8 - run: | - npm install jsvu -g - jsvu --os=default --engines=v8 - - - name: mkdir - run: mkdir -p out - - - name: cmake (linux) - run: cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install - if: startsWith(matrix.os, 'ubuntu') - - - name: cmake (macos) - run: cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install '-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64' - if: matrix.os == 'macos-latest' - - - name: cmake (win) - # -G "Visual Studio 15 2017" - run: cmake -S . -B out -DCMAKE_INSTALL_PREFIX=out/install - if: startsWith(matrix.os, 'windows') - - - name: build - run: cmake --build out --config Release -v - - - name: install - run: cmake --install out --config Release - - - name: strip - run: find out/install/ -type f -perm -u=x -exec strip -x {} + - if: ${{ !startsWith(matrix.os, 'windows') }} - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: build-${{ matrix.os }} - path: out/install - - - name: test binaryen-lit - run: python out/bin/binaryen-lit -vv test/lit/parse-error.wast - - - name: test - run: python check.py --binaryen-bin=out/bin - - build-clang: - name: clang (LTO) - runs-on: ubuntu-latest - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - uses: actions/checkout@v4 - with: - submodules: true - - name: install ninja - run: sudo apt-get install ninja-build - - name: install v8 - run: | - npm install jsvu -g - jsvu --os=default --engines=v8 - - name: install Python dev dependencies - run: pip3 install -r requirements-dev.txt - - name: cmake - run: | - mkdir -p out - cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DBYN_ENABLE_LTO=ON - - name: build - run: cmake --build out -v - - name: test binaryen-lit - run: python out/bin/binaryen-lit -vv test/lit/parse-error.wast - - name: test - run: python check.py --binaryen-bin=out/bin - - # Copied and modified from build-clang - build-fuzztest: - name: clang with fuzztest - runs-on: ubuntu-latest - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - uses: actions/checkout@v4 - with: - submodules: true - - name: install ninja - run: sudo apt-get install ninja-build - - name: install v8 - run: | - npm install jsvu -g - jsvu --os=default --engines=v8 - - name: install Python dev dependencies - run: pip3 install -r requirements-dev.txt - - name: cmake - run: | - mkdir -p out - cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DBUILD_FUZZTEST=ON - - name: build - run: cmake --build out -v - - name: test - run: python check.py --binaryen-bin=out/bin - - # TODO(sbc): Find a way to reduce the duplicate between these sanitizer jobs - build-asan: - name: asan - runs-on: ubuntu-latest - env: - ASAN_OPTIONS: "symbolize=1" - COMPILER_FLAGS: "-fsanitize=address" - CC: "clang-18" - CXX: "clang++-18" - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - uses: actions/checkout@v4 - with: - submodules: true - - name: install clang 18 - run: | - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - sudo ./llvm.sh 18 - - name: install ninja - run: sudo apt-get install ninja-build - - name: install v8 - run: | - npm install jsvu -g - jsvu --os=default --engines=v8 - - name: install Python dev dependencies - run: pip3 install -r requirements-dev.txt - - name: cmake - run: | - mkdir -p out - cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_FLAGS="$COMPILER_FLAGS" -DCMAKE_CXX_FLAGS="$COMPILER_FLAGS" - - name: build - run: cmake --build out - - name: test - run: python check.py --binaryen-bin=out/bin - # Run tests on Alpine Linux, which we use to make our release builds. # Note: Alpine uses musl libc. # Keep in sync with build_release.yml. The only difference is that here we @@ -267,149 +63,5 @@ jobs: ./alpine.sh ninja install - name: test - run: ./alpine.sh python3 ./check.py - - # Duplicates build-asan. Please keep in sync - build-ubsan: - name: ubsan - runs-on: ubuntu-latest - env: - COMPILER_FLAGS: "-fsanitize=undefined -fno-sanitize-recover=all" - CC: "clang" - CXX: "clang++" - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - uses: actions/checkout@v4 - with: - submodules: true - - name: install ninja - run: sudo apt-get install ninja-build - - name: install v8 - run: | - npm install jsvu -g - jsvu --os=default --engines=v8 - - name: install Python dev dependencies - run: pip3 install -r requirements-dev.txt - - name: cmake - run: | - mkdir -p out - cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS="$COMPILER_FLAGS" -DCMAKE_CXX_FLAGS="$COMPILER_FLAGS -fsanitize-blacklist=$PWD/ubsan.blacklist" - - name: build - run: cmake --build out - - name: test - run: python check.py --binaryen-bin=out/bin - - # Duplicates build-asan. Please keep in sync - build-tsan: - name: tsan - runs-on: ubuntu-latest - env: - COMPILER_FLAGS: "-fsanitize=thread" - LINKER_FLAGS: "-fsanitize=thread" - CC: "clang-18" - CXX: "clang++-18" - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - uses: actions/checkout@v4 - with: - submodules: true - - name: install clang 18 - run: | - wget https://apt.llvm.org/llvm.sh - chmod +x llvm.sh - sudo ./llvm.sh 18 - - name: install ninja - run: sudo apt-get install ninja-build - - name: install v8 - run: | - npm install jsvu -g - jsvu --os=default --engines=v8 - - name: install Python dev dependencies - run: pip3 install -r requirements-dev.txt - - name: cmake - run: | - mkdir -p out - cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_FLAGS="$COMPILER_FLAGS" -DCMAKE_CXX_FLAGS="$COMPILER_FLAGS" -DCMAKE_EXE_LINKER_FLAGS="$LINKER_FLAGS" - - name: build - run: cmake --build out - - name: test - run: python check.py --binaryen-bin=out/bin - - # Build the .js outputs using emcc - build-emscripten: - name: emscripten - runs-on: ubuntu-latest - env: - # Set this environment variable to test a specific Emscripten branch. - # Format: https://github.com//emscripten/tree/ - EMSCRIPTEN_REPO: "" - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - uses: actions/checkout@v4 - with: - submodules: true - - name: install ninja - run: sudo apt-get install ninja-build - - name: emsdk install - run: | - mkdir $HOME/emsdk - git clone --depth 1 https://github.com/emscripten-core/emsdk.git $HOME/emsdk - $HOME/emsdk/emsdk update-tags - $HOME/emsdk/emsdk install tot - $HOME/emsdk/emsdk activate tot - - name: override emscripten repository - if: ${{ env.EMSCRIPTEN_REPO != '' }} - run: | - $HOME/emsdk/emsdk install emscripten-main-64bit \ - --override-repository emscripten-main-64bit@$EMSCRIPTEN_REPO - $HOME/emsdk/emsdk activate emscripten-main-64bit - - name: update path - run: echo "PATH=$PATH:$HOME/emsdk" >> $GITHUB_ENV - - name: emcc-tests - run: | - source $HOME/emsdk/emsdk_env.sh - ./scripts/emcc-tests.sh + run: ./alpine.sh python3 ./check.py spec --no-fail-fast - # Windows + gcc needs work before the tests will run, so just test the compile - build-mingw: - name: mingw - runs-on: windows-latest - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - uses: actions/checkout@v4 - with: - submodules: true - - name: cmake - run: | - mkdir -p out - cmake -S . -B out -G "MSYS Makefiles" - - name: build - run: cmake --build out - - # Ensures we can build in no-asserts mode (just building). - build-noasserts: - name: noasserts - runs-on: ubuntu-latest - steps: - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - uses: actions/checkout@v4 - with: - submodules: true - - name: install ninja - run: sudo apt-get install ninja-build - - name: cmake - run: | - mkdir -p out - cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DBYN_ENABLE_ASSERTIONS=OFF - - name: build - run: cmake --build out -v From ef4b59cb2a50ae411f0632312e0516580446dd3c Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 31 Mar 2026 16:28:42 -0700 Subject: [PATCH 8/9] no-fail-fast does not work --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c0cdb71a63..d297214ee73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,5 +63,5 @@ jobs: ./alpine.sh ninja install - name: test - run: ./alpine.sh python3 ./check.py spec --no-fail-fast + run: ./alpine.sh python3 ./check.py spec From 3cdbaec3de185cac133193a90c6d58583fac4f0c Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 31 Mar 2026 17:11:50 -0700 Subject: [PATCH 9/9] undo --- .github/workflows/ci.yml | 350 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 349 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d297214ee73..05e9b5be3c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,210 @@ concurrency: jobs: + lint: + name: lint + if: ${{ github.event_name == 'pull_request' }} + runs-on: ubuntu-latest + env: + # Keep this in sync with clang-format-diff.sh + LLVM_VERSION: 21 + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + - name: install tools + run: | + pip3 install -r requirements-dev.txt + sudo apt install lsb-release wget software-properties-common gnupg + wget https://apt.llvm.org/llvm.sh + sudo chmod +x llvm.sh + sudo ./llvm.sh ${LLVM_VERSION} + sudo apt-get install clang-format clang-format-${LLVM_VERSION} clang-tidy-${LLVM_VERSION} + - run: flake8 + - run: ruff check + - run: ./scripts/clang-format-diff.sh + - name: clang-tidy + run: | + # clang-tidy requires compile_commands.json generated by cmake + cmake . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + ./scripts/clang-tidy-diff.sh + + build: + name: build + runs-on: ${{ matrix.os }} + strategy: + matrix: + # Test on the oldest support Ubuntu version in addition to `latest`. + os: [ubuntu-22.04, ubuntu-latest, macos-latest, windows-latest, windows-11-arm] + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: actions/checkout@v4 + with: + submodules: true + + - name: install Python dev dependencies + run: pip3 install -r requirements-dev.txt + + - name: gen-s-parser + run: ./scripts/gen-s-parser.py | diff src/gen-s-parser.inc - + if: startsWith(matrix.os, 'ubuntu') + + - name: install ninja (linux) + run: sudo apt-get install ninja-build + if: startsWith(matrix.os, 'ubuntu') + + - name: install ninja (macos) + run: brew install ninja + if: matrix.os == 'macos-latest' + + - name: install ninja (win) + run: choco install ninja + if: startsWith(matrix.os, 'windows') + + - name: install v8 + run: | + npm install jsvu -g + jsvu --os=default --engines=v8 + + - name: mkdir + run: mkdir -p out + + - name: cmake (linux) + run: cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install + if: startsWith(matrix.os, 'ubuntu') + + - name: cmake (macos) + run: cmake -S . -B out -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out/install '-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64' + if: matrix.os == 'macos-latest' + + - name: cmake (win) + # -G "Visual Studio 15 2017" + run: cmake -S . -B out -DCMAKE_INSTALL_PREFIX=out/install + if: startsWith(matrix.os, 'windows') + + - name: build + run: cmake --build out --config Release -v + + - name: install + run: cmake --install out --config Release + + - name: strip + run: find out/install/ -type f -perm -u=x -exec strip -x {} + + if: ${{ !startsWith(matrix.os, 'windows') }} + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: build-${{ matrix.os }} + path: out/install + + - name: test binaryen-lit + run: python out/bin/binaryen-lit -vv test/lit/parse-error.wast + + - name: test + run: python check.py --binaryen-bin=out/bin + + build-clang: + name: clang (LTO) + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: actions/checkout@v4 + with: + submodules: true + - name: install ninja + run: sudo apt-get install ninja-build + - name: install v8 + run: | + npm install jsvu -g + jsvu --os=default --engines=v8 + - name: install Python dev dependencies + run: pip3 install -r requirements-dev.txt + - name: cmake + run: | + mkdir -p out + cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DBYN_ENABLE_LTO=ON + - name: build + run: cmake --build out -v + - name: test binaryen-lit + run: python out/bin/binaryen-lit -vv test/lit/parse-error.wast + - name: test + run: python check.py --binaryen-bin=out/bin + + # Copied and modified from build-clang + build-fuzztest: + name: clang with fuzztest + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: actions/checkout@v4 + with: + submodules: true + - name: install ninja + run: sudo apt-get install ninja-build + - name: install v8 + run: | + npm install jsvu -g + jsvu --os=default --engines=v8 + - name: install Python dev dependencies + run: pip3 install -r requirements-dev.txt + - name: cmake + run: | + mkdir -p out + cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DBUILD_FUZZTEST=ON + - name: build + run: cmake --build out -v + - name: test + run: python check.py --binaryen-bin=out/bin + + # TODO(sbc): Find a way to reduce the duplicate between these sanitizer jobs + build-asan: + name: asan + runs-on: ubuntu-latest + env: + ASAN_OPTIONS: "symbolize=1" + COMPILER_FLAGS: "-fsanitize=address" + CC: "clang-18" + CXX: "clang++-18" + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: actions/checkout@v4 + with: + submodules: true + - name: install clang 18 + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 18 + - name: install ninja + run: sudo apt-get install ninja-build + - name: install v8 + run: | + npm install jsvu -g + jsvu --os=default --engines=v8 + - name: install Python dev dependencies + run: pip3 install -r requirements-dev.txt + - name: cmake + run: | + mkdir -p out + cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_FLAGS="$COMPILER_FLAGS" -DCMAKE_CXX_FLAGS="$COMPILER_FLAGS" + - name: build + run: cmake --build out + - name: test + run: python check.py --binaryen-bin=out/bin + # Run tests on Alpine Linux, which we use to make our release builds. # Note: Alpine uses musl libc. # Keep in sync with build_release.yml. The only difference is that here we @@ -63,5 +267,149 @@ jobs: ./alpine.sh ninja install - name: test - run: ./alpine.sh python3 ./check.py spec + run: ./alpine.sh python3 ./check.py + + # Duplicates build-asan. Please keep in sync + build-ubsan: + name: ubsan + runs-on: ubuntu-latest + env: + COMPILER_FLAGS: "-fsanitize=undefined -fno-sanitize-recover=all" + CC: "clang" + CXX: "clang++" + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: actions/checkout@v4 + with: + submodules: true + - name: install ninja + run: sudo apt-get install ninja-build + - name: install v8 + run: | + npm install jsvu -g + jsvu --os=default --engines=v8 + - name: install Python dev dependencies + run: pip3 install -r requirements-dev.txt + - name: cmake + run: | + mkdir -p out + cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS="$COMPILER_FLAGS" -DCMAKE_CXX_FLAGS="$COMPILER_FLAGS -fsanitize-blacklist=$PWD/ubsan.blacklist" + - name: build + run: cmake --build out + - name: test + run: python check.py --binaryen-bin=out/bin + + # Duplicates build-asan. Please keep in sync + build-tsan: + name: tsan + runs-on: ubuntu-latest + env: + COMPILER_FLAGS: "-fsanitize=thread" + LINKER_FLAGS: "-fsanitize=thread" + CC: "clang-18" + CXX: "clang++-18" + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: actions/checkout@v4 + with: + submodules: true + - name: install clang 18 + run: | + wget https://apt.llvm.org/llvm.sh + chmod +x llvm.sh + sudo ./llvm.sh 18 + - name: install ninja + run: sudo apt-get install ninja-build + - name: install v8 + run: | + npm install jsvu -g + jsvu --os=default --engines=v8 + - name: install Python dev dependencies + run: pip3 install -r requirements-dev.txt + - name: cmake + run: | + mkdir -p out + cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_C_FLAGS="$COMPILER_FLAGS" -DCMAKE_CXX_FLAGS="$COMPILER_FLAGS" -DCMAKE_EXE_LINKER_FLAGS="$LINKER_FLAGS" + - name: build + run: cmake --build out + - name: test + run: python check.py --binaryen-bin=out/bin + + # Build the .js outputs using emcc + build-emscripten: + name: emscripten + runs-on: ubuntu-latest + env: + # Set this environment variable to test a specific Emscripten branch. + # Format: https://github.com//emscripten/tree/ + EMSCRIPTEN_REPO: "" + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: actions/checkout@v4 + with: + submodules: true + - name: install ninja + run: sudo apt-get install ninja-build + - name: emsdk install + run: | + mkdir $HOME/emsdk + git clone --depth 1 https://github.com/emscripten-core/emsdk.git $HOME/emsdk + $HOME/emsdk/emsdk update-tags + $HOME/emsdk/emsdk install tot + $HOME/emsdk/emsdk activate tot + - name: override emscripten repository + if: ${{ env.EMSCRIPTEN_REPO != '' }} + run: | + $HOME/emsdk/emsdk install emscripten-main-64bit \ + --override-repository emscripten-main-64bit@$EMSCRIPTEN_REPO + $HOME/emsdk/emsdk activate emscripten-main-64bit + - name: update path + run: echo "PATH=$PATH:$HOME/emsdk" >> $GITHUB_ENV + - name: emcc-tests + run: | + source $HOME/emsdk/emsdk_env.sh + ./scripts/emcc-tests.sh + # Windows + gcc needs work before the tests will run, so just test the compile + build-mingw: + name: mingw + runs-on: windows-latest + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: actions/checkout@v4 + with: + submodules: true + - name: cmake + run: | + mkdir -p out + cmake -S . -B out -G "MSYS Makefiles" + - name: build + run: cmake --build out + + # Ensures we can build in no-asserts mode (just building). + build-noasserts: + name: noasserts + runs-on: ubuntu-latest + steps: + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: actions/checkout@v4 + with: + submodules: true + - name: install ninja + run: sudo apt-get install ninja-build + - name: cmake + run: | + mkdir -p out + cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DBYN_ENABLE_ASSERTIONS=OFF + - name: build + run: cmake --build out -v