-
Notifications
You must be signed in to change notification settings - Fork 24
Configuring the Virtual Machine to Build iOS Apps
After going through the Installing Tartelet and Configuring Tartelet articles, you are now ready to start the GitHub Actions runners. However, if you are planning to use the runners to build iOS apps, you will need to do some additional configuration on the virtual machine.
This article describes the additional steps we have performed at Shape to configure the virtual machine to build iOS apps.
We install Homebrew for two reasons:
- Throughout this article we will use it to install software.
- Our workflows may use Homebrew to install software they depend on.
Run the following command to install Homebrew.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Remember to follow the steps printed by Homebrew after the installation to finalize the setup.
By default Homebrew will automatically update packages when installing another package using brew install
. We want to disable this for two reasons:
- It means that our workflows are not always running with the same versions of the installed software.
- It increases the duration of our workflows.
Follow the steps below to prevent Homebrew from automatically update installed packages.
- Open the file at
~/.zshrc
. - Add a line to the file with the content
export HOMEBREW_NO_AUTO_UPDATE=1
. - Save the file.
We also want to make sure that Homebrew does not automatically cleanup the installed packages. We disable this as it increases the duration of our workflows.
Follow the steps below to prevent Homebrew from automatically cleaning up packages.
- Open the file at
~/.zshrc
. - Add a line to the file with the content
export HOMEBREW_NO_INSTALL_CLEANUP=1
. - Save the file.
We use xcodes to install new versions of Xcodes on the virtual machine. Install xcodes by running the following command.
brew install xcodesorg/made/xcodes
Install aria2 to have xcodes download versions of Xcode faster. This is mentioned in the README in xcodes' repository. Install aria2 by running the following command.
brew install aria2
Use xcodes to install the latest version of Xcode. The command below installs Xcode 15. Remember to replace the version number with the version you wish to install.
xcodes install 15.0
ℹ️ Note
By default xcodes names the installed app something like Xcodes-14.2.app with dashes. However, the GitHub runners uses underscores instead of dashes. We do the same at Shape to keep our runners as close to GitHub's runners as possible. Therefore we rename the app after xcodes has successfully installed it.
Then make the installed version the default by running the following command. Once again, replace the version number with the version of Xcode you installed.
xcodes select 15.0
Finally, install the relevant runtimes. For example, you may want to install the iOS 17 runtime.
xcodes runtimes install "iOS 17.0"
Install xcbeautify by running the following command.
brew install xcbeautify
Install SwiftLint by running the following command.
brew install swiftlint
We use asdf to manage the runtime versions of Ruby and Node.
Install asdf by following the official instructions. As of writing this, the official instructions are to run a shell command which contains the latest version number of asdf and as such is not suitable to be included in this guide.
We use asdf to manage the Ruby version used by the virtual machine.
Start by adding the dependencies of Ruby as per this issue in asdf-vm/asdf-ruby repository.
brew install zlib readline libyaml libffi
Then add the Ruby plugin to asdf.
asdf plugin add ruby
Then install the latest stable version of Ruby. In this case we install Ruby 3.2.2.
asdf install ruby 3.2.2
Make sure the installed version is selected globally.
asdf global ruby 3.2.2
We use asdf to manage the Node version used by the virtual machine. Start by adding the Node plugin to asdf.
asdf plugin add nodejs
Then install the latest stable version of Node. In this case we install Node 18.18.0.
asdf install nodejs 18.18.0
Make sure the installed version is selected globally.
asdf global nodejs 18.18.0
Most of our projects use fastlane to build the app, manage signing, and more. Install fastlane by running the following command.
brew install fastlane
jq is a JSON processor that some of our workflows and actions may use to work with JSON. Install it by running the following command.
brew install jq
git-lfs is used to store large files in Git. Install it by running the following command.
brew install git-lfs
GitHub CLI is used for performing operations towards GitHub.
brew install gh
ImageMagick is used to edit images. Install it by running the following command.
brew install imagemagick
Make sure GitHub's hostname is added to ~/.ssh/known_hosts by running the following command. This ensures that the machine can clone repositories when running a job.
ssh github.com
The select "yes" when asked to confirm.
Configure the Git installation with a username and email. This is used when committing changes from the runner.
Start by configuring the username.
git config --global user.name <name>
Then configure the email.
git config --global user.email <email>
We use the following information at Shape.
Field | Value |
---|---|
Name | runner |
[email protected] |
The Worldwide Developer Relations - G3 certificate is needed by all iOS developers to sign apps. Follow the steps below to install the. certificate.
- Download the certificate from https://www.apple.com/certificateauthority/AppleWWDRCAG3.cer
- In case the certificate was not downloaded directly to the virtual machine, then transfer it to the virtual machine.
- Run the following command. Remember to pass the correct path to the certificate.
sudo security import ~/Downloads/AppleWWDRCAG3.cer ~/Library/Keychain/login.keychain-db
That is all! The next step is to start building your iOS apps on your self-hosted runner.
Tartelet is built with ❤️ by Shape in Denmark. Oh, and we are hiring 🤗