@@ -45,36 +45,54 @@ run_yarn_script() {
4545 rm -f " $log_file "
4646}
4747
48+ # Run yarn scripts in parallel; fail if any child fails.
49+ # Uses job-control style: background jobs + wait, SIGINT kills the group.
50+ run_yarn_scripts_parallel () {
51+ local scripts=(" $@ " )
52+ local pids=()
53+ local pid failed=0
54+
55+ (
56+ trap ' kill 0' SIGINT
57+
58+ for script_name in " ${scripts[@]} " ; do
59+ run_yarn_script " $script_name " &
60+ pids+=($! )
61+ done
62+
63+ for pid in " ${pids[@]} " ; do
64+ wait " $pid " || failed=1
65+ done
66+
67+ exit " $failed "
68+ ) || return 1
69+ }
70+
4871echo " Starting full test execution..."
4972
5073# 1. Dependency Installation
5174echo " Installing dependencies..."
5275run_yarn_script " install" || { echo " yarn install failed" ; exit 1; }
53- run_yarn_script " tests:ios:pod:install" || { echo " iOS pod install failed" ; exit 1; }
54- run_yarn_script " tests:macos:pod:install" || { echo " macOS pod install failed" ; exit 1; }
55-
56- # 2. Build Verification
57- echo " Verifying builds..."
58- run_yarn_script " tests:ios:build" || { echo " iOS build failed" ; exit 1; }
59- run_yarn_script " tests:macos:build" || { echo " macOS build failed" ; exit 1; }
60- run_yarn_script " tests:android:build" || { echo " Android build failed" ; exit 1; }
61-
62- # 3. Typechecking
63- echo " Running typechecks..."
64- run_yarn_script " compare:types" || { echo " Type comparison failed" ; exit 1; }
65-
66- # 4. Linting and Formatting
67- echo " Running linting and formatting checks..."
68- run_yarn_script " lint:js" || { echo " Javascript linting failed" ; exit 1; }
69- run_yarn_script " lint:ios:check" || { echo " iOS Linting failed" ; exit 1; }
70- # disabled lint:android because it is flaky at the moment?
71- # yarn lint:android || { echo "Android Linting failed"; exit 1; }
72- run_yarn_script " lint:markdown" || { echo " Markdown linting failed" ; exit 1; }
73- run_yarn_script " lint:spellcheck" || { echo " Spellchecking failed" ; exit 1; }
74-
75- # 5. Unit Tests
76- echo " Running unit tests..."
77- run_yarn_script " tests:jest" || { echo " Unit tests failed" ; exit 1; }
76+
77+ echo " Installing iOS and macOS pods in parallel..."
78+ run_yarn_scripts_parallel \
79+ " tests:ios:pod:install" \
80+ " tests:macos:pod:install" \
81+ || { echo " Pod install failed" ; exit 1; }
82+
83+ # 2–5. Builds, typechecks, lint, and unit tests (all parallel)
84+ echo " Running builds, typechecks, lint, and unit tests in parallel..."
85+ run_yarn_scripts_parallel \
86+ " tests:ios:build" \
87+ " tests:macos:build" \
88+ " tests:android:build" \
89+ " compare:types" \
90+ " lint:js" \
91+ " lint:ios:check" \
92+ " lint:markdown" \
93+ " lint:spellcheck" \
94+ " tests:jest" \
95+ || { echo " Parallel verification failed" ; exit 1; }
7896
7997# 6. E2E Tests with Flakiness Tolerance
8098echo " Running E2E tests..."
0 commit comments