All contributors to your PR must sign our Individual Contributor License Agreement (CLA). The CLA is a short form that ensures that you are eligible to contribute.
Keep your Pull Requests small. Small PRs are easier to reason about which makes them significantly more likely to get merged.
If you want to add a feature, please file an Issue first. An Issue gives us the opportunity to discuss the requirements and implications of a feature with you before you start writing code.
Respect the minimum deployment target. If you are adding code that uses new APIs, make sure to prevent older clients from crashing or misbehaving. Our CI runs against our minimum deployment targets, so you will not get a green build unless your code is backwards compatible.
Please do not write new code using deprecated APIs.
When making changes that change how the keychain works on macOS, you must test this change locally. Unfortunately, running our integration test suite on macOS requires a signed environment, and the esoteric nature of codesigning on macOS means we currently cannot run these tests in CI.
To run macOS tests locally, you'll need to do the following in the Valet Xcode project settings:
- Read through all the following steps before starting this process!
- Commit your current work to
git
so you can easily clear the following changes. - Select the
Valet Mac Tests
target's "General" settings and change the "Host Application" setting fromNone
toValet macOS Test Host App
- Select the
Valet Mac Tests
target's "Signing & Capabilities" settings and change the "Team" to be your personal team. - Select the
Valet macOS Test Host App
target's "Signing & Capabilities" settings and select the "Team" to be your personal team. This will result in an error – this is expected and continuing to follow the below steps will resolve the error. - Select the
Valet macOS Test Host App
target's "Signing & Capabilities" settings and change the Bundle Identifier to be a unique bundle identifier that references your team name. Run a find and replace over the code to change allcom.squareup.Valet-macOS-Test-Host-App
strings to be your new bundle identifier. - Run a find and replace over the code to change all instances of
9XUJ7M53NG
to reference your personal team ID. Your personal team ID is the same as the prefix shown in the App Groups entitlement. - Make the
_sharedAccessGroupPrefix
method ofVALLegacyValet
return your personal team ID by addingreturn @"Your_Team_ID_Here";
to the first line of this method. - Select the
Valet Mac
scheme.
You can now run all macOS tests locally. Note that you will be required to enter your computer password many times in order for the tests to successfully complete. Failing to enter your password will cause a test to fail. Make sure not to commit these project configuration and code changes after testing your change.
If you encounter entitlement errors when running tests after following the above steps, you can address by opening /System/Applications/Utilities/Keychain\ Access.app
and deleting all entries that start with VAL_VAL
. Note that this will delete any secrets from your macOS applications that utilize Valet, so this step should be taken only as a last resort.
When making changes that change how the keychain works on watchOS, you must test this change locally. Unfortunately, Apple doesn't yet ship a native XCTest library on watchOS, which means we currently cannot easily run these tests in CI. We have, however, hooked up a custom implementation of XCTest to enable running tests locally. If you're interested in helping us get this test suite running in CI, check out issue #128.
To run tests against watchOS, you'll need to select the Valet watchOS Test Host App
target, select an Apple Watch simulator, and then run the target. You'll know that tests have succeeded because the application run will not hit an assertion failure and will print ALL TESTS PASSED
to the Xcode console.