From 8f6124fc1a7ff4d133e24c270948595bc8d6850d Mon Sep 17 00:00:00 2001 From: freetlab Date: Fri, 29 May 2026 00:02:51 +0200 Subject: [PATCH] fix(ci): avoid killing flutter between test files --- .gitea/workflows/build.yml | 45 +++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index e262737..8728e5f 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -39,14 +39,22 @@ jobs: import sys import time - tests = [ + test_paths = [ 'test/servicios/servicio_programacion_alarmas_test.dart', 'test/estado/estado_alarmas_test.dart', ] - + cmd = [ + 'flutter', + 'test', + '--no-pub', + '--concurrency=1', + '--timeout=60s', + '--reporter=expanded', + *test_paths, + ] use_process_group = hasattr(os, 'killpg') and os.name != 'nt' - def cleanup_process_group(pid): + def kill_process_group(pid): if not use_process_group: return try: @@ -56,29 +64,16 @@ jobs: except ProcessLookupError: pass - for test_path in tests: - cmd = [ - 'flutter', - 'test', - '--no-pub', - '--concurrency=1', - '--timeout=60s', - '--reporter=expanded', - test_path, - ] - print('$ ' + ' '.join(cmd), flush=True) - process = subprocess.Popen(cmd, start_new_session=use_process_group) - try: - returncode = process.wait(timeout=180) - except subprocess.TimeoutExpired: - print(f'ERROR: timeout ejecutando {test_path}', file=sys.stderr, flush=True) - cleanup_process_group(process.pid) - sys.exit(124) - finally: - cleanup_process_group(process.pid) + print('$ ' + ' '.join(cmd), flush=True) + process = subprocess.Popen(cmd, start_new_session=use_process_group) + try: + returncode = process.wait(timeout=240) + except subprocess.TimeoutExpired: + print('ERROR: timeout ejecutando tests críticos', file=sys.stderr, flush=True) + kill_process_group(process.pid) + sys.exit(124) - if returncode != 0: - sys.exit(returncode) + sys.exit(returncode) PY - name: Limpiar procesos Flutter de tests