[CI] Add pytest timeout and enable workflow rerun (#6645)

This commit is contained in:
YuBaoku
2026-03-04 21:30:16 +08:00
committed by GitHub
parent 81e04bf5d1
commit 5c8f5184d9
2 changed files with 36 additions and 3 deletions
+31 -1
View File
@@ -54,7 +54,27 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
JOB_NAME: 'CI_XPU'
JOB_NAME: 'xpu_build_test / xpu-build-test'
- name: Rerun run_xpu_4cards_cases
if: ${{ contains(github.event.comment.body, 'run_xpu_4cards_cases') }}
uses: ./.github/actions/rerun-workflow
with:
PR_ID: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
JOB_NAME: 'xpu_4cards_case_test / run_xpu_4cards_cases'
- name: Rerun run_xpu_8cards_cases
if: ${{ contains(github.event.comment.body, 'run_xpu_8cards_cases') }}
uses: ./.github/actions/rerun-workflow
with:
PR_ID: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
JOB_NAME: 'xpu_8cards_case_test / run_xpu_8cards_cases'
- name: Rerun CI_HPU
if: ${{ contains(github.event.comment.body, 'ci_hpu') }}
@@ -185,3 +205,13 @@ jobs:
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
JOB_NAME: 'Run Stable Tests / stable_tests'
- name: Rerun run_4_cards_tests
if: ${{ contains(github.event.comment.body, 'run_4_cards_tests') }}
uses: ./.github/actions/rerun-workflow
with:
PR_ID: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
JOB_NAME: 'Run Four Cards Tests / run_4_cards_tests'
+5 -2
View File
@@ -37,11 +37,12 @@ for file in $TEST_FILES; do
# Clean up previous logs
rm -rf "${run_path}"/log* || true
for f in "${run_path}"/*.log; do
[[ "$(basename "$f")" != "failed_tests.log" ]] && rm -f "$f"
[[ "$(basename "$f")" != "${failed_tests_file}" ]] && rm -f "$f"
done
# Run pytest with coverage for the current file
python -m coverage run -m pytest -c ${PYTEST_INI} "$file" -vv -s
# Set timeout to 600 seconds to avoid infinite loop
timeout 600 python -m coverage run -m pytest -c ${PYTEST_INI} "$file" -vv -s
status=$?
if [ "$status" -ne 0 ]; then
echo "$file" >> "$failed_tests_file"
@@ -78,6 +79,8 @@ for file in $TEST_FILES; do
server_logs=("${run_path}"/*.log)
if [ "${#server_logs[@]}" -gt 0 ]; then
for server_log in "${server_logs[@]}"; do
# skip failed_tests_file
[ "${server_log}" == "${failed_tests_file}" ] && continue
if [ -f "${server_log}" ]; then
echo
echo "---------------- ${server_log} (last 100 lines) ----------------"