wasm: Propagate leb128 errors when parsing modules #3829
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
workflow_dispatch: | |
push: | |
branches: [master] | |
name: ci | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions | |
permissions: | |
contents: read | |
jobs: | |
linux-ci: | |
name: linux-${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: gcc-12 | |
os: ubuntu-22.04 | |
compiler: gcc | |
version: 12 | |
bazel: --test_timeout=120 --run_under="valgrind --leak-check=full --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes --show-leak-kinds=all" | |
apt: g++-12 valgrind | |
- name: gcc-13 | |
os: ubuntu-22.04 | |
compiler: gcc | |
version: 13 | |
apt: g++-13 | |
- name: clang-14-tsan | |
os: ubuntu-22.04 | |
compiler: clang | |
version: 14 | |
bazel: --config tsan | |
- name: clang-asan | |
os: ubuntu-22.04 | |
compiler: clang | |
version: 14 | |
bazel: --config asan | |
# https://github.com/llvm/llvm-project/issues/49689 | |
- name: clang-ubsan | |
os: ubuntu-22.04 | |
compiler: clang | |
version: 15 | |
bazel: --config ubsan | |
- name: clang-17 | |
os: ubuntu-22.04 | |
compiler: clang | |
version: 17 | |
- name: clang-15-libc++ | |
os: ubuntu-22.04 | |
compiler: clang | |
version: 15 | |
bazel: --config libc++ | |
apt: libc++abi-15-dev libc++-15-dev | |
- name: clang-17-libc++ | |
os: ubuntu-22.04 | |
compiler: clang | |
version: 17 | |
bazel: --config libc++ | |
apt: libc++abi-17-dev libc++-17-dev | |
steps: | |
- name: Prepare gcc install | |
if: startsWith(matrix.compiler, 'gcc') && matrix.version >= 13 | |
run: sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
- name: Prepare clang install | |
if: startsWith(matrix.compiler, 'clang') && matrix.version >= 15 | |
run: | | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${{ matrix.version }} main" | |
- name: Setup gcc | |
if: startsWith(matrix.compiler, 'gcc') | |
run: | | |
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV | |
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV | |
- name: Setup clang | |
if: startsWith(matrix.compiler, 'clang') | |
run: | | |
echo "CC=clang-${{ matrix.version }}" >> $GITHUB_ENV | |
echo "CXX=clang++-${{ matrix.version }}" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: Install | |
run: | | |
sudo apt-get update | |
sudo apt-get install --no-install-recommends libgl-dev ${{ matrix.compiler }}-${{ matrix.version }} ${{ matrix.apt }} | |
# See: https://github.com/actions/runner-images/issues/8659 | |
- name: Work around libstdc++ and Clang incompabilities | |
if: startsWith(matrix.compiler, 'clang') && matrix.version <= 16 | |
run: | | |
sudo rm -f /etc/apt/sources.list.d/ubuntu-toolchain-r-ubuntu-test-jammy.list | |
sudo apt-get update | |
sudo apt-get install --allow-downgrades libstdc++6=12.3.0-1ubuntu1~22.04 libgcc-s1=12.3.0-1ubuntu1~22.04 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/bazel | |
key: ${{ matrix.name }}-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }} | |
restore-keys: ${{ matrix.name }}- | |
- name: Build | |
run: bazel build //... ${{ matrix.bazel }} | |
- name: Test | |
run: bazel test //... ${{ matrix.bazel }} | |
- name: Run | |
run: | | |
echo "<html><body><h1>Example</h1><p>This is an example page.</p></body></html>" >example.html | |
bazel run browser:tui file://$(pwd)/example.html ${{ matrix.bazel }} | |
linux-gcc-12-coverage: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/bazel | |
key: coverage-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }} | |
restore-keys: coverage- | |
- name: Install | |
run: | | |
sudo apt-get update | |
sudo apt-get install --no-install-recommends libgl-dev lcov gcc-12 g++-12 | |
- name: Setup | |
run: | | |
echo "CC=gcc-12" >> $GITHUB_ENV | |
echo "CXX=g++-12" >> $GITHUB_ENV | |
echo "GCOV=gcov-12" >> $GITHUB_ENV | |
- name: Coverage | |
run: bazel coverage ... | |
- name: Summary | |
run: lcov --summary bazel-out/_coverage/_coverage_report.dat | |
- name: Upload | |
run: | | |
wget --no-verbose --output-document=codecov https://github.com/codecov/uploader/releases/download/v0.7.0/codecov-linux | |
chmod +x codecov | |
./codecov -f bazel-out/_coverage/_coverage_report.dat | |
linux-gcc-13-no-exceptions: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
container: gcc:13.1.0 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: wget --no-verbose --output-document=bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64 && chmod +x bazelisk | |
- run: ./bazelisk test etest/... --copt=-fno-exceptions | |
linux-aarch64-muslc: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/bazel | |
key: aarch64_linux_muslc-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }} | |
restore-keys: aarch64_linux_muslc- | |
- run: sudo apt-get update && sudo apt-get install -y --no-install-recommends qemu-user-static binfmt-support | |
- run: sudo update-binfmts --enable qemu-aarch64 | |
- run: wget --no-verbose --output-document=bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v1.18.0/bazelisk-linux-amd64 && chmod +x bazelisk | |
- run: echo "build --config=linux-aarch64-musl" >.bazelrc.local | |
# TODO(robinlinden): Improve. We shouldn't be excluding targets like this. | |
# Include all targets except for | |
# * py_test targets: not fully statically linked | |
# * targets that depend on sfml: it pulls in host dependencies. | |
- run: ./bazelisk test -- $(bazel query '... except (kind("py_test", ...) union rdeps(..., @sfml//:window))') | |
- name: Run tui | |
run: | | |
echo "<html><body><h1>Example</h1><p>This is an example page.</p></body></html>" >example.html | |
./bazelisk run browser:tui file://$(pwd)/example.html | |
windows-msvc: | |
runs-on: windows-2022 | |
timeout-minutes: 30 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/bazel | |
key: windows_msvc-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }} | |
- run: echo "build --disk_cache ~/.cache/bazel" >.bazelrc.local | |
- name: Build | |
run: bazel build ... -c dbg | |
- name: Test | |
run: bazel test ... -c dbg | |
# TODO(robinlinden): This no longer runs in CI due to http://example.com | |
# being inaccessible. | |
# - name: Run | |
# run: bazel run browser:tui -c dbg | |
windows-clang-cl: | |
runs-on: windows-2022 | |
timeout-minutes: 45 | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/bazel | |
key: windows_clang_cl-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }} | |
- run: echo "build --config clang-cl" >.bazelrc.local | |
- run: echo "build --disk_cache ~/.cache/bazel" >>.bazelrc.local | |
- run: bazel test ... | |
# TODO(robinlinden): This no longer runs in CI due to http://example.com | |
# being inaccessible. | |
# - run: bazel run browser:tui | |
clang-format: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up the llvm repository | |
run: | | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" | |
- run: sudo apt-get update && sudo apt-get install --no-install-recommends clang-format-15 | |
- name: Format | |
run: find . -name "*.h" -o -name "*.cpp" | xargs clang-format-15 -style=file -i | |
- name: Check | |
run: git diff --exit-code | |
clang-tidy: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/bazel | |
key: clang_tidy-${{ hashFiles('.bazelversion', 'WORKSPACE', 'third_party/**') }} | |
restore-keys: clang_tidy- | |
- name: Set up the llvm repository | |
run: | | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
sudo apt-add-repository "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" | |
- run: sudo apt-get update && sudo apt-get install --no-install-recommends clang-tidy-17 | |
- run: echo "CC=clang-17" >>$GITHUB_ENV && echo "CXX=clang++-17" >>$GITHUB_ENV | |
- run: | | |
sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-17 100 | |
sudo update-alternatives --set clang-tidy /usr/bin/clang-tidy-17 | |
update-alternatives --query clang-tidy | |
clang-tidy --version | |
- run: bazel build ... --config clang-tidy --keep_going | |
buildifier: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install | |
run: | | |
wget --output-document=buildifier https://github.com/bazelbuild/buildtools/releases/download/v6.3.3/buildifier-linux-amd64 | |
sudo chmod +x buildifier | |
- name: Check | |
run: ./buildifier --lint=warn --warnings=all -mode diff WORKSPACE $(find . -type f -iname "*.BUILD" -or -iname BUILD -or -iname "*.bzl") | |
prettier: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: npm install --global [email protected] | |
# Prettier thinks our fragment shaders are JS-something and complains | |
# about syntax errors. | |
- run: npx prettier --ignore-path .gitignore --write . '!**/*.frag' | |
- run: git diff --exit-code | |
shfmt: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: wget --output-document=shfmt https://github.com/mvdan/sh/releases/download/v3.7.0/shfmt_v3.7.0_linux_amd64 && chmod +x shfmt | |
- run: ./shfmt -i 2 -w $(./shfmt -f .) | |
- run: git diff --exit-code | |
link-liveness: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- run: grep --recursive --no-filename --only-matching --exclude-dir="*corpus" --exclude=WORKSPACE --exclude=*test.cpp --exclude=ci.yaml 'https://[^)(}{",# ]*' | grep -v '^https://$' | sort | uniq | xargs wget --spider | |
gitlint: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- run: pip install gitlint==0.19.1 | |
- run: gitlint --commits origin/master.. | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true |