NodeJS and iOS

I’m trying to configure a build to create a Cordova build, but Circle CI fails with:

We couldn’t find a workspace or project to build. Try setting this manually with environment variables ‘XCODE_WORKSPACE’ or ‘XCODE_PROJECT’

Action failed: Configure the build

The problem is, Cordova needs to be built before XCODE_PROJECT can be specified, because the XCode project file is generated during build time (not in the repository). Is there a way to override the machine?

Attempting to get NodeJS to run gulp and build the Cordova project before the XCode project runs results in this error:

Setting the node.js version is not supported on OSX containers.

3 Likes

We are facing the same issue. I hope this will be fixed soon …

1 Like

Same here, but I found a solution for the Problem:
You can just specify anything in the XCODE_ environment variables:

My Example circle.yml file:

machine:
  environment:
    XCODE_SCHEME: "test"
    XCODE_WORKSPACE: "platforms/ios"
    XCODE_PROJECT: "YourProject.xcodeproj"
  xcode:
    version: "7.3"
dependencies:
  override:
    - brew install node
    - brew install android-sdk
    - chmod +x install-android-tools.sh && ./install-android-tools.sh
    - npm install -g cordova
    - npm install
test:
  override:
    - npm test
  post:
    - mkdir -p $CIRCLE_TEST_REPORTS/junit/
    - find . -type f -regex ".*/test_out/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;

deployment:
  hub:
    branch: deploy
    commands:
      - chmod +x ./deploy-version.sh
      - ./deploy-version.sh

The install-android-tools.sh file: (credits go here: https://gist.github.com/yuvipanda/10408391)

#!/usr/bin/env bash

expect -c "
set timeout -1;
spawn android update sdk -u --filter "platform-tools,build-tools-23.0.3,android-23"
expect {
    \"Do you accept the license\" { exp_send \"y\r\"; exp_continue }
    eof
}
"
1 Like