yonaskolb / XcodeGen

A Swift command line tool for generating your Xcode project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Could not find test host

ethanmacanas opened this issue · comments

I'm attempting to use Github Actions with Macos and xcodebuild to automate our CI/CD testing for a test app. The test app contains unit tests that have dependencies installed and managed through cocoapods. I've setup the CI/CD pipeline to generate the xcodeproj and xcworkspace through xcodegen. Then install the relevant pods and execute xcodebuild clean, build-for-testing, and test-without-building commands. However, I am not able to execute the commands in github actions. I receive the error on the build-for-testing command.
xcodebuild: error: Failed to build workspace REDACTED with scheme REDACTED. Reason: Could not find test host for REDACTED: TEST_HOST evaluates to "/Users/runner/work/REDACTED/REDACTED/build/Build/Products/Debug-iphonesimulator/REDACTED.app/REDACTED" make: *** [build-xcodeproj-artifactory] Error 70

This is my project.yml

options:
  minimumXcodeGenVersion: "2.26.0"
  xcodeVersion: "13.2.1"
  deploymentTarget:
    iOS: "15.2"
  bundleIdPrefix: com.name
  postGenCommand: pod repo-art add REDACTED REDACTED; pod install
configs:
  Debug: debug
  Develop: release
schemes:
  UnitTest:
    build:
      targets:
        UnitTest: test
    test:
      targets: [UnitTest]
targets:
  TestApp:
    type: application
    platform: iOS
    sources:
      - test-app-ios
    settings:
      FRAMEWORK_SEARCH_PATHS: '$(inherited) $(PROJECT_DIR)'
      CODE_SIGN_IDENTITY: 'iPhone Developer'
      DEVELOPMENT_TEAM: xxxxxxxxxxx
      ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES: YES
      EXCLUDED_ARCHS: arm64
      SWIFT_VERSION: '5.0'
      TEST_HOST: ''
      TARGET_NAME: TestApp
      ALWAYS_SEARCH_USER_PATHS: NO
    scheme:
      testTargets:
        - UnitTest
  UnitTest:
    type: bundle.unit-test
    platform: iOS
    sources:
      - tests
    settings:
      DEVELOPMENT_TEAM: 4N448TQEX3
      BUNDLE_LOADER: '$(BUILT_PRODUCTS_DIR)/TestApp.app/TestApp'
      TEST_HOST: '$(BUNDLE_LOADER)'
      EXCLUDED_ARCHS: arm64
      SWIFT_VERSION: '5.0'
      TARGET_NAME: UnitTest
    dependencies:
      - target: TestApp

Looks like it was an issue with https://github.com/nightstory/setup-xcodegen. Manually installing xcodegen with brew resolved the problem