def METHOD_NAME(pull_request: bool, changed_modules_file: Path, repeat: int):
  """Run tests in CI and upload results to the metric service."""
  output_path = Path("macrobenchmark-test-output.json")
  exception = None
  try:
    if pull_request:
      asyncio.run(
        runner.start(
          build_only=False,
          local=False,
          repeat=repeat,
          output=output_path,
          changed_modules_file=changed_modules_file,
        )
      )
    else:
      asyncio.run(runner.start(build_only=False, local=False, repeat=repeat, output=output_path))
  except Exception as e:
    logger.error(f"Error: {e}")
    exception = e
  with open(output_path) as output_file:
    output = json.load(output_file)
    project_name = 'test-changed' if pull_request else 'test-all'
    ftl_dirs = list(filter(lambda x: x['project'] == project_name, output))[0]['successful_runs']
    ftl_bucket_name = 'fireescape-benchmark-results'
    log = ci_utils.ci_log_link()
    ftl_results = list(map(lambda x: {'bucket': ftl_bucket_name, 'dir': x}, ftl_dirs))
    startup_time_data = {'log': log, 'ftlResults': ftl_results}
    if ftl_results:
      metric_service_url = 'https://api.firebase-sdk-health-metrics.com'
      access_token = ci_utils.gcloud_identity_token()
      uploader.post_report(
        test_report=startup_time_data,
        metrics_service_url=metric_service_url,
        access_token=access_token,
        metric_type='startup-time',
        asynchronous=True
      )
  if exception:
    raise exception