From fdb45e06d13f3ba93ee2d1c86b7c384d718b2548 Mon Sep 17 00:00:00 2001 From: carzh Date: Fri, 25 Oct 2024 14:03:09 -0700 Subject: [PATCH 01/14] add iOS browserstack tests to pipeline + adapt browserstack script arguments --- .../stages/mac-ios-packaging-build-stage.yml | 75 +++++++++++++++++-- .../upload_and_run_browserstack_tests.py | 14 ++-- 2 files changed, 75 insertions(+), 14 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml index a3b6bc1025267..2f1db4240d8f3 100644 --- a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml +++ b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml @@ -117,16 +117,75 @@ stages: useXcpretty: false # xcpretty can hide useful error output so we will disable it displayName: 'Build App Center iPhone arm64 tests' + - script: | + zip -r --symlinks $(Build.ArtifactStagingDirectory)/package_tests.zip ios_package_testUITests-Runner.app + workingDirectory: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/DerivedData/Build/Products/Debug-iphoneos' + displayName: "Create .zip file of the tests" + + - script: | + python $(Build.SourcesDirectory)/tools/python/generate_plist.py --dest_file "exportOptions.plist" + workingDirectory: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' + displayName: "Generate .plist file for the .ipa file" + env: + PROVISIONING_PROFILE_UUID: '$(APPLE_PROV_PROFILE_UUID)' + APPLE_TEAM_ID: '$(APPLE_TEAM_ID)' + + - task: Xcode@5 + inputs: + actions: 'archive' + xcWorkspacePath: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/apple_package_test.xcworkspace' + packageApp: true + archivePath: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' + exportOptions: 'plist' + exportOptionsPlist: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/exportOptions.plist' + configuration: 'Debug' + sdk: 'iphoneos' + scheme: 'ios_package_test' + xcodeVersion: 'specifyPath' + xcodeDeveloperDir: '/Applications/Xcode_${{ variables.xcodeVersion }}.app/Contents/Developer' + args: '-derivedDataPath $(Build.BinariesDirectory)/app_center_test/apple_package_test/DerivedData' + workingDirectory: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' + useXcpretty: false + displayName: 'Create archive for the .ipa file' + + - script: | + echo $(find ~+ -name "*.ipa" -type f) + workingDirectory: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' + displayName: "find ipa file" + + # Use script step because exporting the .ipa file using the Xcode@5 task was too brittle (Xcode@5 is designed + # to handle both the .xcarchive step and the .ipa step in the same step -- ran into countless issues with signing + # and the .plist file) + - script: | + xcodebuild -exportArchive \ + -archivePath ios_package_test.xcarchive \ + -exportOptionsPlist exportOptions.plist \ + -exportPath $(Build.ArtifactStagingDirectory)/test_ipa + workingDirectory: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' + displayName: "Create .ipa file" + env: + DEVELOPER_DIR: /Applications/Xcode_${{ variables.xcodeVersion }}.app/Contents/Developer + + # Publish the BrowserStack artifacts first so that if the next step fails, the artifacts will still be published + # so that users can attempt to locally debug + - publish: "$(Build.ArtifactStagingDirectory)" + artifact: "browserstack_test_artifacts" + displayName: "Publish BrowserStack test artifacts" + - script: | set -e -x - appcenter test run xcuitest \ - --app "AI-Frameworks/ORT-Mobile-iOS" \ - --devices $(app_center_test_devices) \ - --test-series "master" \ - --locale "en_US" \ - --build-dir $(Build.BinariesDirectory)/app_center_test/apple_package_test/DerivedData/Build/Products/Debug-iphoneos \ - --token $(app_center_api_token) - displayName: "Run E2E tests on App Center" + pip install requests + python $(Build.SourcesDirectory)/tools/python/upload_and_run_browserstack_tests.py \ + --test_platform xcuitest \ + --app_path "$(Build.ArtifactStagingDirectory)/test_ipa/ios_package_test.ipa" \ + --test_path "$(Build.ArtifactStagingDirectory)/package_tests.zip" \ + --devices "iPhone 15-17" + displayName: Run E2E tests using Browserstack + workingDirectory: $(Build.BinariesDirectory)/app_center_test/apple_package_test + timeoutInMinutes: 15 + env: + BROWSERSTACK_ID: $(browserstack_username) + BROWSERSTACK_TOKEN: $(browserstack_access_key) - script: | set -e -x diff --git a/tools/python/upload_and_run_browserstack_tests.py b/tools/python/upload_and_run_browserstack_tests.py index 8751368e1b2fc..e21a9eb6bae6a 100644 --- a/tools/python/upload_and_run_browserstack_tests.py +++ b/tools/python/upload_and_run_browserstack_tests.py @@ -78,22 +78,24 @@ def build_query_loop(build_id, test_platform, id, token): "--test_platform", type=str, help="Testing platform", choices=["espresso", "xcuitest"], required=True ) parser.add_argument( - "--app_apk_path", + "--app_path", type=Path, help=( - "Path to the app APK. " - "Typically, the app APK is in " + "Path to the app file. " + "For Android, typically, the app APK is in " "{build_output_dir}/android_test/android/app/build/outputs/apk/debug/app-debug.apk" + ". For iOS, you will have to build an IPA file from the test app." ), required=True, ) parser.add_argument( - "--test_apk_path", + "--test_path", type=Path, help=( "Path to the test APK. " "Typically, the test APK is in " "{build_output_dir}/android_test/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk" + ". For iOS, you will have to create a .zip of the tests." ), required=True, ) @@ -121,13 +123,13 @@ def build_query_loop(build_id, test_platform, id, token): # Upload the app and test suites upload_app_json = upload_apk_parse_json( f"https://api-cloud.browserstack.com/app-automate/{args.test_platform}/v2/app", - args.app_apk_path, + args.app_path, browserstack_id, browserstack_token, ) upload_test_json = upload_apk_parse_json( f"https://api-cloud.browserstack.com/app-automate/{args.test_platform}/v2/test-suite", - args.test_apk_path, + args.test_path, browserstack_id, browserstack_token, ) From a3f8822adc0c21b40c3ca8aa56cfe3bd165633c5 Mon Sep 17 00:00:00 2001 From: carzh Date: Fri, 25 Oct 2024 14:04:44 -0700 Subject: [PATCH 02/14] removed debug step + update android pipeline args --- .../azure-pipelines/templates/android-java-api-aar-test.yml | 4 ++-- .../templates/stages/mac-ios-packaging-build-stage.yml | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/android-java-api-aar-test.yml b/tools/ci_build/github/azure-pipelines/templates/android-java-api-aar-test.yml index e162365c40ce7..13236453f9906 100644 --- a/tools/ci_build/github/azure-pipelines/templates/android-java-api-aar-test.yml +++ b/tools/ci_build/github/azure-pipelines/templates/android-java-api-aar-test.yml @@ -77,8 +77,8 @@ jobs: pip install requests python $(Build.SourcesDirectory)/tools/python/upload_and_run_browserstack_tests.py \ --test_platform espresso \ - --app_apk_path "debug/app-debug.apk" \ - --test_apk_path "androidTest/debug/app-debug-androidTest.apk" \ + --app_path "debug/app-debug.apk" \ + --test_path "androidTest/debug/app-debug-androidTest.apk" \ --devices "Samsung Galaxy S23-13.0" "Google Pixel 3-9.0" displayName: Run E2E tests using Browserstack workingDirectory: $(Build.BinariesDirectory)/android_test/android/app/build/outputs/apk diff --git a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml index 2f1db4240d8f3..f5643d930a227 100644 --- a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml +++ b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml @@ -148,11 +148,6 @@ stages: useXcpretty: false displayName: 'Create archive for the .ipa file' - - script: | - echo $(find ~+ -name "*.ipa" -type f) - workingDirectory: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' - displayName: "find ipa file" - # Use script step because exporting the .ipa file using the Xcode@5 task was too brittle (Xcode@5 is designed # to handle both the .xcarchive step and the .ipa step in the same step -- ran into countless issues with signing # and the .plist file) From 25aa44b00191161bc3142604ad2fe626b8d98b02 Mon Sep 17 00:00:00 2001 From: carzh Date: Fri, 25 Oct 2024 14:15:32 -0700 Subject: [PATCH 03/14] .\tools\python\generate_plist.py --- tools/python/generate_plist.py | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tools/python/generate_plist.py diff --git a/tools/python/generate_plist.py b/tools/python/generate_plist.py new file mode 100644 index 0000000000000..ca3902d08c803 --- /dev/null +++ b/tools/python/generate_plist.py @@ -0,0 +1,41 @@ +import argparse +import os + +plist_file_content = """ + + + + + method + development + teamID + {team_id} + provisioningProfiles + + ai.onnxruntime.tests.ios-package-test + {provisioning_profile_uuid} + + signingStyle + manual + + +""" +if __name__ == "__main__": + # handle cli args + parser = argparse.ArgumentParser("Generates a PList file to the relevant destination") + + parser.add_argument("--dest_file", type=str, help="Path to output the PList file to.", required=True) + + args = parser.parse_args() + + team_id = os.environ["APPLE_TEAM_ID"] + provisioning_profile_uuid = os.environ["PROVISIONING_PROFILE_UUID"] + formatted_plist = plist_file_content.format(team_id = team_id, provisioning_profile_uuid = provisioning_profile_uuid) + + with open(args.dest_file, 'w') as file: + file.write(formatted_plist) + + print("wrote plist file to ", args.dest_file) + print() + print("contents of file:") + print(formatted_plist) From 036f6f816a2f3a7132023bfa3cf393f9ed1a4296 Mon Sep 17 00:00:00 2001 From: carzh Date: Wed, 30 Oct 2024 11:34:39 -0700 Subject: [PATCH 04/14] moved the generate plist script, switched to args instead of env vars, cleaned up + added docs, lintrunner --- .../apple/generate_ipa_export_options_plist.py | 10 +++++----- .../stages/mac-ios-packaging-build-stage.yml | 11 +++-------- tools/python/upload_and_run_browserstack_tests.py | 6 +++--- 3 files changed, 11 insertions(+), 16 deletions(-) rename tools/python/generate_plist.py => onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py (60%) diff --git a/tools/python/generate_plist.py b/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py similarity index 60% rename from tools/python/generate_plist.py rename to onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py index ca3902d08c803..cc0c6e1dd0e45 100644 --- a/tools/python/generate_plist.py +++ b/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py @@ -25,17 +25,17 @@ parser = argparse.ArgumentParser("Generates a PList file to the relevant destination") parser.add_argument("--dest_file", type=str, help="Path to output the PList file to.", required=True) + parser.add_argument("--apple_team_id", type=str, help="The Team ID associated with the provisioning profile. You should be able to find this from the Apple developer portal under Membership.", required=True) + parser.add_argument("--provisioning_profile_uuid", type=str, help="The Provisioning Profile UUID, which is the filename of the installed provisioning profile without the .mobileprovision extension. ", required=True) args = parser.parse_args() - team_id = os.environ["APPLE_TEAM_ID"] - provisioning_profile_uuid = os.environ["PROVISIONING_PROFILE_UUID"] - formatted_plist = plist_file_content.format(team_id = team_id, provisioning_profile_uuid = provisioning_profile_uuid) + formatted_plist = plist_file_content.format(team_id = args.apple_team_id, provisioning_profile_uuid = args.provisioning_profile_uuid) with open(args.dest_file, 'w') as file: file.write(formatted_plist) - print("wrote plist file to ", args.dest_file) + print("Wrote plist file to ", args.dest_file) print() - print("contents of file:") + print("Contents of file:") print(formatted_plist) diff --git a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml index f5643d930a227..058debd9ad006 100644 --- a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml +++ b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml @@ -123,21 +123,18 @@ stages: displayName: "Create .zip file of the tests" - script: | - python $(Build.SourcesDirectory)/tools/python/generate_plist.py --dest_file "exportOptions.plist" + python $(Build.SourcesDirectory)/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py --dest_file "exportOptions.plist" --apple_team_id $(APPLE_TEAM_ID) --provisioning_profile_uuid $(APPLE_PROV_PROFILE_UUID) workingDirectory: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' displayName: "Generate .plist file for the .ipa file" - env: - PROVISIONING_PROFILE_UUID: '$(APPLE_PROV_PROFILE_UUID)' - APPLE_TEAM_ID: '$(APPLE_TEAM_ID)' - task: Xcode@5 inputs: actions: 'archive' - xcWorkspacePath: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/apple_package_test.xcworkspace' + xcWorkspacePath: 'apple_package_test.xcworkspace' packageApp: true archivePath: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' exportOptions: 'plist' - exportOptionsPlist: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/exportOptions.plist' + exportOptionsPlist: 'exportOptions.plist' configuration: 'Debug' sdk: 'iphoneos' scheme: 'ios_package_test' @@ -158,8 +155,6 @@ stages: -exportPath $(Build.ArtifactStagingDirectory)/test_ipa workingDirectory: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' displayName: "Create .ipa file" - env: - DEVELOPER_DIR: /Applications/Xcode_${{ variables.xcodeVersion }}.app/Contents/Developer # Publish the BrowserStack artifacts first so that if the next step fails, the artifacts will still be published # so that users can attempt to locally debug diff --git a/tools/python/upload_and_run_browserstack_tests.py b/tools/python/upload_and_run_browserstack_tests.py index e21a9eb6bae6a..8853b9d5ade15 100644 --- a/tools/python/upload_and_run_browserstack_tests.py +++ b/tools/python/upload_and_run_browserstack_tests.py @@ -82,7 +82,7 @@ def build_query_loop(build_id, test_platform, id, token): type=Path, help=( "Path to the app file. " - "For Android, typically, the app APK is in " + "For Android, typically, the app file (the APK) is in " "{build_output_dir}/android_test/android/app/build/outputs/apk/debug/app-debug.apk" ". For iOS, you will have to build an IPA file from the test app." ), @@ -92,7 +92,7 @@ def build_query_loop(build_id, test_platform, id, token): "--test_path", type=Path, help=( - "Path to the test APK. " + "Path to the test suite file. " "Typically, the test APK is in " "{build_output_dir}/android_test/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk" ". For iOS, you will have to create a .zip of the tests." @@ -104,7 +104,7 @@ def build_query_loop(build_id, test_platform, id, token): type=str, nargs="+", help="List of devices to run the tests on. For more info, " - "see https://www.browserstack.com/docs/app-automate/espresso/specify-devices", + "see https://www.browserstack.com/docs/app-automate/espresso/specify-devices (Android) or https://www.browserstack.com/docs/app-automate/xcuitest/specify-devices (iOS)", required=True, ) From b409e69f3b17775533f3702f9bcb2ae54efb9b51 Mon Sep 17 00:00:00 2001 From: carzh Date: Wed, 30 Oct 2024 14:02:44 -0700 Subject: [PATCH 05/14] lintrunner + added more docs --- .../generate_ipa_export_options_plist.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py b/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py index cc0c6e1dd0e45..5bdc16105b52c 100644 --- a/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py +++ b/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py @@ -1,5 +1,4 @@ import argparse -import os plist_file_content = """ @@ -25,14 +24,26 @@ parser = argparse.ArgumentParser("Generates a PList file to the relevant destination") parser.add_argument("--dest_file", type=str, help="Path to output the PList file to.", required=True) - parser.add_argument("--apple_team_id", type=str, help="The Team ID associated with the provisioning profile. You should be able to find this from the Apple developer portal under Membership.", required=True) - parser.add_argument("--provisioning_profile_uuid", type=str, help="The Provisioning Profile UUID, which is the filename of the installed provisioning profile without the .mobileprovision extension. ", required=True) + parser.add_argument( + "--apple_team_id", + type=str, + help="The Team ID associated with the provisioning profile. You should be able to find this from the Apple developer portal under Membership.", + required=True, + ) + parser.add_argument( + "--provisioning_profile_uuid", + type=str, + help="The Provisioning Profile UUID, which is the filename of the installed provisioning profile without the .mobileprovision extension. ", + required=True, + ) args = parser.parse_args() - formatted_plist = plist_file_content.format(team_id = args.apple_team_id, provisioning_profile_uuid = args.provisioning_profile_uuid) + formatted_plist = plist_file_content.format( + team_id=args.apple_team_id, provisioning_profile_uuid=args.provisioning_profile_uuid + ) - with open(args.dest_file, 'w') as file: + with open(args.dest_file, "w") as file: file.write(formatted_plist) print("Wrote plist file to ", args.dest_file) From fb296aa182d51d9fdde15ee3e1724eb1fa7f5585 Mon Sep 17 00:00:00 2001 From: carzh Date: Wed, 30 Oct 2024 14:05:58 -0700 Subject: [PATCH 06/14] updated docs --- tools/python/upload_and_run_browserstack_tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/python/upload_and_run_browserstack_tests.py b/tools/python/upload_and_run_browserstack_tests.py index 8853b9d5ade15..09228f2b49b26 100644 --- a/tools/python/upload_and_run_browserstack_tests.py +++ b/tools/python/upload_and_run_browserstack_tests.py @@ -84,7 +84,7 @@ def build_query_loop(build_id, test_platform, id, token): "Path to the app file. " "For Android, typically, the app file (the APK) is in " "{build_output_dir}/android_test/android/app/build/outputs/apk/debug/app-debug.apk" - ". For iOS, you will have to build an IPA file from the test app." + ". For iOS, you will have to build an IPA file from the test app, which is built from the .xcarchive path" ), required=True, ) @@ -95,7 +95,7 @@ def build_query_loop(build_id, test_platform, id, token): "Path to the test suite file. " "Typically, the test APK is in " "{build_output_dir}/android_test/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk" - ". For iOS, you will have to create a .zip of the tests." + ". For iOS, you will have to create a .zip of the tests. After manually building the tests, the tests that you need to zip will be in {{DerivedDataFolderPath}}/Build/Products" ), required=True, ) From 5ff057f2f267543b0ada7c12898609cf67e2817b Mon Sep 17 00:00:00 2001 From: carzh Date: Wed, 30 Oct 2024 14:21:48 -0700 Subject: [PATCH 07/14] lintrunner again T-T --- .../test/platform/apple/generate_ipa_export_options_plist.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py b/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py index 5bdc16105b52c..31a03267d9ab2 100644 --- a/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py +++ b/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py @@ -21,7 +21,9 @@ """ if __name__ == "__main__": # handle cli args - parser = argparse.ArgumentParser("Generates a PList file to the relevant destination") + parser = argparse.ArgumentParser( + "Generates a PList file to the relevant destination. This PList file contains the properties to allow a user to generate an IPA file for the ios-package-test. " + ) parser.add_argument("--dest_file", type=str, help="Path to output the PList file to.", required=True) parser.add_argument( From 1792e9dda3ff74fa17be621caa228da126ff8557 Mon Sep 17 00:00:00 2001 From: carzh Date: Wed, 30 Oct 2024 15:17:25 -0700 Subject: [PATCH 08/14] required full path for xcworkspace path --- .../templates/stages/mac-ios-packaging-build-stage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml index 058debd9ad006..4e388aa9e5d0b 100644 --- a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml +++ b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml @@ -130,7 +130,7 @@ stages: - task: Xcode@5 inputs: actions: 'archive' - xcWorkspacePath: 'apple_package_test.xcworkspace' + xcWorkspacePath: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/apple_package_test.xcworkspace' packageApp: true archivePath: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' exportOptions: 'plist' From 42984383b6f390c66587f4e62e2dd6273c092787 Mon Sep 17 00:00:00 2001 From: carzh Date: Wed, 30 Oct 2024 22:46:37 -0700 Subject: [PATCH 09/14] added absolute paths back in + try with removing developerdir --- .../templates/stages/mac-ios-packaging-build-stage.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml index 4e388aa9e5d0b..d94dddbfb2ef7 100644 --- a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml +++ b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml @@ -108,7 +108,6 @@ stages: sdk: 'iphoneos' scheme: 'ios_package_test' xcodeVersion: 'specifyPath' - xcodeDeveloperDir: '/Applications/Xcode_${{ variables.xcodeVersion }}.app/Contents/Developer' signingOption: 'manual' signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)' provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)' @@ -134,12 +133,11 @@ stages: packageApp: true archivePath: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' exportOptions: 'plist' - exportOptionsPlist: 'exportOptions.plist' + exportOptionsPlist: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/exportOptions.plist' configuration: 'Debug' sdk: 'iphoneos' scheme: 'ios_package_test' xcodeVersion: 'specifyPath' - xcodeDeveloperDir: '/Applications/Xcode_${{ variables.xcodeVersion }}.app/Contents/Developer' args: '-derivedDataPath $(Build.BinariesDirectory)/app_center_test/apple_package_test/DerivedData' workingDirectory: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' useXcpretty: false From 9a77d764eddcc1dea31c425783fbdbb701ff6ac3 Mon Sep 17 00:00:00 2001 From: carzh Date: Thu, 31 Oct 2024 13:52:20 -0700 Subject: [PATCH 10/14] removed xcodeversion option --- .../templates/stages/mac-ios-packaging-build-stage.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml index d94dddbfb2ef7..08e512d153dc1 100644 --- a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml +++ b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml @@ -107,7 +107,6 @@ stages: xcWorkspacePath: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/apple_package_test.xcworkspace' sdk: 'iphoneos' scheme: 'ios_package_test' - xcodeVersion: 'specifyPath' signingOption: 'manual' signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)' provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)' @@ -137,7 +136,6 @@ stages: configuration: 'Debug' sdk: 'iphoneos' scheme: 'ios_package_test' - xcodeVersion: 'specifyPath' args: '-derivedDataPath $(Build.BinariesDirectory)/app_center_test/apple_package_test/DerivedData' workingDirectory: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' useXcpretty: false From 927527853260fe726edc43aec83534bd9eb37b07 Mon Sep 17 00:00:00 2001 From: carzh Date: Fri, 1 Nov 2024 13:55:04 -0700 Subject: [PATCH 11/14] updated docs --- .../templates/stages/mac-ios-packaging-build-stage.yml | 5 +++++ tools/python/upload_and_run_browserstack_tests.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml index 08e512d153dc1..939c2a0415983 100644 --- a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml +++ b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml @@ -100,6 +100,8 @@ stages: --prepare_test_project_only displayName: "Assemble test project for App Center" + # Xcode tasks require absolute paths because it searches for the paths and files relative to + # the root directory and not relative to the working directory - task: Xcode@5 inputs: actions: 'build-for-testing' @@ -125,6 +127,9 @@ stages: workingDirectory: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' displayName: "Generate .plist file for the .ipa file" + # Task only generates an .xcarchive file if the plist export options are included, but does + # not produce an IPA file. + # Source code: https://github.com/microsoft/azure-pipelines-tasks/blob/master/Tasks/XcodeV5/xcode.ts - task: Xcode@5 inputs: actions: 'archive' diff --git a/tools/python/upload_and_run_browserstack_tests.py b/tools/python/upload_and_run_browserstack_tests.py index 09228f2b49b26..5f494ae438100 100644 --- a/tools/python/upload_and_run_browserstack_tests.py +++ b/tools/python/upload_and_run_browserstack_tests.py @@ -95,7 +95,7 @@ def build_query_loop(build_id, test_platform, id, token): "Path to the test suite file. " "Typically, the test APK is in " "{build_output_dir}/android_test/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk" - ". For iOS, you will have to create a .zip of the tests. After manually building the tests, the tests that you need to zip will be in {{DerivedDataFolderPath}}/Build/Products" + ". For iOS, you will have to create a .zip of the tests. After manually building the tests, the tests that you need to zip will be in {{XcodeDerivedDataFolderPath}}/Build/Products" ), required=True, ) From 68e596e63866019b31d95bce7968a4eb2d8746b5 Mon Sep 17 00:00:00 2001 From: Caroline Zhu Date: Fri, 1 Nov 2024 14:58:08 -0700 Subject: [PATCH 12/14] Update tools/python/upload_and_run_browserstack_tests.py Co-authored-by: Scott McKay --- tools/python/upload_and_run_browserstack_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/python/upload_and_run_browserstack_tests.py b/tools/python/upload_and_run_browserstack_tests.py index 5f494ae438100..9b812da156707 100644 --- a/tools/python/upload_and_run_browserstack_tests.py +++ b/tools/python/upload_and_run_browserstack_tests.py @@ -95,7 +95,7 @@ def build_query_loop(build_id, test_platform, id, token): "Path to the test suite file. " "Typically, the test APK is in " "{build_output_dir}/android_test/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk" - ". For iOS, you will have to create a .zip of the tests. After manually building the tests, the tests that you need to zip will be in {{XcodeDerivedDataFolderPath}}/Build/Products" + ". For iOS, you will have to create a .zip of the tests. After manually building the tests, the tests that you need to zip will be in {{Xcode DerivedData Folder Path}}/Build/Products" ), required=True, ) From cfc227292a4dcce88ade00ba3f2a9926615e19f4 Mon Sep 17 00:00:00 2001 From: carzh Date: Fri, 1 Nov 2024 15:12:31 -0700 Subject: [PATCH 13/14] removed install app center stage, deleted install app center yaml, and updated docs to be more accurate --- .../apple/generate_ipa_export_options_plist.py | 2 +- .../azure-pipelines/templates/install-appcenter.yml | 12 ------------ .../stages/mac-ios-packaging-build-stage.yml | 2 -- 3 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 tools/ci_build/github/azure-pipelines/templates/install-appcenter.yml diff --git a/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py b/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py index 31a03267d9ab2..4e5329dd5b09a 100644 --- a/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py +++ b/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py @@ -35,7 +35,7 @@ parser.add_argument( "--provisioning_profile_uuid", type=str, - help="The Provisioning Profile UUID, which is the filename of the installed provisioning profile without the .mobileprovision extension. ", + help="The Provisioning Profile UUID, which can be found in the .mobileprovision file. ", required=True, ) diff --git a/tools/ci_build/github/azure-pipelines/templates/install-appcenter.yml b/tools/ci_build/github/azure-pipelines/templates/install-appcenter.yml deleted file mode 100644 index 51be73d4c658a..0000000000000 --- a/tools/ci_build/github/azure-pipelines/templates/install-appcenter.yml +++ /dev/null @@ -1,12 +0,0 @@ -# Install appcenter CLI - -parameters: -- name: appcenterVersion - type: string - default: "2.13.7" - -steps: -- bash: | - set -e -x - npm install -g appcenter-cli@${{ parameters.appcenterVersion }} - displayName: Install appcenter CLI ${{ parameters.appcenterVersion }} diff --git a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml index 939c2a0415983..5441402ab920c 100644 --- a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml +++ b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml @@ -70,8 +70,6 @@ stages: parameters: xcodeVersion: $(xcodeVersion) - - template: ../install-appcenter.yml - - script: | pip install -r tools/ci_build/github/apple/ios_packaging/requirements.txt displayName: "Install Python requirements" From 5f40cecee79747d9f0fd8e3b4e00735251397c55 Mon Sep 17 00:00:00 2001 From: Caroline Zhu Date: Mon, 4 Nov 2024 10:11:17 -0800 Subject: [PATCH 14/14] Update tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com> --- .../templates/stages/mac-ios-packaging-build-stage.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml index 5441402ab920c..b6a214154e680 100644 --- a/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml +++ b/tools/ci_build/github/azure-pipelines/templates/stages/mac-ios-packaging-build-stage.yml @@ -121,7 +121,10 @@ stages: displayName: "Create .zip file of the tests" - script: | - python $(Build.SourcesDirectory)/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py --dest_file "exportOptions.plist" --apple_team_id $(APPLE_TEAM_ID) --provisioning_profile_uuid $(APPLE_PROV_PROFILE_UUID) + python $(Build.SourcesDirectory)/onnxruntime/test/platform/apple/generate_ipa_export_options_plist.py \ + --dest_file "exportOptions.plist" \ + --apple_team_id $(APPLE_TEAM_ID) \ + --provisioning_profile_uuid $(APPLE_PROV_PROFILE_UUID) workingDirectory: '$(Build.BinariesDirectory)/app_center_test/apple_package_test/' displayName: "Generate .plist file for the .ipa file"