diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 8a03c51..592b28e 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -34,6 +34,7 @@ jobs: run: | python3 - <<'PY' import os + import select import signal import subprocess import sys @@ -114,14 +115,34 @@ jobs: print('$ ' + ' '.join(cmd), flush=True) process = subprocess.Popen( cmd, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + text=True, + bufsize=1, start_new_session=use_process_group, ) deadline = time.monotonic() + 120 + success_deadline = None 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() if returncode is not None: cleanup_flutter_processes() 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: print(f'ERROR: timeout ejecutando test critico {path}', file=sys.stderr, flush=True) kill_process_group(process.pid) @@ -340,4 +361,4 @@ jobs: MSG="❌ *PluriWave* build FAILED · rama ${BRANCH} · ${COMMIT}" fi curl -s -X POST "https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \ - -d "chat_id=221721467" -d "parse_mode=Markdown" -d "text=${MSG}" || true \ No newline at end of file + -d "chat_id=221721467" -d "parse_mode=Markdown" -d "text=${MSG}" || true