Bitrise and Carthage


Bitrise doesn’t have a task for Carthage, at least for now. Here is how you can add Carthage support on your workflow.


Bitrise logo

Bitrise is an iOS Continuous Integration and Delivery that allows you to manage each project workflow with some nice integrations:

You can customize your workflow with different tasks based on integrations. One of them is CocoaPods and before building the source, it will install all your pods like you do on your Mac.

Certainly, CocoaPods is a standard for 3rd party code but now we also have Carthage that give you the possibility to add dependencies and it’s intended to be the simplest way to add frameworks to your Cocoa application.

It doesn’t have Carthage build task but we have Bash Script Runner!

Perfect, so let’s do this.


Carthage build

You repository need a Brewfile and make sure to commit your Cartfile.resolved, because it is necessary to build the same framework versions.

Add this Brewfile to your repository:

brew "carthage"


Now, go to your workflow and add a Bash Script Runner after Git Clone Repository:

Bash task


Then add this script:

#!/bin/bash

echo ""
echo "-------------------------------------------------"
echo "Installing dependencies"
echo "-------------------------------------------------"
# Brewfile
brew update
brew tap homebrew/bundle
brew bundle

# Carthage
echo ""
echo "-------------------------------------------------"
echo "Carthage"
echo "-------------------------------------------------"
carthage bootstrap

And you’re done. I hope that Bitrise team will add this integration because it will be needed many times for me…


##UPDATE

The Bitrise team is awesome and sent me some optimisations. It seems that homebrew/bundle was deprecated.

Here is the updated script (forget about the Brewfile, delete it):

#!/bin/bash

# exit if a command fails
set -e

echo ""
echo "-----------------------"
echo "Installing dependencies"
echo "-----------------------"
# Homebrew
brew update && brew install carthage

# Carthage
echo ""
echo "--------"
echo "Carthage"
echo "--------"
carthage bootstrap --verbose


Like Bitrise team says: Happy building!

Cheers,

Ricardo Pereira



Comments

comments powered by Disqus