Skip to content

Commit e943c8b

Browse files
committed
fix(ci): preserve Robot test exit codes
1 parent 598f179 commit e943c8b

3 files changed

Lines changed: 27 additions & 15 deletions

File tree

.github/workflows/full-tests-with-api.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ jobs:
111111
CLEANUP_CONTAINERS: "false" # Don't cleanup in CI - handled by workflow
112112
run: |
113113
# Use the full test script (includes all tests with API keys)
114-
./run-robot-tests.sh
115-
TEST_EXIT_CODE=$?
116-
echo "test_exit_code=$TEST_EXIT_CODE" >> $GITHUB_ENV
114+
TEST_EXIT_CODE=0
115+
./run-robot-tests.sh || TEST_EXIT_CODE=$?
116+
echo "test_exit_code=$TEST_EXIT_CODE" >> "$GITHUB_ENV"
117117
exit 0 # Don't fail here, we'll fail at the end after uploading artifacts
118118
119119
- name: Save service logs to files
@@ -255,8 +255,12 @@ jobs:
255255
- name: Fail workflow if tests failed
256256
if: always()
257257
run: |
258-
if [ "${{ env.test_exit_code }}" != "0" ]; then
259-
echo "❌ Tests failed with exit code ${{ env.test_exit_code }}"
258+
TEST_EXIT_CODE="${{ env.test_exit_code }}"
259+
if [ -z "$TEST_EXIT_CODE" ]; then
260+
echo "❌ Test step did not record an exit code; check earlier setup/test steps"
261+
exit 1
262+
elif [ "$TEST_EXIT_CODE" != "0" ]; then
263+
echo "❌ Tests failed with exit code $TEST_EXIT_CODE"
260264
exit 1
261265
else
262266
echo "✅ All tests passed"

.github/workflows/pr-tests-with-api.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ jobs:
105105
CLEANUP_CONTAINERS: "false" # Don't cleanup in CI - handled by workflow
106106
run: |
107107
# Use the full test script (includes all tests with API keys)
108-
./run-robot-tests.sh
109-
TEST_EXIT_CODE=$?
110-
echo "test_exit_code=$TEST_EXIT_CODE" >> $GITHUB_ENV
108+
TEST_EXIT_CODE=0
109+
./run-robot-tests.sh || TEST_EXIT_CODE=$?
110+
echo "test_exit_code=$TEST_EXIT_CODE" >> "$GITHUB_ENV"
111111
exit 0 # Don't fail here, we'll fail at the end after uploading artifacts
112112
113113
- name: Save service logs to files
@@ -294,8 +294,12 @@ jobs:
294294
- name: Fail workflow if tests failed
295295
if: always()
296296
run: |
297-
if [ "${{ env.test_exit_code }}" != "0" ]; then
298-
echo "❌ Tests failed with exit code ${{ env.test_exit_code }}"
297+
TEST_EXIT_CODE="${{ env.test_exit_code }}"
298+
if [ -z "$TEST_EXIT_CODE" ]; then
299+
echo "❌ Test step did not record an exit code; check earlier setup/test steps"
300+
exit 1
301+
elif [ "$TEST_EXIT_CODE" != "0" ]; then
302+
echo "❌ Tests failed with exit code $TEST_EXIT_CODE"
299303
exit 1
300304
else
301305
echo "✅ All tests passed"

.github/workflows/robot-tests.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ jobs:
7878
working-directory: tests
7979
run: |
8080
# Use Makefile target (starts containers with mock config, excludes api-keys/slow/sdk/gpu tests)
81-
make test-no-api OUTPUTDIR=results-no-api
82-
TEST_EXIT_CODE=$?
83-
echo "test_exit_code=$TEST_EXIT_CODE" >> $GITHUB_ENV
81+
TEST_EXIT_CODE=0
82+
make test-no-api OUTPUTDIR=results-no-api || TEST_EXIT_CODE=$?
83+
echo "test_exit_code=$TEST_EXIT_CODE" >> "$GITHUB_ENV"
8484
exit 0 # Don't fail here, we'll fail at the end after uploading artifacts
8585
8686
- name: Save service logs to files
@@ -270,8 +270,12 @@ jobs:
270270
- name: Fail workflow if tests failed
271271
if: always()
272272
run: |
273-
if [ "${{ env.test_exit_code }}" != "0" ]; then
274-
echo "❌ Tests failed with exit code ${{ env.test_exit_code }}"
273+
TEST_EXIT_CODE="${{ env.test_exit_code }}"
274+
if [ -z "$TEST_EXIT_CODE" ]; then
275+
echo "❌ Test step did not record an exit code; check earlier setup/test steps"
276+
exit 1
277+
elif [ "$TEST_EXIT_CODE" != "0" ]; then
278+
echo "❌ Tests failed with exit code $TEST_EXIT_CODE"
275279
exit 1
276280
else
277281
echo "✅ All tests passed"

0 commit comments

Comments
 (0)