diff --git a/.github/workflows/build-common.yml b/.github/workflows/build-common.yml index 06de7ee4a91..c0231496b3c 100644 --- a/.github/workflows/build-common.yml +++ b/.github/workflows/build-common.yml @@ -196,11 +196,35 @@ jobs: - id: set-matrix run: | - modules=$(ls -d smoke-tests/apps/* | sed 's/\/$//' | sed 's/\//:/g' | sed 's/^/:/') - inner_json=$(echo $modules | xargs echo | sed 's/ /","/g') - echo "matrix={\"module\":[\"$inner_json\"]}" >> $GITHUB_OUTPUT + json_array=$( + for dir in smoke-tests/apps/*; do + # Convert directory path to module name (e.g., "smoke-tests/apps/MyApp" -> "smoke-tests:apps:MyApp") + module=$(echo "$dir" | sed 's|/|:|g') + # Extract just the app name from the module path (e.g., "smoke-tests:apps:MyApp" -> "MyApp") + module_short=$(echo "$module" | sed 's|.*:||') + + find "${dir}/src/smokeTest/java" -name "*Test.java" | \ + # Remove the base path to get relative path from smokeTest/java + sed "s|${dir}/src/smokeTest/java/||" | \ + # Convert file name to class name (e.g., "com/example/MyTest.java" -> "com.example.MyTest") + sed 's|/|.|g' | sed 's|\.java$||' | \ + # Process each fully qualified test class name + while read -r class_name; do + # Extract just the simple class name (e.g., "com.example.MyTest" -> "MyTest") + class_short=$(echo "$class_name" | sed 's/.*\.//') + echo "{\"display\":\"${module_short}:${class_short}\"," \ + "\"module\":\"${module}\"," \ + "\"test_class\":\"${class_name}\"}" + done + # Join all JSON objects with commas and remove trailing comma + done | tr '\n' ',' | sed 's/,$//' + ) + + # Output the matrix in GitHub Actions format + echo "matrix={\"include\":[$json_array]}" >> $GITHUB_OUTPUT smoke-test: + name: ${{ matrix.display }} needs: setup-smoke-test-matrix runs-on: ubuntu-latest strategy: @@ -226,12 +250,16 @@ jobs: uses: gradle/actions/setup-gradle@v4 - name: Test - run: ./gradlew ${{ matrix.module }}:smokeTest + run: ./gradlew ${{ matrix.module }}:smokeTest --tests "${{ matrix.test_class }}*" - name: Create unique artifact name if: failure() run: | - echo "UPLOAD_ARTIFACT_NAME=${{ matrix.module }}" | sed 's/:/-/g' >> $GITHUB_ENV + # Create a unique name based on module and test class + artifact_name="${{ matrix.module }}:${{ matrix.test_class }}" + # Replace colons and dots with hyphens for valid artifact names + artifact_name=$(echo "$artifact_name" | sed 's/[:.]/\-/g') + echo "UPLOAD_ARTIFACT_NAME=$artifact_name" >> $GITHUB_ENV - name: Upload smoke test reports uses: actions/upload-artifact@v4