Our project requires a private repo that requires Carthage to be bootstrapped. The main repo has a workspace that includes the main project file and the dependent project file. This is essentially what we’re trying to achieve:
- Clone the private repo with a github user key, checking out the same branch name as the main repo.
- Bootstrap Carthage for the dependent repo.
- Build the main repo.
Bootstrapping Carthage in the dependent repo can take upwards of 30 minutes, so ideally this needs to be cached (we’re using the technique described here: https://robots.thoughtbot.com/caching-carthage-con-circleci).
This is what our circle.yml
file looks like:
machine:
environment:
LC_CTYPE: en_US.UTF-8
XCODE_WORKSPACE: MyApp.xcworkspace
xcode:
version: "8.3.2"
checkout:
post:
- git clone -b $CIRCLE_BRANCH git@github.com:Foo/dependent-repo.git
- mv dependent-repo ../dependent-repo
dependencies:
override:
- cd ../dependent-repo/Swift && bin/bootstrap-if-needed
cache_directories:
- "../dependent-repo/Swift/Carthage"
test:
override:
- set -o pipefail &&
xcodebuild
CODE_SIGNING_REQUIRED=NO
CODE_SIGN_IDENTITY=
PROVISIONING_PROFILE=
-destination 'platform=iOS Simulator,OS=latest,name=iPhone 7'
-workspace 'MyApp.xcworkspace'
-scheme "MyApp Stage"
clean build test |
tee $CIRCLE_ARTIFACTS/xcode_raw.log |
xcpretty --color --report junit --output $CIRCLE_TEST_REPORTS/xcode/results.xml
The build always fails during the cd ../dependent-repo/Swift && bin/bootstrap-if-needed
step. It appears like ../dependent-repo/Swift
exists, but is always empty.
I’ve even tried something like this, just to debug:
git clone -b $CIRCLE_BRANCH git@github.com:Foo/dependent-repo.git && mv dependent-repo ../dependent-repo && ls -l ../dependent-repo/Swift
It’s still empty, even though the repo was clearly just cloned. What’s going on? How do I fix this? And if we’re going about this the wrong way, what is the solution?