Skip to content

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

Merged
merged 20 commits into from
Aug 26, 2024

Conversation

huydhn
Copy link
Contributor

@huydhn huydhn commented Aug 13, 2024

This PR adds a script .ci/scripts/setup-ios.sh to to install Apple certificate for CI iOS jobs, which is then used to build and sign ExecuTorchDemo app and its test suite.

The following secrets have been setup in the repo:

  • BUILD_CERTIFICATE_BASE64, the p12 build certificate.
  • EXECUTORCH_DEMO_BUILD_PROVISION_PROFILE_BASE64, ExecuTorchDemo provisioning profile
  • LLAMA_BUILD_PROVISION_PROFILE_BASE64, iLLaMA provisioning profile
  • KEYCHAIN_PASSWORD, a random password for the temporary keychain on the runner

After this change, I can follow up with CI jobs to:

  • Test ExecuTorchDemo on AWS Device Farm as an example on how it is setup
  • Build and sign LLaMA demo app

Copy link

pytorch-bot bot commented Aug 13, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/4703

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 789ae9d with merge base f492d96 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 13, 2024
@huydhn huydhn changed the title Install Apple certificate for iOS jobs Add a script to install Apple certificate for CI iOS jobs Aug 23, 2024
@@ -59,6 +59,13 @@
remoteGlobalIDString = 03C818302AC79FCD0084CC29;
remoteInfo = ImageClassification;
};
84EF1FE92C7850B6005922B4 /* PBXContainerItemProxy */ = {
Copy link
Contributor Author

@huydhn huydhn Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the changes here in xcodeproj are to make the ExecuTorchDemo app host the test suite MobileNetClassifierTest so that the suite can be run on actual AWS devices (coming up next in a separate PR)

Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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:

  1. Either create a new empty app to host MobileNetClassifierTest
  2. or just reuse the ExecuTorchDemo app (as show in my xcode screenshot). This kind of makes more sense to me because we will also be able to test if the app can be run at all on iOS. So, two birds one stone.

Screenshot 2024-08-26 at 11 37 27

@shoumikhin what would be your preferred choice here from the expert?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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)

Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I see, if we can keep the bundle id org.pytorch.executorch.demo.test, then we can reuse the provisioning profile. Otherwise, we need a new one and store it under a different secret.

@huydhn huydhn requested review from shoumikhin and guangy10 August 23, 2024 08:15
@huydhn huydhn marked this pull request as ready for review August 23, 2024 08:15
@facebook-github-bot
Copy link
Contributor

@huydhn has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@huydhn has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@huydhn has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

# 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
Copy link
Contributor

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?

Copy link
Contributor Author

@huydhn huydhn Aug 26, 2024

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

Comment on lines +64 to +66
containerPortal = 032C01672AC228E5002955E1 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 032C016E2AC228E6002955E1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these magic numbers?

Copy link
Contributor

@guangy10 guangy10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@huydhn Thanks for adding the certificates for iOS to the CI.

The demo setup we are using in this PR is for MV2. My only question (for @shoumikhin) is how can we swap with different models? I think we would want to have a generic loader app same as what @kirklandsign is doing for Android.

@facebook-github-bot facebook-github-bot merged commit 2b2911b into main Aug 26, 2024
62 of 63 checks passed
@facebook-github-bot facebook-github-bot deleted the ios-device-farm branch August 26, 2024 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants