Skip to content

Commit 7221de1

Browse files
committed
Improve spec test execution by adding retry logic for transient errors
1 parent a29f394 commit 7221de1

File tree

1 file changed

+19
-29
lines changed

1 file changed

+19
-29
lines changed

.github/workflows/compilation_on_sgx.yml

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ on:
1010
- opened
1111
- synchronize
1212
paths:
13-
- ".github/workflows/build_llvm_libraries.yml"
14-
- ".github/workflows/compilation_on_sgx.yml"
13+
- ".github/workflows/**"
1514
- "build-scripts/**"
1615
- "core/**"
1716
- "!core/deps/**"
@@ -26,8 +25,7 @@ on:
2625
- main
2726
- "dev/**"
2827
paths:
29-
- ".github/workflows/build_llvm_libraries.yml"
30-
- ".github/workflows/compilation_on_sgx.yml"
28+
- ".github/workflows/**"
3129
- "build-scripts/**"
3230
- "core/**"
3331
- "!core/deps/**"
@@ -288,30 +286,22 @@ jobs:
288286
sudo swapon /swapfile
289287
sudo swapon --show
290288
291-
- name: run spec tests
292-
run: |
293-
set +e
294-
source /opt/intel/sgxsdk/environment
295-
attempts=0
296-
max_attempts=3
297-
298-
while [ $attempts -lt $max_attempts ]; do
289+
- name: run spec tests with retry
290+
id: run_spec_tests
291+
uses: nick-fields/retry@v3
292+
with:
293+
command: |
294+
cd ./tests/wamr-test-suites
295+
source /opt/intel/sgxsdk/environment
299296
./test_wamr.sh ${{ matrix.test_option }} -t ${{ matrix.running_mode }}
300-
exitcode="$?"
297+
max_attempts: 3
298+
retry_on: error
299+
retry_on_exit_code: 143
300+
shell: bash
301+
timeout_minutes: 10
301302

302-
if [ $exitcode -eq 0 ]; then
303-
echo "Spec test passed"
304-
exit 0
305-
elif [ $exitcode -ne 143 ]; then
306-
echo "Spec test failed with error code $exitcode"
307-
exit 1
308-
fi
309-
310-
echo "$exitcode is a known GitHub-hosted runner issue"
311-
echo "::notice::Re-running the spec test due to error code 143"
312-
attempts=$((attempts + 1))
313-
done
314-
315-
echo "::notice::Report an error with code 143 in SGX CI after $max_attempts attempts"
316-
exit 143
317-
working-directory: ./tests/wamr-test-suites
303+
#TODO: just for test. remove me before merging
304+
- name: print test result
305+
run: |
306+
echo "-->" ${{ steps.run_spec_tests.outputs.exit_code }}
307+
echo "-->" ${{ steps.run_spec_tests.outputs.exit_error }}

0 commit comments

Comments
 (0)