I have an iOS app that builds perfectly on my local machine but keeps failing when I try to build it using continuous integration. The error happens during the package dependency resolution phase and shows this message:
xcodebuild: error: Cannot read project 'MyApp.xcodeproj' from directory '/Users/runner/work/MyApp-iOS/MyApp-iOS/MyApp'.
Reason: The project 'MyApp' is corrupted and cannot be opened. Check the project file for invalid changes or merge conflicts.
Exception: missing classname for isa key
I already verified that the project file is valid by running plutil -lint MyApp/MyApp.xcodeproj/project.pbxproj and it shows no issues. This is really puzzling because the exact same code works without problems on my development machine.
Here’s my CI configuration:
name: "iOS Build Pipeline"
on:
push:
branches:
- main
jobs:
deploy:
name: Build and Test iOS App
runs-on: macos-13
steps:
- name: Get Source Code
uses: actions/checkout@v4
- name: Configure Xcode
run: sudo xcode-select -s /Applications/Xcode_14.3.app/Contents/Developer
- name: Setup Ruby Environment
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- name: Install Dependencies
run: |
gem install bundler
bundle install
- name: Setup Build Keychain
run: |
security create-keychain -p "temp_pass" ci.keychain
security default-keychain -s ci.keychain
security unlock-keychain -p "temp_pass" ci.keychain
- name: Import Certificates
run: |
brew install gnupg
echo "${{ secrets.GPG_PRIVATE_KEY }}" > ~/cert-key.asc
gpg --import ~/cert-key.asc
- name: Verify Project Structure
run: |
find . -name "*.xcodeproj"
plutil -lint MyApp/MyApp.xcodeproj/project.pbxproj
- name: Execute Build
env:
CERT_PASSWORD: ${{ secrets.CERT_PASSWORD }}
API_KEY_ID: ${{ secrets.API_KEY_ID }}
API_ISSUER_ID: ${{ secrets.API_ISSUER_ID }}
run: fastlane build_app
Anyone experienced this issue before? What could cause this difference between local and CI environments?