#!/usr/bin/env bash # Validate prerequisites without installing packages or modifying the runner host. set -euo pipefail fail() { printf 'Runner prerequisite: %s\n' "$*" >&2; exit 1; } for tool in git curl unzip python3; do command -v "$tool" >/dev/null || fail "install $tool in the job environment" done case "${1:-}" in android|emulator) [[ "$(uname -s)" == Linux && "$(uname -m)" == x86_64 ]] || fail 'ubuntu-latest must provide Linux x86_64' if [[ "$1" == emulator ]]; then [[ -c /dev/kvm && -r /dev/kvm && -w /dev/kvm ]] || fail 'expose /dev/kvm to the job and grant the runner user read/write access (nested virtualization required on VMs)' fi ;; ios) [[ "$(uname -s)" == Darwin && "$(uname -m)" == arm64 ]] || fail 'macos-arm64 must execute natively on the Apple Silicon host' command -v xcodebuild >/dev/null || fail 'install full Xcode and select it with xcode-select' xcodebuild -version xcrun --find swift >/dev/null xcrun simctl list devices available >/dev/null ;; *) fail 'usage: bash scripts/check-ci-runner.sh android|emulator|ios' ;; esac