2

React native app not building on Xcode-Cloud getting following error

Run command: 'source /Volumes/Task/ci_build.env && source /Volumes/Task/ci_plan.env && xcodebuild archive -workspace /Volumes/workspace/repository/ios/dxapp.xcworkspace -scheme dxapp -destination generic/platform=iOS -archivePath /Volumes/workspace/build.xcarchive -derivedDataPath /Volumes/workspace/DerivedData -resultBundleVersion 3 -resultBundlePath /Volumes/workspace/resultbundle.xcresult -resultStreamPath /tmp/resultBundleStream9b0391b8-52bb-4b1d-9d33-db7809b56ceb.json -IDEPostProgressNotifications=YES CODE_SIGN_IDENTITY=- AD_HOC_CODE_SIGNING_ALLOWED=YES CODE_SIGN_STYLE=Automatic DEVELOPMENT_TEAM=4SJTADTF44 COMPILER_INDEX_STORE_ENABLE=NO -hideShellScriptEnvironment'

enter image description here

Development Machine Environment

System:
    OS: macOS 12.0.1
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 4.41 GB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.8.0 - /usr/local/bin/node
    Yarn: 1.22.11 - /usr/local/bin/yarn
    npm: 7.21.0 - /usr/local/bin/npm
    Watchman: 2021.08.30.00 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.0.1, iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7784292
    Xcode: 13.1/13A1030d - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.5 => 0.61.5

Update

I have tried ios/ci_post_clone script

#!/bin/sh


brew install node
brew install cocoapods
npm install
pod install

However, the issue remains. How should I build my app?

Adriaan
  • 17,741
  • 7
  • 42
  • 75
Prasanth S
  • 3,725
  • 9
  • 43
  • 75
  • What i can see is. Your script is at wrong place. It must be inside ios/ci_scripts/. and You didn't cd into ios directory to run pod install. Make sure to make ci_post_script.sh as executable. – Sandeep Rana Jun 17 '22 at 03:58

3 Answers3

2

As you can see from the logs Xcode Cloud environment couldn't find ci_post_clone script file.

Make sure the following.

  1. Make sure ci_post_clone.sh file is at the correct path ios/ci_scripts/ci_post_clone.sh (ci_scripts directory must be in ios directory not at the root of the project)

  2. ci_post_clone.sh should be executable.

    (Run this command in terminal chmod +x ci_post_clone.sh)

  3. ci_post_clone.sh is added and pushed to the git.

Bilal
  • 18,478
  • 8
  • 57
  • 72
0

I had the example app inside the example/ folder. So I needed to modify the ci_post_clone script from "cd ios" to "cd example/ios".

The complete ci_post_clone.sh:

#!/bin/sh

# The default execution directory of this script is the ci_scripts directory.
cd $CI_WORKSPACE # change working directory to the root of your cloned repo.

# Install Flutter using git.
git clone https://github.com/flutter/flutter.git --depth 1 -b stable $HOME/flutter
export PATH="$PATH:$HOME/flutter/bin"

# Install Flutter artifacts for iOS (--ios), or macOS (--macos) platforms.
flutter precache --ios

# Install Flutter dependencies.
flutter pub get

# Install CocoaPods using Homebrew.
HOMEBREW_NO_AUTO_UPDATE=1 # disable homebrew's automatic updates.
brew install cocoapods

# Install CocoaPods dependencies.
cd example/ios && pod install # run `pod install` in the `ios` directory.

exit 0
Adriaan
  • 17,741
  • 7
  • 42
  • 75
0

The following script in your ios/ci_scripts/ci_post_clone.sh file to install Node, CocoaPods, yarn, and their dependencies using Homebrew:

#!/bin/sh

# Install Node, CocoaPods, and yarn using Homebrew.
brew install node
brew install cocoapods
brew install yarn

# Install dependencies
yarn
pod install

And then, open terminal, go to ci_scripts directory to make it an executable by running chmod +x ci_post_clone.sh

Prasanth S
  • 3,725
  • 9
  • 43
  • 75