12set -euo pipefail34script_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"5repo_dir="$(cd -- "$script_dir/.." && pwd -P)"6cd "$repo_dir"78if [[ -f "$HOME/.cargo/env" ]]; then9 # shellcheck source=/dev/null10 source "$HOME/.cargo/env"11fi1213./scripts/run-linux-cross-build-gate.sh1415for command_name in cargo rustc node git ffmpeg shellcheck; do16 if ! command -v "$command_name" >/dev/null 2>&1; then17 printf 'required command is missing: %s\n' "$command_name" >&218 exit 119 fi20done2122case "${GOQ_VERIFY_IN_PROCESS_GSTREAMER:-0}" in23 0|1) ;;24 *)25 printf 'GOQ_VERIFY_IN_PROCESS_GSTREAMER must be 0 or 1\n' >&226 exit 127 ;;28esac2930case "${GOQ_REQUIRE_LINUX_CROSS_BUILD:-0}" in31 0|1) ;;32 *)33 printf 'GOQ_REQUIRE_LINUX_CROSS_BUILD must be 0 or 1\n' >&234 exit 135 ;;36esac3738if [[ "${GOQ_REQUIRE_LINUX_CROSS_BUILD:-0}" == 1 ]]; then39 for cross_command in cargo-zigbuild zig; do40 if ! command -v "$cross_command" >/dev/null 2>&1; then41 printf 'required Linux cross-build command is missing: %s\n' \42 "$cross_command" >&243 exit 144 fi45 done46fi4748require_rust_test() {49 local test_name="$1"50 shift51 local test_list5253 test_list="$(cargo test --locked "$@" -- --list)"54 if ! grep -Eq "(^|::)${test_name}: test$" <<<"$test_list"; then55 printf 'required Rust test is not discoverable: %s\n' "$test_name" >&256 exit 157 fi58}5960if [[ "${GOQ_VERIFY_IN_PROCESS_GSTREAMER:-0}" == 1 ]]; then61 command -v gst-inspect-1.0 >/dev/null 2>&1 || {62 echo 'in-process GStreamer gate requires gst-inspect-1.0' >&263 exit 164 }65 for gstreamer_element in videotestsrc queue videoconvert videoscale capsfilter x264enc h264parse appsink; do66 gst-inspect-1.0 "$gstreamer_element" >/dev/null || {67 printf 'in-process GStreamer gate requires the %s plugin\n' \68 "$gstreamer_element" >&269 exit 170 }71 done72fi7374printf 'repo=%s\n' "$repo_dir"75printf 'revision=%s\n' "$(git rev-parse HEAD)"76rustc --version77cargo --version7879require_rust_test 'resolves_pinned_upstream_gamescope_pipewire_contract' \80 -p sigil-host --bin sigil81cargo fmt --all -- --check82cargo test --locked --workspace --all-targets83cargo clippy --locked --workspace --all-targets -- -D warnings84cargo check --locked -p portal --all-targets \85 --features experimental-non-macos-pointer-capture86echo 'experimental_non_macos_pointer_capture_compile=ok'87if [[ "${GOQ_VERIFY_IN_PROCESS_GSTREAMER:-0}" == 1 ]]; then88 control_test='encoder_control_coalesces_latest_state_and_acknowledges_only_configured_idr'89 gstreamer_test='in_process_gstreamer_x264_smoke'90 require_rust_test "$control_test" -p sigil-host91 cargo test --locked -p sigil-host "$control_test"92 cargo check --locked -p sigil-host --all-targets --features in-process-gstreamer93 require_rust_test "$gstreamer_test" -p sigil-host --features in-process-gstreamer94 cargo test --locked -p sigil-host --features in-process-gstreamer \95 "$gstreamer_test" -- --ignored --nocapture96 echo 'in_process_gstreamer_gate=ok'97fi98while IFS= read -r frontend_source; do99 node --check "$frontend_source"100done < <(find portal -maxdepth 1 -type f \( -name '*.js' -o -name '*.mjs' \) -print | sort)101node --test portal/*.test.mjs102103cargo build --locked -p sigil-host --bin sigil104find scripts -type f -name '*.sh' -exec shellcheck {} +105./scripts/run-shell-tests.sh scripts/tests106107host_dependencies="$(cargo tree --locked -p sigil-host --edges normal)"108if grep -Eiq '(^|[[:space:]├└│─])(tauri|wry|webkit)([[:space:]-]|$)' <<<"$host_dependencies"; then109 echo 'pure host dependency gate failed: desktop/webview dependency detected' >&2110 grep -Ei 'tauri|wry|webkit' <<<"$host_dependencies" >&2111 exit 1112fi113114catalog_dependencies="$({115 cargo tree --locked -p sigil-host --edges normal116 cargo tree --locked -p portal --edges normal117})"118if grep -Eiq '(^|[[:space:]├└│─])(moq-media|moq-mux)([[:space:]-]|$)' <<<"$catalog_dependencies"; then119 echo 'MoQ catalog boundary failed: standard-media dependency detected' >&2120 grep -Ei 'moq-media|moq-mux' <<<"$catalog_dependencies" >&2121 exit 1122fi123124./scripts/loopback-proof.sh125./scripts/loopback-proof.sh --profile debug --control-v2 --viewers 3 \126 --primary-frames 600 --reconnect-cycles 3127./scripts/loopback-proof.sh --profile debug --control-v2 --viewers 3 \128 --focus-handoffs 3 --assert-neutral-before-successor \129 --primary-frames 600 --reconnect-cycles 3130./scripts/loopback-proof.sh --profile release --legacy-exclusive --viewers 2 \131 --expect-second-rejected132133cargo test --locked -p portal --release \134 commands::state::tests::rejects_direct_node_when_debug_mode_is_disabled \135 -- --exact136137cargo test --locked -p portal --release \138 commands::state::tests::ordinary_release_excludes_direct_node_bypass \139 -- --exact140141cargo test --locked -p portal --release --features demo-direct-node \142 commands::state::tests::app_state_accepts_direct_node_only_in_debug_builds \143 -- --exact144145cargo test --locked -p sigil-host --release \146 tests::ordinary_release_excludes_configured_host_auth_bypass \147 -- --exact148149cargo test --locked -p sigil-host --release --features demo-auth-bypass \150 tests::configured_host_auth_bypass_is_explicitly_build_contained \151 -- --exact152153git diff --check154echo 'demo_build_preflight=ok'