Added remove of forced video in GitLab CI

Note that this video recording is needed in the tests, but I don't know
why.
This commit is contained in:
Salvador E. Tropea 2021-02-22 12:55:02 -03:00
parent 9e33b7a774
commit c82485acc8
7 changed files with 37 additions and 8 deletions

View File

@ -153,9 +153,11 @@ def exec_with_retry(cmd):
def add_extra_options(cmd):
is_gitlab_ci = 'GITLAB_CI' in os.environ
video_remove = (not GS.debug_enabled) and is_gitlab_ci
if GS.debug_enabled:
cmd.insert(1, '-'+'v'*GS.debug_level)
if GS.debug_enabled or 'GITLAB_CI' in os.environ:
if GS.debug_enabled or is_gitlab_ci:
# Forcing record on GitLab CI/CD (black magic)
cmd.insert(1, '-r')
if GS.global_kiauto_time_out_scale:
@ -164,7 +166,7 @@ def add_extra_options(cmd):
if GS.global_kiauto_wait_start:
cmd.insert(1, str(GS.global_kiauto_wait_start))
cmd.insert(1, '--wait_start')
return cmd
return cmd, video_remove
def load_board(pcb_file=None):

View File

@ -111,7 +111,7 @@ class PDF_Pcb_PrintOptions(VariantOptions):
cmd.append('--mirror')
board_name, proj_name = self.filter_components(GS.board)
cmd.extend([board_name, output_dir])
cmd = add_extra_options(cmd)
cmd, video_remove = add_extra_options(cmd)
# Add the layers
cmd.extend([la.layer for la in layers])
# Execute it
@ -124,6 +124,10 @@ class PDF_Pcb_PrintOptions(VariantOptions):
if ret:
logger.error(CMD_PCBNEW_PRINT_LAYERS+' returned %d', ret)
exit(PDF_PCB_PRINT)
if video_remove:
video_name = os.path.join(GS.out_dir, 'pcbnew_export_screencast.ogv')
if os.path.isfile(video_name):
os.remove(video_name)
@output_class

View File

@ -47,7 +47,7 @@ class PDF_Sch_PrintOptions(VariantOptions):
sch_dir = None
sch_file = GS.sch_file
cmd = [CMD_EESCHEMA_DO, 'export', '--all_pages', '--file_format', 'pdf', sch_file, output_dir]
cmd = add_extra_options(cmd)
cmd, video_remove = add_extra_options(cmd)
ret = exec_with_retry(cmd)
if ret:
logger.error(CMD_EESCHEMA_DO+' returned %d', ret)
@ -63,6 +63,10 @@ class PDF_Sch_PrintOptions(VariantOptions):
if sch_dir:
logger.debug('Removing temporal variant dir `{}`'.format(sch_dir))
rmtree(sch_dir)
if video_remove:
video_name = os.path.join(GS.out_dir, 'export_eeschema_screencast.ogv')
if os.path.isfile(video_name):
os.remove(video_name)
@output_class

View File

@ -44,7 +44,7 @@ class SVG_Sch_PrintOptions(VariantOptions):
sch_dir = None
sch_file = GS.sch_file
cmd = [CMD_EESCHEMA_DO, 'export', '--all_pages', '--file_format', 'svg', sch_file, output_dir]
cmd = add_extra_options(cmd)
cmd, video_remove = add_extra_options(cmd)
ret = exec_with_retry(cmd)
if ret:
logger.error(CMD_EESCHEMA_DO+' returned %d', ret)
@ -60,6 +60,10 @@ class SVG_Sch_PrintOptions(VariantOptions):
if sch_dir:
logger.debug('Removing temporal variant dir `{}`'.format(sch_dir))
rmtree(sch_dir)
if video_remove:
video_name = os.path.join(GS.out_dir, 'export_eeschema_screencast.ogv')
if os.path.isfile(video_name):
os.remove(video_name)
@output_class

View File

@ -3,6 +3,7 @@
# Copyright (c) 2020-2021 Instituto Nacional de Tecnología Industrial
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
import os
from sys import (exit)
from .macros import macros, pre_class # noqa: F401
from .error import (KiPlotConfigurationError)
@ -43,9 +44,13 @@ class Run_DRC(BasePreFlight): # noqa: F821
cmd.append('-i')
cmd.extend([GS.pcb_file, GS.out_dir])
# If we are in verbose mode enable debug in the child
cmd = add_extra_options(cmd)
cmd, video_remove = add_extra_options(cmd)
logger.info('- Running the DRC')
ret = exec_with_retry(cmd)
if video_remove:
video_name = os.path.join(GS.out_dir, 'pcbnew_run_drc_screencast.ogv')
if os.path.isfile(video_name):
os.remove(video_name)
if ret:
if ret > 127:
ret = -(256-ret)

View File

@ -3,6 +3,7 @@
# Copyright (c) 2020-2021 Instituto Nacional de Tecnología Industrial
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
import os
from sys import (exit)
from .macros import macros, pre_class # noqa: F401
from .gs import (GS)
@ -43,9 +44,13 @@ class Run_ERC(BasePreFlight): # noqa: F821
cmd.extend(['-f', GS.filter_file])
cmd.extend([GS.sch_file, GS.out_dir])
# If we are in verbose mode enable debug in the child
cmd = add_extra_options(cmd)
cmd, video_remove = add_extra_options(cmd)
logger.info('- Running the ERC')
ret = exec_with_retry(cmd)
if video_remove:
video_name = os.path.join(GS.out_dir, 'run_erc_eeschema_screencast.ogv')
if os.path.isfile(video_name):
os.remove(video_name)
if ret:
if ret > 127:
ret = -(256-ret)

View File

@ -3,6 +3,7 @@
# Copyright (c) 2020-2021 Instituto Nacional de Tecnología Industrial
# License: GPL-3.0
# Project: KiBot (formerly KiPlot)
import os
from sys import (exit)
from .macros import macros, pre_class # noqa: F401
from .error import (KiPlotConfigurationError)
@ -34,9 +35,13 @@ class Update_XML(BasePreFlight): # noqa: F821
check_eeschema_do()
cmd = [CMD_EESCHEMA_DO, 'bom_xml', GS.sch_file, GS.out_dir]
# If we are in verbose mode enable debug in the child
cmd = add_extra_options(cmd)
cmd, video_remove = add_extra_options(cmd)
logger.info('- Updating BoM in XML format')
ret = exec_with_retry(cmd)
if ret:
logger.error('Failed to update the BoM, error %d', ret)
exit(BOM_ERROR)
if video_remove:
video_name = os.path.join(GS.out_dir, 'bom_xml_eeschema_screencast.ogv')
if os.path.isfile(video_name):
os.remove(video_name)