@@ -196,28 +196,36 @@ jobs:
196196
197197 - id : set-matrix
198198 run : |
199- # Find all smoke test files and create matrix entries
200199 json_array=$(
201200 for module_dir in smoke-tests/apps/*/; do
201+ # Convert directory path to module name (e.g., "smoke-tests/apps/MyApp/" -> "smoke-tests:apps:MyApp")
202202 module=$(echo "$module_dir" | sed 's|/$||' | sed 's|/|:|g')
203+ # Extract just the app name from the module path (e.g., "smoke-tests:apps:MyApp" -> "MyApp")
203204 module_name=$(echo "$module" | sed 's|.*:||')
204- find "${module_dir}src/smokeTest/java" -name "*Test.java" -type f | \
205+
206+ find "${module_dir}src/smokeTest/java" -name "*Test.java" | \
207+ # Remove the base path to get relative path from smokeTest/java
205208 sed "s|${module_dir}src/smokeTest/java/||" | \
206- sed 's|/|.|g' | \
207- sed 's|\.java$||' | \
208- while read -r full_class; do
209- echo "{\"display\":\"${module_name}:${full_class##*.}\",\"module\":\"${module}\",\"test_class\":\"${full_class}\"}"
209+ # Convert file name to class name (e.g., "com/example/MyTest.java" -> "com.example.MyTest")
210+ sed 's|/|.|g' | sed 's|\.java$||' | \
211+ # Process each fully qualified test class name
212+ while read -r class_name; do
213+ # Extract just the simple class name (e.g., "com.example.MyTest" -> "MyTest")
214+ short_name=$(echo "$class_name" | sed 's/.*\.//')
215+ # Create JSON object for each test with:
216+ # - display: human-readable name (AppName:TestClassName)
217+ # - module: gradle module path for running the test
218+ # - test_class: full qualified class name for --tests parameter
219+ echo "{\"display\":\"${module_name}:${short_name}\"," \
220+ "\"module\":\"${module}\"," \
221+ "\"test_class\":\"${class_name}\"}"
210222 done
223+ # Join all JSON objects with commas and remove trailing comma
211224 done | tr '\n' ',' | sed 's/,$//'
212225 )
213226
214- if [ -n "$json_array" ]; then
215- echo "matrix={\"include\":[$json_array]}" >> $GITHUB_OUTPUT
216- echo "Generated matrix with $(echo "$json_array" | tr ',' '\n' | wc -l) test entries"
217- else
218- echo "matrix={\"include\":[]}" >> $GITHUB_OUTPUT
219- echo "No test entries found"
220- fi
227+ # Output the matrix in GitHub Actions format
228+ echo "matrix={\"include\":[$json_array]}" >> $GITHUB_OUTPUT
221229
222230 smoke-test :
223231 name : ${{ matrix.display }}
0 commit comments