30 lines
1.8 KiB
Bash
30 lines
1.8 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
: "${SB_SIMULATOR_ID:?Set SB_SIMULATOR_ID to a booted iOS simulator UUID}"
|
|
BASE="${TMPDIR:-/tmp}"
|
|
RUN_ROOT="${SB_RUN_ROOT:-$(mktemp -d "$BASE/sub-banner-touch.XXXXXX")}"
|
|
export TMPDIR="$RUN_ROOT/tmp" CLANG_MODULE_CACHE_PATH="$RUN_ROOT/clang" SWIFT_MODULECACHE_PATH="$RUN_ROOT/modules"
|
|
export NODE_COMPILE_CACHE="$RUN_ROOT/node" BUN_RUNTIME_TRANSPILER_CACHE_PATH="$RUN_ROOT/bun"
|
|
mkdir -p "$TMPDIR"
|
|
MODULES=("$HOME"/Library/Developer/Xcode/DerivedData/SodaLive-*/Build/Products/Debug-iphonesimulator/Kingfisher.swiftmodule)
|
|
KINGFISHER="${KINGFISHER_MODULE_PATH:-$(dirname "${MODULES[0]}")}"
|
|
NAME="${SB_RUN_NAME:-tests}"
|
|
CAROUSEL_SOURCE="${SB_CAROUSEL_SOURCE:-$ROOT/SodaLive/Sources/V2/Component/Banner/SubBannerCarousel.swift}"
|
|
ruby "$ROOT/work/tests/generate-sub-banner-gesture-project.rb" "$ROOT" "$RUN_ROOT" "$KINGFISHER" "$CAROUSEL_SOURCE"
|
|
shasum -a 256 "$ROOT/SodaLive/Sources/V2/Component/Banner/SubBannerCarousel.swift" > "$RUN_ROOT/$NAME-before.sha256"
|
|
shasum -a 256 "$CAROUSEL_SOURCE" > "$RUN_ROOT/$NAME-compiled.sha256"
|
|
printf 'Owned root: %s\n' "$RUN_ROOT"
|
|
set +e
|
|
xcodebuild -project "$RUN_ROOT/Gesture.xcodeproj" -scheme Gesture -configuration Debug \
|
|
-destination "platform=iOS Simulator,id=$SB_SIMULATOR_ID" \
|
|
-derivedDataPath "$RUN_ROOT/build" -resultBundlePath "$RUN_ROOT/$NAME.xcresult" \
|
|
-parallel-testing-enabled NO -maximum-concurrent-test-simulator-destinations 1 \
|
|
test "$@" > "$RUN_ROOT/$NAME.log" 2>&1
|
|
RESULT=$?
|
|
set -e
|
|
shasum -a 256 "$ROOT/SodaLive/Sources/V2/Component/Banner/SubBannerCarousel.swift" > "$RUN_ROOT/$NAME-after.sha256"
|
|
rg 'Test Case|Executed|error:|failed|passed|TEST SUCCEEDED|TEST FAILED' "$RUN_ROOT/$NAME.log" || true
|
|
printf 'xcodebuild exit: %s; log: %s/%s.log\n' "$RESULT" "$RUN_ROOT" "$NAME"
|
|
exit "$RESULT"
|