fix(ci): stop flutter tests after success sentinel
This commit is contained in:
@@ -34,6 +34,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
python3 - <<'PY'
|
python3 - <<'PY'
|
||||||
import os
|
import os
|
||||||
|
import select
|
||||||
import signal
|
import signal
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
@@ -114,14 +115,34 @@ jobs:
|
|||||||
print('$ ' + ' '.join(cmd), flush=True)
|
print('$ ' + ' '.join(cmd), flush=True)
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
cmd,
|
cmd,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.STDOUT,
|
||||||
|
text=True,
|
||||||
|
bufsize=1,
|
||||||
start_new_session=use_process_group,
|
start_new_session=use_process_group,
|
||||||
)
|
)
|
||||||
deadline = time.monotonic() + 120
|
deadline = time.monotonic() + 120
|
||||||
|
success_deadline = None
|
||||||
while True:
|
while True:
|
||||||
|
if process.stdout is not None and select.select([process.stdout], [], [], 1)[0]:
|
||||||
|
line = process.stdout.readline()
|
||||||
|
if line:
|
||||||
|
print(line, end='', flush=True)
|
||||||
|
if 'All tests passed!' in line:
|
||||||
|
success_deadline = time.monotonic() + 5
|
||||||
|
|
||||||
returncode = process.poll()
|
returncode = process.poll()
|
||||||
if returncode is not None:
|
if returncode is not None:
|
||||||
cleanup_flutter_processes()
|
cleanup_flutter_processes()
|
||||||
return returncode
|
return returncode
|
||||||
|
if success_deadline is not None and time.monotonic() >= success_deadline:
|
||||||
|
print(
|
||||||
|
f'WARN: {path} informó éxito pero Flutter no cerró; terminando proceso residual',
|
||||||
|
flush=True,
|
||||||
|
)
|
||||||
|
kill_process_group(process.pid)
|
||||||
|
cleanup_flutter_processes()
|
||||||
|
return 0
|
||||||
if time.monotonic() >= deadline:
|
if time.monotonic() >= deadline:
|
||||||
print(f'ERROR: timeout ejecutando test critico {path}', file=sys.stderr, flush=True)
|
print(f'ERROR: timeout ejecutando test critico {path}', file=sys.stderr, flush=True)
|
||||||
kill_process_group(process.pid)
|
kill_process_group(process.pid)
|
||||||
@@ -340,4 +361,4 @@ jobs:
|
|||||||
MSG="❌ *PluriWave* build FAILED · rama ${BRANCH} · ${COMMIT}"
|
MSG="❌ *PluriWave* build FAILED · rama ${BRANCH} · ${COMMIT}"
|
||||||
fi
|
fi
|
||||||
curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
|
curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
|
||||||
-d "chat_id=221721467" -d "parse_mode=Markdown" -d "text=${MSG}" || true
|
-d "chat_id=221721467" -d "parse_mode=Markdown" -d "text=${MSG}" || true
|
||||||
|
|||||||
Reference in New Issue
Block a user