Search code examples
xcodegithub-actionsgitlab-cicicd

Github Actions CI. xcodebuild: error: 'ProjectName/ProjectName.xcodeproj' does not exist


I first time try to add Github Actions. It's a simple project without 3d dependencies. My steps: 1. Create a remote repo, 2. Push local into remote, 3. Create yml, 4. Test.

My current yml with errors:

name: Swift

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build-and-test:

  runs-on: macos-latest

  steps:
  - name: Select Xcode
    run: sudo xcode-select -switch /Applications/Xcode_14.2.app

  - name: Build and test
    run: xcodebuild clean build test -project ProjectName/ProjectName.xcodeproj -scheme 'ProjectNameUnitTests' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO

After running this, I have: xcodebuild: error: 'ProjectName/ProjectName.xcodeproj' does not exist.

If I remove project, then I have error: xcodebuild: error: The directory /Users/runner/work/ProjectName_Test/ProjectName_Test does not contain an Xcode project, workspace or package. If it make sense, my remote repo named ProjectName_Test, when project named just ProjectName.

I tried different ways and can't find solution in other topics. If you know, how to fix it, please, help)


Solution

  • As Azeem said, I needed to add - uses: actions/checkout@v3, it helped)