Home Assistant uses Bundler, Cocoapods and Swift Package Manager to manage build dependencies. You'll need Xcode 12.0 (or later) which you can download from the App Store. You can get this running using the following commands:
git clone https://github.com/home-assistant/iOS.git
cd iOS
[sudo] gem install bundler
bundle install
bundle exec pod install --repo-update
Once this completes, you can launch HomeAssistant.xcworkspace
and run the Debug
target onto your simulator or iOS device.
Although the app is set up to use Automatic provisioning for Debug builds, you'll need to customize a few of the options. This is because the app makes heavy use of entitlements that require code signing, even for simulator builds.
Edit the file Configuration/HomeAssistant.overrides.xcconfig
(which will not exist by default and is ignored by git) and add the following:
DEVELOPMENT_TEAM = YourTeamID
BUNDLE_ID_PREFIX = some.bundle.prefix
Xcode should generate provisioning profiles in your Team ID and our configuration will disable features your team doesn't have like Critical Alerts. You can find your Team ID on Apple's developer portal.
Apple shipped Xcode 12 with several regressions that impact Home Assistant and you will need to work around those that we cannot automatically fix in code:
- If you experience
Clibsodium
module errors, retrying the build should find it afterwards after a few attempts. Once it is able to build once, it should stop misbehaving. - For Xcode 12 releases before 12.2 beta 2, you will need to copy
libnfshared.dylib
from an older version of the Xcode 12 betas to run on the iOS 14 simulator. You can replicate the steps the CI does to get compatibility.
SwiftLint runs as part of Pull Request checks and will run automatically when building the project.
We are using Github Actions alongside Fastlane to perform continuous integration both by unit testing and deploying to App Store Connect later on.
To make sure Fabric and App Store Connect can deploy, make sure you have them set to something similar to the following environment variables. The values are only examples!.
Note: For ENV variables to work in Xcode you to set $ defaults write com.apple.dt.Xcode UseSanitizedBuildSystemEnvironment -bool NO
and launch Xcode from the terminal. Apple Developer Forums
HOMEASSISTANT_CERTIFICATE_KEY
: The Certificate key used in MatchHOMEASSISTANT_CERTIFICATE_USER
: The username for the git being where Match is saving the Certificates.HOMEASSISTANT_CERTIFICATE_TOKEN
: The access token for the git being where Match is saving the Certificates.HOMEASSISTANT_CERTIFICATE_GIT
: The address or the git being where Match is saving the Certificates. (e.g. https://gitlab.com/username/Certificates)
HOMEASSISTANT_TEAM_ID
: Team ID from App Store Connect MembershipHOMEASSISTANT_APP_STORE_CONNECT_TEAM_ID
: Team ID from App Store Connect. ($ pilot list
to check the number)HOMEASSISTANT_APPLE_ID
: Your Apple ID (e.g. [email protected])
Although all the deployment is done through Github Actions, you can do it manually through Fastlane:
bundle exec fastlane asc
See CONTRIBUTING.md
Apache-2.0
The format and some content of this README.md comes from the SwipeIt project.