-
Notifications
You must be signed in to change notification settings - Fork 4
chore(scripts): update e2e-maestro.sh #368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1140ac8
eb1a84b
463f959
1a9c819
1659920
ff06e4e
98d771a
3d2e5fd
13a6965
4d6eb26
d654c74
f55f409
f2852ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [install] | ||
| linker = "hoisted" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| [install] | ||
| linker = "hoisted" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,11 +2,15 @@ | |
|
|
||
| trap 'exit' INT | ||
|
|
||
| # Save the script directory (project root) | ||
| SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" | ||
|
|
||
| PLATFORM=${1:-} | ||
| EXAMPLE_DIR=${2:-} | ||
| PACKAGE_TYPE=${3:-} | ||
|
|
||
| echo "🚀 Running e2e tests for $PLATFORM" | ||
| echo "🚀 Running e2e video recording for $PLATFORM" | ||
| echo "📂 Project root: $SCRIPT_DIR" | ||
|
|
||
| # Validate passed platform | ||
| case $PLATFORM in | ||
|
|
@@ -46,17 +50,29 @@ if [ "$PLATFORM" == "ios" ]; then | |
|
|
||
| # Build the app with optimizations and pretty output | ||
| export USE_CCACHE=1 | ||
| # Configure ccache if available (optional optimization) | ||
| if command -v ccache >/dev/null 2>&1; then | ||
| export CCACHE_DIR="${CCACHE_DIR:-$HOME/Library/Caches/ccache}" | ||
| mkdir -p "$CCACHE_DIR" | ||
| export PATH="/opt/homebrew/bin:$PATH" | ||
| echo "✅ ccache is available" | ||
| echo "📦 ccache directory: $CCACHE_DIR" | ||
| ccache --max-size=2G 2>/dev/null || true | ||
| else | ||
| echo "⚠️ ccache not found (optional). Install with: brew install ccache" | ||
| fi | ||
|
|
||
| buildCmd="xcodebuild \ | ||
| CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ \ | ||
| -derivedDataPath build \ | ||
| -UseModernBuildSystem=YES \ | ||
| -workspace $SCHEME.xcworkspace \ | ||
| -configuration Release \ | ||
| -scheme $SCHEME \ | ||
| -configuration Release \ | ||
| -destination id=$iphone16Id \ | ||
| -parallelizeTargets \ | ||
| -derivedDataPath build \ | ||
| -jobs $(sysctl -n hw.ncpu) \ | ||
| ONLY_ACTIVE_ARCH=YES \ | ||
| ARCHS=arm64 \ | ||
| VALID_ARCHS=arm64 \ | ||
| EXCLUDED_ARCHS=x86_64 \ | ||
| CODE_SIGNING_ALLOWED=NO" | ||
|
|
||
| echo "🔨 Building iOS app..." | ||
|
|
@@ -92,7 +108,8 @@ if [ "$PLATFORM" == "ios" ]; then | |
| echo "📲 Installing app from: $APP_PATH" | ||
| xcrun simctl install $iphone16Id "$APP_PATH" | ||
|
|
||
| cd ../../.. | ||
| # Return to project root | ||
| cd "$SCRIPT_DIR" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Fail fast if returning to the project root fails. Both - cd "$SCRIPT_DIR"
+ cd "$SCRIPT_DIR" || exit 1- cd "$SCRIPT_DIR"
+ cd "$SCRIPT_DIR" || exit 1Also applies to: 135-135 🧰 Tools🪛 Shellcheck (0.11.0)[warning] 112-112: Use 'cd ... || exit' or 'cd ... || return' in case cd fails. (SC2164) 🤖 Prompt for AI Agents |
||
| else | ||
| cd $EXAMPLE_DIR/android | ||
| chmod +x ./gradlew | ||
|
|
@@ -113,35 +130,40 @@ else | |
| # Stop Gradle daemon to free up memory | ||
| echo "🧹 Stopping Gradle daemon..." | ||
| ./gradlew --stop | ||
| cd ../../.. | ||
|
|
||
| # Return to project root | ||
| cd "$SCRIPT_DIR" | ||
| fi | ||
|
|
||
| echo "📂 Script directory: $(pwd)" | ||
| echo "" | ||
|
|
||
| test_file="e2e-tests/$PACKAGE_TYPE.e2e.yaml" | ||
|
|
||
| echo "🧪 Using test file: $test_file" | ||
| echo "🎬 Using flow file for recording: $test_file" | ||
|
|
||
| if [ ! -f "$test_file" ]; then | ||
| echo "❌ Error! Test file not found: $test_file" | ||
| echo "❌ Error! Flow file not found: $test_file" | ||
| echo "" | ||
| exit 1 | ||
| fi | ||
|
|
||
| testCmd="maestro test \"$test_file\" -e APP_ID=$APP_ID --flatten-debug-output" | ||
| echo "🎯 Running test: $testCmd" | ||
| # Create output directory for videos | ||
| mkdir -p e2e-artifacts | ||
|
|
||
| recordCmd="maestro record \"$test_file\" -e APP_ID=$APP_ID --local" | ||
| echo "🎯 Recording test video: $recordCmd" | ||
| echo "📱 APP_ID: $APP_ID" | ||
|
|
||
|
|
||
| if ! eval "$testCmd --debug-output e2e-artifacts/$PACKAGE_TYPE"; then | ||
| echo "Test ${test_file} failed. Retrying in 30 seconds..." | ||
| if ! eval "$recordCmd --debug-output e2e-artifacts/$PACKAGE_TYPE"; then | ||
| echo "Recording ${test_file} failed. Retrying in 30 seconds..." | ||
| sleep 30 | ||
| if ! eval "$testCmd --debug-output e2e-artifacts/$PACKAGE_TYPE-retry-1"; then | ||
| echo "Test ${test_file} failed again. Retrying for the last time in 120 seconds..." | ||
| if ! eval "$recordCmd --debug-output e2e-artifacts/$PACKAGE_TYPE-retry-1"; then | ||
| echo "Recording ${test_file} failed again. Retrying for the last time in 120 seconds..." | ||
| sleep 120 | ||
| if ! eval "$testCmd --debug-output e2e-artifacts/$PACKAGE_TYPE-retry-2"; then | ||
| echo "Test ${test_file} failed again. Exiting..." | ||
| if ! eval "$recordCmd --debug-output e2e-artifacts/$PACKAGE_TYPE-retry-2"; then | ||
| echo "Recording ${test_file} failed again. Exiting..." | ||
| exit 1 | ||
| fi | ||
| fi | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iOS build arch overrides are non‑portable;
VALID_ARCHSis deprecated.Hard‑forcing
ARCHS=arm64andEXCLUDED_ARCHS=x86_64breaks Intel runners;VALID_ARCHSno longer respected in modern Xcode. Prefer letting the simulator SDK resolve archs or gate by host CPU.Optionally gate EXCLUDED_ARCHS by host: