codemagic-ci-cd / cli-tools

Various utilities to managing Android and iOS app builds, code signing, and deployment.
https://codemagic.io/start/
GNU General Public License v3.0
267 stars 42 forks source link

Error when running `xcode-project run-tests` tool (models/xctests/converter.py): could not convert string to float #432

Closed sergiymomot closed 3 weeks ago

sergiymomot commented 3 weeks ago

Hey, we encountered ValueError: could not convert string to float: '1m 4' error when using xcode-project run-tests CLI tool Seems to only happen when tests succeed.

Xcode version: 16.0 Failed Workflow ID if it helps: 671fb636267ec43c813905f2

[16:18:13 28-10-2024] WARNING cli_app.py:135 > Executing "xcode-project run-tests" failed unexpectedly. Detailed logs are available at "/var/folders/w2/rrf5p87d1bbfyphxc7jdnyvh0000gn/T/codemagic-28-10-24.log". 
[16:18:13 28-10-2024] ERROR cli_app.py:137 > Exception traceback:
Traceback (most recent call last):
  File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/cli/cli_app.py", line 243, in invoke_cli
    CliApp._running_app._invoke_action(args)
  File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/cli/cli_app.py", line 184, in _invoke_action
    return cli_action(**action_args)
  File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/cli/action.py", line 83, in wrapper
    return func(self, *args, **kwargs)
  File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/tools/xcode_project.py", line 506, in run_test
    test_suites, xcresult = self._get_test_suites(
  File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/tools/xcode_project.py", line 766, in _get_test_suites
    test_suites = XcResultConverter.xcresult_to_junit(xcresult)
  File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/models/xctests/converter.py", line 56, in xcresult_to_junit
    return cls(xcresult).convert()
  File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/models/xctests/converter.py", line 333, in convert
    test_suites = [
  File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/models/xctests/converter.py", line 334, in <listcomp>
    self._get_test_suite(xc_test_suite_node, xc_summary)
  File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/models/xctests/converter.py", line 320, in _get_test_suite
    time=sum(cls._get_test_node_duration(xc_test_case) for xc_test_case in xc_test_cases),
  File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/models/xctests/converter.py", line 320, in <genexpr>
    time=sum(cls._get_test_node_duration(xc_test_case) for xc_test_case in xc_test_cases),
  File "/Users/builder/.pyenv/versions/3.8.13/lib/python3.8/site-packages/codemagic/models/xctests/converter.py", line 251, in _get_test_node_duration
    return float(duration)
ValueError: could not convert string to float: '1m 4'
[16:18:13 28-10-2024] DEBUG cli_app.py:286 > ------------------------------------------------------------
[16:18:13 28-10-2024] DEBUG cli_app.py:287 > Completed XcodeProject run-tests in 08:51 with status code 9
[16:18:13 28-10-2024] DEBUG cli_app.py:288 > ------------------------------------------------------------
sergiymomot commented 3 weeks ago

@priitlatt Seems related to this change: https://github.com/codemagic-ci-cd/cli-tools/pull/431#discussion_r1804806834

priitlatt commented 3 weeks ago

@sergiymomot thanks for reporting this! I'll look into it tomorrow and let you know once we have a fix in place.

priitlatt commented 3 weeks ago

@sergiymomot Fix for this was just released in v0.54.1. Sorry for the trouble.

sergiymomot commented 3 weeks ago

@priitlatt confirming the fix. Thanks for the quick turnaround time!