This tutorial guides you through setting up your iOS project in Greenhouse.
The tutorial covers how to:
- add your app's repository
- specify build configuration
- setup Git hook
- get your tests up and running
- publish your build artefacts
- handle build versioning
All you need to setup your project in Greenhouse is a web browser. But as you are already reading this, then I guess we can agree that you have one anyway. Greenhouse doesn’t require any kind of additional software from your side and you don’t even have to write any tedious configuration files full of technical boilerplate. We’ll scan your repository and from what you have there our builders find everything they need. You’ll just have to confirm what configuration you want to build.
But let’s get our hands dirty and see how the process works in detail.
The first time you log in to Greenhouse you’ll be presented with an empty dashboard that encourages you to “Add an app to get started!” Let’s get going by clicking on “add new app”.
That's how your dashboard looks like after you've signed up.
Clicking the add new app card on the dashboard will open a new project creation flow that asks for your Git repository URL and authentication type for the repository. You can read more about setting up your Git repository from Specify Git repository.
As soon as you submit a repository, either public or private, Greenhouse takes a first look at it by listing the
branches in this repository. The next step for you is to select the branch you want Greenhouse to scan for projects from. To do this you just have to select a branch from the dropdown. If you’ve chosen the branch, you can hit the green “select branch” button to proceed (note that you can change the branch later).
Clicking on the “select branch” makes Greenhouse to scan the repository from the specified branch. This includes cloning the repository, looking for projects from it and searching for the configurations.
All these actions can be monitored real-time from your browser via the live log window.
If you are using Cocoapods to manage the dependencies of your project, please refer to the Cocoapods section before continuing to read this section!
Once the project scanning has finished, you need to do the following
Select a project or a workspace - Projects are are containers for code, resources and different build settings. Workspaces are containers of different projects.
Based on the previous selection of project or workspace, you will need to select either a Target (projects) or a Scheme (workspaces)
Now that you are done with the build configuration, all that is left to provide the corresponding code signing files.
You you might want to skip over to running your first build, if you already know how to provide your signing certificate and provisioning profile
Feel free to skip this section if you know how to export your signing certificate
First, we will find your signing certificate.
Open up Keychain Access by searching for it in Spotlight. In the Categories submenu on the left sidebar select My Certificates
Adding a signing certificate.
The name of the certificate should start with iPhone Developer or iPhone Distribution:
Once you have located your signing certificate, select File -> Export Items from the OSX menu bar.
Exporting signing certificate.
This will prompt you to save the signing certificate.
Saving signing certificates.
Be sure to leave the file format filled as Personal Information Exchange (.p12), as saving the certificate with the .cer extension will not include your private key.
Finally, you will be prompted for the certificate export password. The password is not actually mandatory and you can leave as blank, but it is recommended to use a strong password.
That’s it. Now all you need is the corresponding provisioning profile.
Feel free to skip this section if you know how to find the corresponding provisioning profile for your application
Select the appropriate provisioning profile from Apple Developer portal. Download it and save it somewhere.
That’s it. If you successfully downloaded your signing certificate that should be everything you need. Now you can upload both of these files. We check that the provisioning profile and signing certificate match. And will let you know if something goes wrong.
Running your first build.
Now there’s only one more step left to build your iOS app with Greenhouse and that’s clicking the “save” button!
This action will show you the projects dashboard where you can see the app you just added already being built.
Building your application.
git clone Greenhouse will automatically find the name and icon of your app from the repo and updates your project accordingly. To see the progress of your build, just click the “View build” you’ll be shown the build overview, where you can see the real time logs of your build.
Setting up testing in Greenhouse is 100% automatic. When you submit your repository, we scan the selected configuration for tests, and if there are any tests present, we run them for every push.
Greenhouse currently only supports running XCTests. Additionally, the tests must be a part of your scheme in Xcode, otherwise we cannot detect and run them automatically.
The test report screen shows you a simple overview of all passed and failed tests including the failure reason so you can quickly identify what’s broken.
It provides specific information about where the error occurred, including the stacktrace, so you can zoom in fast on the underlying problem in your code.
Greenhouse supports publishing your iOS applicatios to several distribution channel.
To make your build version management easy, Greenhouse exports two environment variables that you can use in your build scripts. You can read more about it from Incrementing iOS app version.