diff --git a/scripts/test-swift.sh b/scripts/test-swift.sh index 8f87822..7101dda 100755 --- a/scripts/test-swift.sh +++ b/scripts/test-swift.sh @@ -5,9 +5,13 @@ repository_root="${0:A:h:h}" export CLANG_MODULE_CACHE_PATH="${CLANG_MODULE_CACHE_PATH:-/private/tmp/atrium-capture-clang-cache}" export SWIFTPM_MODULECACHE_OVERRIDE="${SWIFTPM_MODULECACHE_OVERRIDE:-/private/tmp/atrium-capture-swift-cache}" -if [[ "$(uname -s)" == "Darwin" && "$(xcode-select -p)" == *"Xcode.app"* ]]; then +platform="$(uname -s)" + +if [[ "$platform" == "Darwin" ]] && + command -v xcodebuild >/dev/null 2>&1 && + xcodebuild -version >/dev/null 2>&1; then swift test --disable-sandbox --package-path "$repository_root/apps/macos" -elif [[ "$(uname -s)" != "Darwin" ]]; then +elif [[ "$platform" != "Darwin" ]]; then swift test --package-path "$repository_root/apps/macos" elif command -v docker >/dev/null 2>&1; then docker run --rm \