Skip to content

Configures and downloads all needed software for a headless mobile CI box on OS X

License

Notifications You must be signed in to change notification settings

xfreebird/mobile-ci-bootstrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mobile-ci-bootstrap

License

Automatically downloads, installs and configures min needed software for a headless mobile CI box on OS X.

Requirements

  • A fresh installed OS X 10.10+
  • User with admin rights
  • Apple developer account (for Xcode)
  • Internet connection

How to use ?

On your CI box login with the created user and execute:

export PASSWORD="osx_user_password"
export APPLE_USERNAME="[email protected]"
export APPLE_PASSWORD="secret"
bash <(curl -s https://raw.githubusercontent.com/xfreebird/mobile-ci-bootstrap/master/mobile-ci-bootstrap.sh)

At the end script execution you will have:

  • iOS and Android ready build machine
  • User writeable /opt/ci/jenkins folder for a Jenkins agent.

Why ?

To save time, since it doesn't require any user interaction.

What do you get ?

Android

iOS

Core

  • brew to install various tools without sudo
  • rbenv to manage ruby versions sudoless
  • bundler to manage installed ruby gems sudoless
  • xcode-install to install various versions of xcode
  • jenv to manage installed java versions
  • nvm to manage node versions sudoless. usefull for cordova, phonegap, ionic, react native
  • jdk 8
  • latest git

Build machine management

Apple Developer Certificates

Never install code siging ceritificates in the login keychain. This will halt the codesiging process run by xcodebuild from ssh session. If you have any private key + certificate for app code signing installed in the login keychain, please remove them.

Gradle

For CI jobs always use project's gradle wrapper, because different projects use different versions of gradle.

Automated update/upgrade

To update installed software you can use the mobile-ci-update utility. By default it will update the OSX, Xcode, Brew packages

export PASSWORD="osx_user_password"
export APPLE_USERNAME="[email protected]"
export APPLE_PASSWORD="secret"
mobile-ci-update

Or if you need to update specific component:

export PASSWORD="osx_user_password"
export APPLE_USERNAME="[email protected]"
export APPLE_PASSWORD="secret"
mobile-ci-update xcode

Available options are:

  • osx - Updates the OSX. It will not upgrade the OS for major releases (e.g. 10.11 -> 10.12) ⚠️ Requires env variables PASSWORD, APPLE_USERNAME, APPLE_PASSWORD
  • xcode - Installs the latest Xcode. ⚠️ Requires env variables PASSWORD, APPLE_USERNAME, APPLE_PASSWORD
  • brew - Updates installed brew packages (e.g. swiftlint, rbenv)

Manual update/upgrade management

In case you prefer upgrading the software manually.

Android SDK & NDK

Both the SDK and NDK have been installed using the brew cask. To upgrade the SDK or/and NDK version, run:

brew update
brew cask reinstall android-ndk
brew cask reinstall android-sdk

To manage Android SDK packages, please refer to Google's official documentation on how to manage the android sdk packages.

Xcode

All installed Xcodes are following the Xcode-<version>.app naming convention. The /Applications/Xcode.app is a symbolic link to the current default Xcode.

To install a new version of Xcode use xcode-install:

export XCODE_INSTALL_USER="[email protected]"
XCODE_INSTALL_PASSWORD="secret"
xcversion install 9.3
sudo xcodebuild -license accept

⚠️ Don't install Xcode from App Store, as it will make harder to switch between Xcode versions.

Brew packages

Update all packages:

brew update
brew upgrade

Gem packages

  • ⚠️ Use only bundler to manage gem versions.
  • ⚠️ Don't use sudo when updating/installing gem packages, because ruby is managed by rbenv.

Don't rely on gem versions installed on the machine, alwas manage with bundler

Node.js versions and packages

Node versions are managed with nvm npm comes with the installed node version.

⚠️ Each CI job should prepare its Node and npm dependencies, they should not rely on versions installed on the build machine.

For example, if the project need node.js 9 and cordova npm package, then it would execute:

nvm install 9
npm install -g cordova 

PHP packages

PHP packages are managed with easy_install

To update a package, run:

sudo easy_install --upgrade <package_name>

Java enviroment

The Java environment can be controlled with jenv.

A new java version:

jenv add '/path/to/java_home'

To get current java versions:

jenv version

To list installed java versions:

jenv versions

To change default java version:

jenv global 10

To change shell session default java version:

jenv shell 10

About

Configures and downloads all needed software for a headless mobile CI box on OS X

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages