Skip to content

chore: add background binary wrapper and standalone adapter-cycle pro… #8

chore: add background binary wrapper and standalone adapter-cycle pro…

chore: add background binary wrapper and standalone adapter-cycle pro… #8

name: integration tests
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
macos:
name: macOS (Metal)
runs-on: macos-15
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
# Pinned to the version the plugin is developed/verified against —
# newer stable's integration-test result drain undercounts on fast
# suites (all tests pass in-app, tool exits 1).
flutter-version: 3.44.4
cache: true
- name: Cache wgpu-native
uses: actions/cache@v4
with:
path: |
src/third_party/wgpu_native
macos/nitro_webgpu/Frameworks
ios/nitro_webgpu/Frameworks
key: wgpu-native-${{ runner.os }}-${{ hashFiles('scripts/wgpu_native.sha256') }}
- name: Fetch wgpu-native
run: ./scripts/fetch_wgpu_native.sh --targets macos-aarch64,macos-x86_64,ios-aarch64,ios-aarch64-simulator,ios-x86_64-simulator
- name: Release build (symbol survival gate)
working-directory: example
run: |
flutter pub get
flutter build macos --release
- name: Integration tests
working-directory: example
run: flutter test integration_test/wgpu_instance_test.dart -d macos --reporter expanded
- name: Complex parity tests
working-directory: example
run: flutter test integration_test/wgpu_parity_complex_test.dart -d macos --reporter expanded
linux:
name: Linux (lavapipe software Vulkan)
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
# Pinned to the version the plugin is developed/verified against —
# newer stable's integration-test result drain undercounts on fast
# suites (all tests pass in-app, tool exits 1).
flutter-version: 3.44.4
cache: true
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev mesa-vulkan-drivers mesa-utils libgl1-mesa-dri libegl1 vulkan-tools xvfb
- name: Cache wgpu-native
uses: actions/cache@v4
with:
path: src/third_party/wgpu_native
key: wgpu-native-${{ runner.os }}-${{ hashFiles('scripts/wgpu_native.sha256') }}
- name: Fetch wgpu-native
run: ./scripts/fetch_wgpu_native.sh --targets linux-x86_64
- name: Release build (symbol survival gate)
working-directory: example
run: |
flutter pub get
flutter build linux --release
- name: Integration tests (fallback adapter)
working-directory: example
# LIBGL_ALWAYS_SOFTWARE: the GTK embedder needs working GL for the
# raster thread; under Xvfb that must be Mesa llvmpipe, not a GPU
# probe that can abort the app at first frame.
# ulimit -n: every lavapipe VkDevice costs fds + a thread pool; the
# suite creates a device per test and the runner default (1024) runs
# out mid-suite — wgpuInstanceRequestAdapter then panics (core-dump
# verified).
env:
LIBGL_ALWAYS_SOFTWARE: "1"
run: |
ulimit -n 8192
xvfb-run -a -s "-screen 0 1280x800x24" flutter test integration_test/wgpu_instance_test.dart -d linux --dart-define=WGPU_FORCE_FALLBACK=true --reporter expanded
- name: Complex parity tests (fallback adapter)
working-directory: example
env:
LIBGL_ALWAYS_SOFTWARE: "1"
run: |
ulimit -n 8192
xvfb-run -a -s "-screen 0 1280x800x24" flutter test integration_test/wgpu_parity_complex_test.dart -d linux --dart-define=WGPU_FORCE_FALLBACK=true --reporter expanded
- name: Crash diagnostics (core-dump backtrace + app stderr)
if: failure()
working-directory: example
env:
LIBGL_ALWAYS_SOFTWARE: "1"
run: |
sudo apt-get install -y gdb
sudo sysctl -w kernel.core_pattern=/tmp/core.%p
ulimit -c unlimited
# Wrap the app binary so its stderr (Rust panic messages — the
# flutter tool discards child stderr) lands in a file we can print.
# `flutter test` reinstalls the bundle at the start of every
# invocation, so a background watcher re-wraps the fresh binary in
# the build→launch gap.
BUNDLE=build/linux/x64/debug/bundle
wrap_binary() {
if [ -f "$BUNDLE/nitro_webgpu_example" ] \
&& ! head -c2 "$BUNDLE/nitro_webgpu_example" | grep -q '#!'; then
mv "$BUNDLE/nitro_webgpu_example" "$BUNDLE/nitro_webgpu_example.real"
cat > "$BUNDLE/nitro_webgpu_example" <<'WRAP'
#!/bin/bash
exec "$(dirname "$0")/nitro_webgpu_example.real" "$@" 2>>/tmp/app_stderr.log
WRAP
chmod +x "$BUNDLE/nitro_webgpu_example"
echo "(re)wrapped app binary"
fi
}
wrap_binary
( while true; do wrap_binary; sleep 0.3; done ) &
WATCHER=$!
xvfb-run -a -s "-screen 0 1280x800x24" flutter test integration_test/wgpu_instance_test.dart -d linux \
--dart-define=WGPU_FORCE_FALLBACK=true --reporter expanded || true
kill $WATCHER 2>/dev/null || true
echo "=== app stderr ==="
tail -80 /tmp/app_stderr.log 2>/dev/null || echo "(no stderr captured)"
echo "=== standalone adapter-cycle probe (wgpu panic goes to visible stderr) ==="
cc ../scripts/ci/adapter_cycle_probe.c \
../src/third_party/wgpu_native/linux-x86_64/lib/libwgpu_native.a \
-I../src/third_party/wgpu_native/include -lm -ldl -lpthread \
-o /tmp/adapter_cycle_probe
/tmp/adapter_cycle_probe 2>&1 | tail -8 || echo "PROBE CRASHED (exit $?)"
shopt -s nullglob
cores=(/tmp/core.*)
if [ ${#cores[@]} -eq 0 ]; then echo "NO CORE PRODUCED"; exit 0; fi
for c in "${cores[@]}"; do
echo "=== crashing-thread backtrace for $c ==="
gdb -batch -ex "bt" \
build/linux/x64/debug/bundle/nitro_webgpu_example "$c" 2>/dev/null | tail -60
echo "=== all threads (nitro/wgpu frames only) for $c ==="
gdb -batch -ex "thread apply all bt" \
build/linux/x64/debug/bundle/nitro_webgpu_example "$c" 2>/dev/null \
| grep -B2 -A8 -iE "nwp_|nitro|wgpu|HybridNitro" | head -200
done
windows:
name: Windows (D3D12 WARP)
runs-on: windows-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
# Pinned to the version the plugin is developed/verified against —
# newer stable's integration-test result drain undercounts on fast
# suites (all tests pass in-app, tool exits 1).
flutter-version: 3.44.4
cache: true
- name: Cache wgpu-native
uses: actions/cache@v4
with:
path: src/third_party/wgpu_native
key: wgpu-native-${{ runner.os }}-${{ hashFiles('scripts/wgpu_native.sha256') }}
- name: Fetch wgpu-native
shell: bash
run: ./scripts/fetch_wgpu_native.sh --targets windows-x86_64-msvc
- name: Release build (symbol survival gate)
working-directory: example
run: |
flutter pub get
flutter build windows --release
- name: Integration tests (fallback adapter)
working-directory: example
run: flutter test integration_test/wgpu_instance_test.dart -d windows --dart-define=WGPU_FORCE_FALLBACK=true --reporter expanded
- name: Complex parity tests (fallback adapter)
working-directory: example
run: flutter test integration_test/wgpu_parity_complex_test.dart -d windows --dart-define=WGPU_FORCE_FALLBACK=true --reporter expanded
- name: Crash diagnostics (isolate read-only depth test)
if: failure()
working-directory: example
shell: bash
run: |
flutter test integration_test/wgpu_parity_complex_test.dart -d windows \
--dart-define=WGPU_FORCE_FALLBACK=true --reporter expanded \
--plain-name "read-only depth attachment still depth-tests draws" 2>&1 | tail -60