File tree Expand file tree Collapse file tree 1 file changed +26
-5
lines changed
Expand file tree Collapse file tree 1 file changed +26
-5
lines changed Original file line number Diff line number Diff line change 3939 mvn $MVN_ARGS
4040
4141 - name : " Run tests"
42+ id : run_tests
4243 run : |
4344 MVN_ARGS="${{ env.MVN_MULTI_THREADED_ARGS }} surefire:test -pl :spring-app -DskipTests=false"
44- mvn $MVN_ARGS "-Daicore.landscape=${{ matrix.environment }}"
45+ mvn $MVN_ARGS "-Daicore.landscape=${{ matrix.environment }}" | tee mvn_output.log # tee writes to both the console and a file
46+
47+ awk '/Results:/, /----/' mvn_output.log > test_error.log || true # true ensures the step doesn't fail if no match is found.
48+ ERROR_MSG=$(cat test_error.log | tail +4 | head -n -4 | awk '{gsub(/"/, "\\\""); printf "%s\\n", $0}') # Slack formatting
49+ echo "$ERROR_MSG"
50+ echo "error_message=$ERROR_MSG" >> $GITHUB_OUTPUT
51+
52+ if grep -q "BUILD FAILURE" mvn_output.log; then
53+ echo "Maven build failed."
54+ exit 1
55+ elif grep -q "BUILD SUCCESS" mvn_output.log; then
56+ echo "Maven build succeeded."
57+ else
58+ echo "Maven build status unknown."
59+ exit 1
60+ fi
4561 env :
4662 # See "End-to-end test application instructions" on the README.md to update the secret
4763 AICORE_SERVICE_KEY : ${{ secrets[matrix.secret-name] }}
7490 webhook : ${{ secrets.SLACK_WEBHOOK }}
7591 webhook-type : incoming-webhook
7692 payload : |
77- {
78- "text": "⚠️ End-to-end tests failed! 😬 Please inspect & fix by clicking <https://github.com/SAP/ai-sdk-java/actions/runs/${{ github.run_id }}|here>"
79- }
80-
93+ blocks:
94+ - type: "section"
95+ text:
96+ type: "mrkdwn"
97+ text: "⚠️ End-to-end tests failed! 😬 Please inspect & fix by clicking <https://github.com/SAP/ai-sdk-java/actions/runs/${{ github.run_id }}|here>"
98+ - type: "section"
99+ text:
100+ type: "plain_text"
101+ text: "${{ steps.run_tests.outputs.error_message }}"
You can’t perform that action at this time.
0 commit comments