@@ -85,18 +85,21 @@ jobs:
8585 https://localhost:8443/fineract-provider/actuator/health
8686
8787 - name : Execute tests for shard ${{ matrix.shard_index }}
88+ id : tests
8889 run : |
89- # Read feature files from the shard file
90- FEATURES=$(tr '\n' ',' < "feature_shard_${{ matrix.shard_index }}.txt" | sed 's/,$//')
90+ # Initialize failure flag
91+ FAILED=0
92+
93+ # Create necessary directories
94+ mkdir -p "allure-results-shard-${{ matrix.shard_index }}"
95+ mkdir -p "allure-results-merged"
9196
92- if [ -z "$FEATURES" ]; then
97+ # Read feature files from the shard file
98+ if [ ! -s "feature_shard_${{ matrix.shard_index }}.txt" ]; then
9399 echo "No features to test in this shard. Skipping..."
94100 exit 0
95101 fi
96102
97- # Create a directory for individual allure results
98- mkdir -p "allure-results-shard-${{ matrix.shard_index }}"
99-
100103 # Read each feature file path and run tests one by one
101104 while IFS= read -r feature_file || [ -n "$feature_file" ]; do
102105 # Skip empty lines
@@ -105,14 +108,20 @@ jobs:
105108 # Create a safe filename for the results
106109 safe_name=$(echo "$feature_file" | tr '/' '-' | tr ' ' '_')
107110
108- echo "Testing feature: $feature_file"
111+ echo "::group:: Testing feature: $feature_file"
109112
110113 # Run tests with individual allure results directory
111- ./gradlew --no-daemon --console=plain \
114+ if ! ./gradlew --no-daemon --console=plain \
112115 :fineract-e2e-tests-runner:cucumber \
113116 -Pcucumber.features="$feature_file" \
114117 -Dallure.results.directory="allure-results-shard-${{ matrix.shard_index }}/$safe_name" \
115- allureReport || echo "Test failed for $feature_file, continuing with next feature..."
118+ allureReport; then
119+
120+ echo "::error::Test failed for $feature_file"
121+ FAILED=1
122+ fi
123+
124+ echo "::endgroup::"
116125
117126 # Copy the results to a merged directory
118127 if [ -d "allure-results-shard-${{ matrix.shard_index }}/$safe_name" ]; then
@@ -121,9 +130,17 @@ jobs:
121130 done < "feature_shard_${{ matrix.shard_index }}.txt"
122131
123132 # Generate individual report for this shard
124- if [ -d "allure-results-merged" ]; then
133+ if [ -d "allure-results-merged" ] && [ "$(ls -A allure-results-merged)" ]; then
134+ echo "Generating Allure report..."
125135 mkdir -p "allure-report-shard-${{ matrix.shard_index }}"
126- allure generate "allure-results-merged" --clean -o "allure-report-shard-${{ matrix.shard_index }}" || echo "Failed to generate Allure report for shard ${{ matrix.shard_index }}"
136+ ./fineract-e2e-tests-runner/build/allure/commandline/bin/allure generate "allure-results-merged" --clean -o "allure-report-shard-${{ matrix.shard_index }}" || \
137+ echo "::warning::Failed to generate Allure report for shard ${{ matrix.shard_index }}"
138+ fi
139+
140+ # Exit with failure status if any test failed
141+ if [ "$FAILED" -eq 1 ]; then
142+ echo "::error::Some tests failed in this shard"
143+ exit 1
127144 fi
128145
129146 - name : Upload test results
0 commit comments