-
Notifications
You must be signed in to change notification settings - Fork 607
Add a script to install Apple certificate for CI iOS jobs #4703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6639d1d
e2d1ade
8c1b97d
968fc75
d7a1987
ede7244
9e92bb1
90843d1
b7c8707
0d544b5
cd08eab
6866ab8
f762982
fb9b414
7cb6575
b26f03f
c18f523
d78a680
c5d06bf
789ae9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
# All rights reserved. | ||
# | ||
# This source code is licensed under the BSD-style license found in the | ||
# LICENSE file in the root directory of this source tree. | ||
|
||
set -exu | ||
|
||
# This script follows the instructions from GitHub to install an Apple certificate | ||
# https://docs.github.com/en/actions/use-cases-and-examples/deploying/installing-an-apple-certificate-on-macos-runners-for-xcode-development | ||
|
||
CERTIFICATE_PATH="${RUNNER_TEMP}"/build_certificate.p12 | ||
PP_PATH="${RUNNER_TEMP}"/build_pp.mobileprovision | ||
KEYCHAIN_PATH="${RUNNER_TEMP}"/app-signing.keychain-db | ||
|
||
# Import certificate and provisioning profile from secrets | ||
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH | ||
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH | ||
|
||
# Create a temporary keychain | ||
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | ||
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | ||
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | ||
|
||
# Import certificate to the keychain | ||
security import $CERTIFICATE_PATH -P "" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | ||
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | ||
security list-keychain -d user -s $KEYCHAIN_PATH | ||
|
||
# Apply provisioning profile | ||
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | ||
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,13 @@ | |
remoteGlobalIDString = 03C818302AC79FCD0084CC29; | ||
remoteInfo = ImageClassification; | ||
}; | ||
84EF1FE92C7850B6005922B4 /* PBXContainerItemProxy */ = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All the changes here in xcodeproj are to make the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you mean by making the ExecuTorchDemo app host the test suite MobileNetClassifierTest? Are they built and uploaded as separate artifacts in test_ios_ci.sh? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, unlike running the test suite in a simulator, running it on actual iOS devices requires a hosting app. So I have 2 choices:
@shoumikhin what would be your preferred choice here from the expert? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Btw, the change I'm highlighting in the screenshot is responsible for those magic numbers that you notice (auto-generated by xcode) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For this PR to demonstrate using the certs in the workflow I think option 2 makes sense. I'm chatting with @shoumikhin regarding a generic app for benchmarking we will create a new app from scratch with no UI but just tests. @huydhn @shoumikhin once we have that app, can we reuse the provisioning profile and secret directly, or need to re-gen for the new app? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I see, if we can keep the bundle id |
||
isa = PBXContainerItemProxy; | ||
containerPortal = 032C01672AC228E5002955E1 /* Project object */; | ||
proxyType = 1; | ||
remoteGlobalIDString = 032C016E2AC228E6002955E1; | ||
Comment on lines
+64
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are these magic numbers? |
||
remoteInfo = App; | ||
}; | ||
/* End PBXContainerItemProxy section */ | ||
|
||
/* Begin PBXCopyFilesBuildPhase section */ | ||
|
@@ -330,6 +337,7 @@ | |
buildRules = ( | ||
); | ||
dependencies = ( | ||
84EF1FEA2C7850B6005922B4 /* PBXTargetDependency */, | ||
); | ||
name = MobileNetClassifierTest; | ||
packageProductDependencies = ( | ||
|
@@ -489,6 +497,11 @@ | |
target = 03C818302AC79FCD0084CC29 /* ImageClassification */; | ||
targetProxy = 03C818452AC7A0DB0084CC29 /* PBXContainerItemProxy */; | ||
}; | ||
84EF1FEA2C7850B6005922B4 /* PBXTargetDependency */ = { | ||
isa = PBXTargetDependency; | ||
target = 032C016E2AC228E6002955E1 /* App */; | ||
targetProxy = 84EF1FE92C7850B6005922B4 /* PBXContainerItemProxy */; | ||
}; | ||
/* End PBXTargetDependency section */ | ||
|
||
/* Begin XCBuildConfiguration section */ | ||
|
@@ -633,7 +646,7 @@ | |
INFOPLIST_KEY_UIRequiresFullScreen = YES; | ||
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; | ||
MARKETING_VERSION = 1.0; | ||
PRODUCT_BUNDLE_IDENTIFIER = org.pytorch.executorch.demo; | ||
PRODUCT_BUNDLE_IDENTIFIER = org.pytorch.executorch.demo.test; | ||
guangy10 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
PRODUCT_NAME = "$(PROJECT_NAME)"; | ||
PROVISIONING_PROFILE_SPECIFIER = ""; | ||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; | ||
|
@@ -661,7 +674,7 @@ | |
INFOPLIST_KEY_UIRequiresFullScreen = YES; | ||
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; | ||
MARKETING_VERSION = 1.0; | ||
PRODUCT_BUNDLE_IDENTIFIER = org.pytorch.executorch.demo; | ||
PRODUCT_BUNDLE_IDENTIFIER = org.pytorch.executorch.demo.test; | ||
PRODUCT_NAME = "$(PROJECT_NAME)"; | ||
PROVISIONING_PROFILE_SPECIFIER = ""; | ||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; | ||
|
@@ -703,6 +716,7 @@ | |
SUPPORTS_MACCATALYST = NO; | ||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; | ||
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | ||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ExecuTorchDemo.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/ExecuTorchDemo"; | ||
}; | ||
name = Debug; | ||
}; | ||
|
@@ -717,6 +731,7 @@ | |
PRODUCT_NAME = "$(TARGET_NAME)"; | ||
SUPPORTS_MACCATALYST = NO; | ||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; | ||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ExecuTorchDemo.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/ExecuTorchDemo"; | ||
}; | ||
name = Release; | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the $RUNNER_TEMP set?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's one of the default env variables set by GitHub, usually it's a sub-directory inside runner installation dir https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables