-
Notifications
You must be signed in to change notification settings - Fork 37
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 robotsandpencils/made/xcodesInstall 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 aria2Use xcodes to install the latest version of Xcode. The command below installs Xcode 14.2. Remember to replace the version number with the version you wish to install.
xcodes install 14.2ℹ️ 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 14.2Install xcbeautify by running the following command.
brew install xcbeautifyInstall SwiftLint by running the following command.
brew install swiftlintWe use RVM to manage the Ruby version used by the virtual machine. First we install GnuPG as we will need that in a second.
brew install gpgThen we add RVM's GPG keys.
gpg2 --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDBThen we can install RVM by running the following command.
curl -sSL https://get.rvm.io | bash -s stableAnd finally we can install the latest stable version of Ruby. In this case we install Ruby 3.2.0.
rvm install 3.2.0We use NVM to manage the Node version used by the virtual machine. Install NVM by running the following command.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bashThe install the latest stable version of Node. In this case we install Node 18.13.0.
nvm install 18.13.0Most of our projects use fastlane to build the app, manage signing, and more. Install fastlane by running the following command.
brew install fastlanejq 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 jqMake 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.comThe select "yes" when asked to confirm.
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-dbThat 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 🤗