diff --git a/.github/workflows/shared-build-and-test.yaml b/.github/workflows/shared-build-and-test.yaml index 242df4b..ffcac0c 100644 --- a/.github/workflows/shared-build-and-test.yaml +++ b/.github/workflows/shared-build-and-test.yaml @@ -41,10 +41,18 @@ jobs: working-directory: ${{ inputs.working_dir }} run: | tests_run=$(mvn -B clean compile test | tee build.log | grep "Tests run" | awk '{print $3}') + echo "DEBUG: tests_run = $tests_run" # Print the value of tests_run + + if [ -z "$tests_run" ]; then # Check if tests_run is empty + echo "WARNING: Could not determine the number of tests run." + tests_run=0 # Set a default value + fi + if [ "$tests_run" -eq 0 ]; then echo "ERROR: No tests were run!" exit 1 fi + echo "INFO: $tests_run tests were run!" - name: Generate code coverage