55set -e
66# Create temporary directory for logs
77TMP_DIR=$( mktemp -d)
8+ echo " Step logs directory: $TMP_DIR "
89
910# Clean up any stale metro bundler or firebase emulator processes
1011function terminate_testing_processes() {
@@ -37,8 +38,8 @@ run_yarn_script() {
3738 # Run the yarn command and redirect output to log file
3839 if ! yarn " $script_name " > " $log_file " 2>&1 ; then
3940 echo " Command failed: yarn $script_name "
41+ echo " Full log preserved at: $log_file "
4042 cat " $log_file "
41- rm -f " $log_file "
4243 return 1
4344 fi
4445
@@ -50,20 +51,35 @@ run_yarn_script() {
5051run_yarn_scripts_parallel () {
5152 local scripts=(" $@ " )
5253 local pids=()
53- local pid failed=0
54+ local script_names=()
55+ local failed_scripts=()
56+ local i=0
57+ local failed=0
5458
5559 (
5660 trap ' kill 0' SIGINT
5761
5862 for script_name in " ${scripts[@]} " ; do
5963 run_yarn_script " $script_name " &
6064 pids+=($! )
65+ script_names+=(" $script_name " )
6166 done
6267
6368 for pid in " ${pids[@]} " ; do
64- wait " $pid " || failed=1
69+ if ! wait " $pid " ; then
70+ failed=1
71+ failed_scripts+=(" ${script_names[$i]} " )
72+ fi
73+ i=$(( i + 1 ))
6574 done
6675
76+ if [ " $failed " -ne 0 ]; then
77+ echo " Parallel step failed. Preserved logs in: $TMP_DIR "
78+ for script_name in " ${failed_scripts[@]} " ; do
79+ echo " - ${TMP_DIR} /${script_name} .log"
80+ done
81+ fi
82+
6783 exit " $failed "
6884 ) || return 1
6985}
@@ -72,13 +88,13 @@ echo "Starting full test execution..."
7288
7389# 1. Dependency Installation
7490echo " Installing dependencies..."
75- run_yarn_script " install" || { echo " yarn install failed" ; exit 1; }
91+ run_yarn_script " install" || { echo " yarn install failed. Logs preserved in: $TMP_DIR " ; exit 1; }
7692
7793echo " Installing iOS and macOS pods in parallel..."
7894run_yarn_scripts_parallel \
7995 " tests:ios:pod:install" \
8096 " tests:macos:pod:install" \
81- || { echo " Pod install failed" ; exit 1; }
97+ || { echo " Pod install failed. Logs preserved in: $TMP_DIR " ; exit 1; }
8298
8399# 2–5. Builds, typechecks, lint, and unit tests (all parallel)
84100echo " Running builds, typechecks, lint, and unit tests in parallel..."
@@ -92,7 +108,7 @@ run_yarn_scripts_parallel \
92108 " lint:markdown" \
93109 " lint:spellcheck" \
94110 " tests:jest" \
95- || { echo " Parallel verification failed" ; exit 1; }
111+ || { echo " Parallel verification failed. Logs preserved in: $TMP_DIR " ; exit 1; }
96112
97113# 6. E2E Tests with Flakiness Tolerance
98114echo " Running E2E tests..."
@@ -114,10 +130,13 @@ sleep 30
114130# Run E2E tests - 3 chances to succeed for flake tolerance
115131for flavor in " ios" " android" " macos" ; do
116132 for i in {1..3}; do
117- echo " Running $flavor E2E test run attempt $i ..."
118- if ! yarn tests:" $flavor " :test; then
133+ e2e_log=" ${TMP_DIR} /tests:${flavor} :test.attempt${i} .log"
134+ echo " Running $flavor E2E test run attempt $i ... (log: $e2e_log )"
135+ if ! yarn tests:" $flavor " :test > " $e2e_log " 2>&1 ; then
136+ echo " E2E attempt failed. Full log preserved at: $e2e_log "
137+ cat " $e2e_log "
119138 if [ $i -eq 3 ]; then
120- echo " $flavor E2E test failed all $i attempts." ;
139+ echo " $flavor E2E test failed all $i attempts. Logs preserved in: $TMP_DIR "
121140 terminate_testing_processes
122141 exit 1;
123142 fi
0 commit comments