From e4d81d9f95180b66819c3fc665ce3e6a3b9c2149 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 3 Jul 2024 10:33:27 -0700 Subject: [PATCH 001/115] test build app with local personal account --- .github/workflows/ci.yml | 24 +++++++++++++++++++ .../MqttClient.xcodeproj/project.pbxproj | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 62f58f331..9bfb0ac2d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,6 +61,30 @@ jobs: chmod a+x builder ./builder build -p ${{ env.PACKAGE_NAME }} + ios-integration-test: + runs-on: macos-14 + env: + DEVELOPER_DIR: /Applications/Xcode.app + XCODE_DESTINATION: 'OS X' + NSUnbufferedIO: YES + steps: + - name: Build ${{ env.PACKAGE_NAME }} + consumers + run: | + python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" + chmod a+x builder + ./builder build -p ${{ env.PACKAGE_NAME }} + - name: Buil test apple + run: | + xcode-select --print-path + cd Test/IntegrationTests/MqttClient + xcodebuild -resolvePackageDependencies + echo "start build app" + xcodebuild -scheme "MqttClient" \ + -archivePath $RUNNER_TEMP/MqttClient.xcarchive \ + -configuration Release \ + -destination generic/platform=iOS \ + clean archive + devices: runs-on: ${{ matrix.runner }} env: diff --git a/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj b/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj index 63868f262..fab7b891d 100644 --- a/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj +++ b/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj @@ -274,7 +274,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = K33Z8NL3RV; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; From a5884f964c977a1ddb5ef0752d66aab8ea16f5b4 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 3 Jul 2024 10:41:27 -0700 Subject: [PATCH 002/115] check working directory --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9bfb0ac2d..7b806219e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,9 @@ jobs: - name: Buil test apple run: | xcode-select --print-path - cd Test/IntegrationTests/MqttClient + pwd + cd aws-crt-swift/Test/IntegrationTests/MqttClient + pwd xcodebuild -resolvePackageDependencies echo "start build app" xcodebuild -scheme "MqttClient" \ From 048ff0003c3b52650e145dc2544f185ad1966aa4 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 8 Jul 2024 10:09:12 -0700 Subject: [PATCH 003/115] allowProvisioningUpdates --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b806219e..c8c6e9a47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,7 +85,7 @@ jobs: -archivePath $RUNNER_TEMP/MqttClient.xcarchive \ -configuration Release \ -destination generic/platform=iOS \ - clean archive + clean archive -allowProvisioningUpdates devices: runs-on: ${{ matrix.runner }} From 21013437116309856535d0a331ca557ded5cbb4e Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 8 Jul 2024 14:37:54 -0700 Subject: [PATCH 004/115] import identity --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c8c6e9a47..d149fcc1f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,6 +73,31 @@ jobs: python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" chmod a+x builder ./builder build -p ${{ env.PACKAGE_NAME }} + - name: Install the Apple certificate and provisioning profile + env: + BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.MOBILEPROVISION_BASE64 }} + KEYCHAIN_PASSWORD: ${{ secrets.TEST_KEYCHAIN_PASSWORD }} + CI_TEST_SECRET_MANAGER_ROLE: arn:aws:iam::976188456881:role/CI_TEST_SECRET_MANAGER_ACCESS + run: | + CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 + PP_PATH=$RUNNER_TEMP/shoppingmacdev.mobileprovision + KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db + + pkcs12_identity_base64=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/base64_pkcs12" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") + pkcs12_identity_pw=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/pw_pkcs12" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") + # import certificate and provisioning profile from secrets + echo -n "$pkcs12_identity_base64" | base64 --decode -o $CERTIFICATE_PATH + # echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH + # create 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 keychain + security import $CERTIFICATE_PATH -P "$pkcs12_identity_pw" -A -t cert -f pkcs12 -k $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 - name: Buil test apple run: | xcode-select --print-path From e36bc2378321ef8c8d9161d8ff68309145100e4c Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 8 Jul 2024 14:51:40 -0700 Subject: [PATCH 005/115] setup aws role --- .github/workflows/ci.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d149fcc1f..ce534998d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,17 +67,22 @@ jobs: DEVELOPER_DIR: /Applications/Xcode.app XCODE_DESTINATION: 'OS X' NSUnbufferedIO: YES + BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.MOBILEPROVISION_BASE64 }} + KEYCHAIN_PASSWORD: ${{ secrets.TEST_KEYCHAIN_PASSWORD }} + CI_TEST_SECRET_MANAGER_ROLE: arn:aws:iam::976188456881:role/CI_TEST_SECRET_MANAGER_ACCESS steps: - name: Build ${{ env.PACKAGE_NAME }} + consumers run: | python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" chmod a+x builder ./builder build -p ${{ env.PACKAGE_NAME }} + + - name: configure AWS credentials (PubSub) + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: ${{ env.CI_TEST_SECRET_MANAGER_ROLE }} + aws-region: us-east-1 - name: Install the Apple certificate and provisioning profile - env: - BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.MOBILEPROVISION_BASE64 }} - KEYCHAIN_PASSWORD: ${{ secrets.TEST_KEYCHAIN_PASSWORD }} - CI_TEST_SECRET_MANAGER_ROLE: arn:aws:iam::976188456881:role/CI_TEST_SECRET_MANAGER_ACCESS run: | CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 PP_PATH=$RUNNER_TEMP/shoppingmacdev.mobileprovision From 498250084ccbe68fbbb169070d9c4a942434de5e Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 8 Jul 2024 15:54:22 -0700 Subject: [PATCH 006/115] test with CI provider id --- .github/workflows/ci.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce534998d..d6b7a1ba6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,20 +63,22 @@ jobs: ios-integration-test: runs-on: macos-14 + permissions: + id-token: write # This is required for requesting the JWT + contents: read # This is required for actions/checkout env: DEVELOPER_DIR: /Applications/Xcode.app XCODE_DESTINATION: 'OS X' NSUnbufferedIO: YES BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.MOBILEPROVISION_BASE64 }} KEYCHAIN_PASSWORD: ${{ secrets.TEST_KEYCHAIN_PASSWORD }} - CI_TEST_SECRET_MANAGER_ROLE: arn:aws:iam::976188456881:role/CI_TEST_SECRET_MANAGER_ACCESS + CI_TEST_SECRET_MANAGER_ROLE: arn:aws:iam::976188456881:role/CI_TEST_PROVIDER_ASSUME_ROLE steps: - name: Build ${{ env.PACKAGE_NAME }} + consumers run: | python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" chmod a+x builder ./builder build -p ${{ env.PACKAGE_NAME }} - - name: configure AWS credentials (PubSub) uses: aws-actions/configure-aws-credentials@v2 with: From e998a788cfc65ff577cfce8c148600a1a1ade1e3 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 8 Jul 2024 16:09:34 -0700 Subject: [PATCH 007/115] test secret manager result --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6b7a1ba6..f95dc71bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,6 +92,7 @@ jobs: pkcs12_identity_base64=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/base64_pkcs12" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") pkcs12_identity_pw=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/pw_pkcs12" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") + echo -n "$pkcs12_identity_base64" # import certificate and provisioning profile from secrets echo -n "$pkcs12_identity_base64" | base64 --decode -o $CERTIFICATE_PATH # echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH From 4e7c3d9003f414e1443b55bf94c1f25430517124 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 8 Jul 2024 16:24:57 -0700 Subject: [PATCH 008/115] remove print --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f95dc71bb..1b08f84ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,10 +89,8 @@ jobs: CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 PP_PATH=$RUNNER_TEMP/shoppingmacdev.mobileprovision KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db - pkcs12_identity_base64=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/base64_pkcs12" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") pkcs12_identity_pw=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/pw_pkcs12" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") - echo -n "$pkcs12_identity_base64" # import certificate and provisioning profile from secrets echo -n "$pkcs12_identity_base64" | base64 --decode -o $CERTIFICATE_PATH # echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH From ed8c71475ededce7d36e3c258b659802a05f8b85 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 8 Jul 2024 16:42:03 -0700 Subject: [PATCH 009/115] import provision file --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b08f84ab..9da4afe73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,9 +91,10 @@ jobs: KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db pkcs12_identity_base64=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/base64_pkcs12" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") pkcs12_identity_pw=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/pw_pkcs12" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") + provision_base64 = $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/provision_base64" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") # import certificate and provisioning profile from secrets echo -n "$pkcs12_identity_base64" | base64 --decode -o $CERTIFICATE_PATH - # echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH + echo -n "$provision_base64" | base64 --decode -o $PP_PATH # create temporary keychain security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH security set-keychain-settings -lut 21600 $KEYCHAIN_PATH From 97923c84402d4442d97c76525569e57971353061 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 8 Jul 2024 16:49:48 -0700 Subject: [PATCH 010/115] fix syntax --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9da4afe73..8ef91e613 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,7 +91,7 @@ jobs: KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db pkcs12_identity_base64=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/base64_pkcs12" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") pkcs12_identity_pw=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/pw_pkcs12" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") - provision_base64 = $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/provision_base64" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") + provision_base64=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/provision_base64" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") # import certificate and provisioning profile from secrets echo -n "$pkcs12_identity_base64" | base64 --decode -o $CERTIFICATE_PATH echo -n "$provision_base64" | base64 --decode -o $PP_PATH From 82d6ac78bbd0d315b5106d5e029f5cefc654f8f2 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 9 Jul 2024 10:08:19 -0700 Subject: [PATCH 011/115] update provisoning file --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ef91e613..70924d1c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,7 +79,7 @@ jobs: python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" chmod a+x builder ./builder build -p ${{ env.PACKAGE_NAME }} - - name: configure AWS credentials (PubSub) + - name: configure AWS credentials uses: aws-actions/configure-aws-credentials@v2 with: role-to-assume: ${{ env.CI_TEST_SECRET_MANAGER_ROLE }} @@ -103,9 +103,9 @@ jobs: security import $CERTIFICATE_PATH -P "$pkcs12_identity_pw" -A -t cert -f pkcs12 -k $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 - - name: Buil test apple + mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles + cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles + - name: Buil Test App run: | xcode-select --print-path pwd From 7feedb47b5e0bc6cd210a596b14a7ed61f554d3c Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 9 Jul 2024 15:46:59 -0700 Subject: [PATCH 012/115] test appium device farm --- .github/workflows/ci.yml | 53 +++++++ .../DeviceFarmScript/mqtt_test_script.py | 47 ++++++ .../DeviceFarmScript/requirements.txt | 7 + .../MqttClient/DeviceFarmScript/run_ios_ci.py | 138 ++++++++++++++++++ .../DeviceFarmScript/test_spec.yaml | 30 ++++ 5 files changed, 275 insertions(+) create mode 100644 Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_test_script.py create mode 100644 Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt create mode 100644 Test/IntegrationTests/MqttClient/DeviceFarmScript/run_ios_ci.py create mode 100644 Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70924d1c4..37c68f1aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,6 +118,59 @@ jobs: -configuration Release \ -destination generic/platform=iOS \ clean archive -allowProvisioningUpdates + - name: Export ipa + run: | + cd aws-crt-swift/Test/IntegrationTests/MqttClient + EXPORT_OPTS_PATH=ExportOptions.plist + xcodebuild -exportArchive -archivePath $RUNNER_TEMP/MqttClient.xcarchive -exportOptionsPlist $EXPORT_OPTS_PATH -exportPath output + cd output + ls + - name: Setup Device Farm test file and environment + env: + SCRIPT_PATH: ./DeviceFarmScript + # Device Farm Instructions: https://docs.aws.amazon.com/devicefarm/latest/developerguide/test-types-appium.html + run: | + cd aws-crt-swift/Test/IntegrationTests/MqttClient + pwd + pip install virtualenv + virtualenv --help + virtualenv workspace + cd workspace + source bin/activate + pip install -r $SCRIPT_PATH/requirements.txt + # Create a test bundle folder for upload + mkdir tests + cp $SCRIPT_PATH/mqtt_test_script.py tests/ + find tests/ + py.test --collect-only tests/ + cd tests/ + find . -name '__pycache__' -type d -exec rm -r {} + + find . -name '*.pyc' -exec rm -f {} + + find . -name '*.pyo' -exec rm -f {} + + find . -name '*~' -exec rm -f {} + + cd .. + pip freeze > requirements.txt + zip -r test_bundle.zip tests/ requirements.txt + - name: configure AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + role-to-assume: arn:aws:iam::976188456881:role/CI_DEVICE_FARM_ROLE + aws-region: us-west-2 + - name: Execute device farm test + run: | + cd aws-crt-swift/Test/IntegrationTests/MqttClient + pip install -r ./DeviceFarmScript/requirements.txt + cd devicefarm + ls + ls ./workspace/ + python -u -c ./DeviceFarmScript/run_ios_ci.py \ + --run_id ${{ github.run_id }} \ + --run_attempt ${{ github.run_attempt }} \ + --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f5 -d\" | cut -f1 -d'\') \ + --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSPoolArn" --query "SecretString" | cut -f5 -d\" | cut -f1 -d'\') + --app_file_path ./output/MqttClient.ipa + --test_file_path ./workspace/test_bundle.zip + --test_spec_file_path ./DeviceFarmScript/test_spec.yaml devices: runs-on: ${{ matrix.runner }} diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_test_script.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_test_script.py new file mode 100644 index 000000000..90de492f5 --- /dev/null +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_test_script.py @@ -0,0 +1,47 @@ +""" +Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +SPDX-License-Identifier: Apache-2.0. +""" +import pytest +from time import sleep + +from appium import webdriver +from appium.options.ios import XCUITestOptions +from appium.webdriver.common.appiumby import AppiumBy +from selenium.common.exceptions import NoSuchElementException + +capabilities = dict( + platformName='ios', + automationName='xcuitest', + deviceName='iPhone', + bundleId='aws-common-runtime.MqttClient', + language='en', + locale='US', +) + +appium_server_url = 'http://0.0.0.0:4723/wd/hub' + +class TestApp: + def setup_method(self): + self.driver = webdriver.Remote(appium_server_url, options=XCUITestOptions().load_capabilities(capabilities)) + self.driver.implicitly_wait(10) + + def teardown_method(self): + if self.driver: + self.driver.quit() + + def start_mqtt(self, test_suite): + sleep(3) + self.perform_click_element('Setup Client and Start') + sleep(3) + + def perform_click_element(self, element_id): + try: + element = self.driver.find_element(by=AppiumBy.ID, value=element_id) + element.click() + sleep(2) + except NoSuchElementException: + pytest.skip(f"Element with ID '{element_id}' not found. Skipped the test") + +if __name__ == '__main__': + TestApp.start_mqtt() diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt new file mode 100644 index 000000000..098b705d5 --- /dev/null +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -0,0 +1,7 @@ +Appium-Python-Client~=3.1.1 +pytest~=7.4.3 +boto3~=1.34.11 +requests~=2.32.3 +PyYAML~=6.0.1 +pytest-html~=4.1.1 +selenium~=4.17.2 \ No newline at end of file diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/run_ios_ci.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/run_ios_ci.py new file mode 100644 index 000000000..b97610c90 --- /dev/null +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/run_ios_ci.py @@ -0,0 +1,138 @@ +import argparse +import sys +import os +import time +import datetime + +import requests # - for uploading files +import boto3 + +parser = argparse.ArgumentParser(description="Utility script to upload and run Android Device tests on AWS Device Farm for CI") +parser.add_argument('--run_id', required=True, help="A unique number for each workflow run within a repository") +parser.add_argument('--run_attempt', required=True, help="A unique number for each attempt of a particular workflow run in a repository") +parser.add_argument('--project_arn', required=True, help="Arn for the Device Farm Project the apk will be tested on") +parser.add_argument('--device_pool_arn', required=True, help="Arn for device pool of the Device Farm Project the apk will be tested on") +parser.add_argument('--test_spec_file_path', required=True, help="Path to the test spec file for Device Farm test") +parser.add_argument('--test_file_path', required=True, help="Path to the zip files that contains test scripts to upload to device farm") +parser.add_argument('--app_file_path', required=True, help="Path to the executable .app file") + +def upload_file(client, projectArn, unique_prefix, filepath, _type): + filename = os.path.basename(filepath) + print('Upload file name: ' + unique_prefix + "_" + filename) + response = client.create_upload(projectArn=projectArn, + name=unique_prefix+"_"+filename, + type=_type + ) + # Get the upload ARN, which we'll return later. + upload_arn = response['upload']['arn'] + # We're going to extract the URL of the upload and use Requests to upload it + upload_url = response['upload']['url'] + with open(filepath, 'rb') as file_stream: + print(f"Uploading {filepath} to Device Farm as {response['upload']['name']}... ", end='') + put_req = requests.put(upload_url, data=file_stream) + print('File upload status code: ' + str(put_req.status_code) + ' reason: ' + put_req.reason) + if not put_req.ok: + raise Exception("Couldn't upload, requests said we're not ok. Requests says: " + put_req.reason) + started = datetime.datetime.now() + device_farm_upload_status = client.get_upload(arn=upload_arn) + while device_farm_upload_status['upload']['status'] != 'SUCCEEDED': + print(f"Upload of {filename} in state {response['upload']['status']} after " + str( + datetime.datetime.now() - started)) + if device_farm_upload_status['upload']['status'] == 'FAILED': + print('Upload failed to process') + sys.exit(-1) + time.sleep(1) + device_farm_upload_status = client.get_upload(arn=upload_arn) + + return upload_arn + + +def main(): + args = parser.parse_args() + run_id = args.run_id + run_attempt = args.run_attempt + project_arn = args.project_arn + device_pool_arn = args.device_pool_arn + test_spec_file_path = args.test_spec_file_path + test_file_path = args.test_file_path + app_file_path = args.app_file_path + + region = os.getenv('AWS_DEVICE_FARM_REGION') + + print("Beginning Android Device Farm Setup \n") + + # Create Boto3 client for Device Farm + try: + client = boto3.client('devicefarm', region_name=region) + except Exception: + print("Error - could not make Boto3 client. Credentials likely could not be sourced") + sys.exit(-1) + print("Boto3 client established") + + # Upload the crt library shell app to Device Farm + unique_prefix = 'CI-' + run_id + '-' + run_attempt + device_farm_app_upload_arn = upload_file(client, project_arn, unique_prefix, app_file_path, 'IOS_APP') + device_farm_test_upload_arn = upload_file(client, project_arn, unique_prefix, test_file_path, 'APPIUM_PYTHON_TEST_PACKAGE') + device_farm_test_spec_upload_arn = upload_file(client, project_arn, unique_prefix, test_spec_file_path, 'APPIUM_PYTHON_TEST_PACKAGE') + + print('scheduling run') + schedule_run_response = client.schedule_run( + projectArn=project_arn, + appArn=device_farm_app_upload_arn, + devicePoolArn=device_pool_arn, + name=unique_prefix, + test={ + "type": "APPIUM_PYTHON", + "testSpecArn": device_farm_test_spec_upload_arn, + "testPackageArn": device_farm_test_upload_arn + }, + executionConfiguration={ + 'jobTimeoutMinutes': 30 + } + ) + + device_farm_run_arn = schedule_run_response['run']['arn'] + + run_start_time = schedule_run_response['run']['started'] + run_start_date_time = run_start_time.strftime("%m/%d/%Y, %H:%M:%S") + print('run scheduled at ' + run_start_date_time) + + get_run_response = client.get_run(arn=device_farm_run_arn) + while get_run_response['run']['result'] == 'PENDING': + time.sleep(10) + get_run_response = client.get_run(arn=device_farm_run_arn) + + run_end_time = datetime.datetime.now() + run_end_date_time = run_end_time.strftime("%m/%d/%Y, %H:%M:%S") + print('Run ended at ' + run_end_date_time + ' with result: ' + get_run_response['run']['result']) + + is_success = True + if get_run_response['run']['result'] != 'PASSED': + print('run has failed with result ' + get_run_response['run']['result']) + is_success = False + + # If Clean up is not executed due to the job being cancelled in CI, the uploaded files will not be deleted + # from the Device Farm project and must be deleted manually. + + # Clean up + print('Deleting app file from Device Farm project') + client.delete_upload( + arn=device_farm_app_upload_arn + ) + print('Deleting test package from Device Farm project') + client.delete_upload( + arn=device_farm_test_upload_arn + ) + print('Deleting test spec file from Device Farm project') + client.delete_upload( + arn=device_farm_test_spec_upload_arn + ) + + if is_success == False: + print('Exiting with fail') + sys.exit(-1) + + print('Exiting with success') + +if __name__ == "__main__": + main() diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yaml b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yaml new file mode 100644 index 000000000..4e179ef98 --- /dev/null +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yaml @@ -0,0 +1,30 @@ +version: 0.1 + +# Phases are collection of commands that get executed on Device Farm. +phases: + # The install phase includes commands that install dependencies that your tests use. + # Default dependencies for testing frameworks supported on Device Farm are already installed. + install: + commands: + # To install a newer version of Appium such as version 2.1.2. Appium used to run iOS running script + - export APPIUM_VERSION=2.1.2 + - avm $APPIUM_VERSION + + # The pre-test phase includes commands that setup your test environment. + pre_test: + commands: + + # The test phase includes commands that run your test suite execution. + test: + commands: + + # The post test phase includes are commands that are run after your tests are executed. + post_test: + commands: + +# The artifacts phase lets you specify the location where your tests logs, device logs will be stored. +# And also let you specify the location of your test logs and artifacts which you want to be collected by Device Farm. +# These logs and artifacts will be available through ListArtifacts API in Device Farm. +artifacts: + # By default, Device Farm will collect your artifacts from following directories + - $DEVICEFARM_LOG_DIR From 24aff2e58eb027e33730330297424e24e1a48a3d Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 9 Jul 2024 16:29:31 -0700 Subject: [PATCH 013/115] update export option --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 37c68f1aa..637514850 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,9 +120,10 @@ jobs: clean archive -allowProvisioningUpdates - name: Export ipa run: | + exportFileData=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/iOSApp/exportOption" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") + echo -n "$exportFileData" | base64 --decode -o ExportOptions.plist cd aws-crt-swift/Test/IntegrationTests/MqttClient - EXPORT_OPTS_PATH=ExportOptions.plist - xcodebuild -exportArchive -archivePath $RUNNER_TEMP/MqttClient.xcarchive -exportOptionsPlist $EXPORT_OPTS_PATH -exportPath output + xcodebuild -exportArchive -archivePath $RUNNER_TEMP/MqttClient.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath output cd output ls - name: Setup Device Farm test file and environment From ccade28444bd2bc8d9b393135b15eb8b4aee7aad Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 9 Jul 2024 16:35:42 -0700 Subject: [PATCH 014/115] fix file path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 637514850..77692b3c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -120,9 +120,9 @@ jobs: clean archive -allowProvisioningUpdates - name: Export ipa run: | + cd aws-crt-swift/Test/IntegrationTests/MqttClient exportFileData=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/iOSApp/exportOption" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") echo -n "$exportFileData" | base64 --decode -o ExportOptions.plist - cd aws-crt-swift/Test/IntegrationTests/MqttClient xcodebuild -exportArchive -archivePath $RUNNER_TEMP/MqttClient.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath output cd output ls From b280d6acae8b50cacc82eae1b721388c0a05cd04 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 09:23:33 -0700 Subject: [PATCH 015/115] update script path --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77692b3c4..a75479b9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,8 +127,6 @@ jobs: cd output ls - name: Setup Device Farm test file and environment - env: - SCRIPT_PATH: ./DeviceFarmScript # Device Farm Instructions: https://docs.aws.amazon.com/devicefarm/latest/developerguide/test-types-appium.html run: | cd aws-crt-swift/Test/IntegrationTests/MqttClient @@ -138,10 +136,10 @@ jobs: virtualenv workspace cd workspace source bin/activate - pip install -r $SCRIPT_PATH/requirements.txt + pip install -r ../DeviceFarmScript/requirements.txt # Create a test bundle folder for upload mkdir tests - cp $SCRIPT_PATH/mqtt_test_script.py tests/ + cp ../DeviceFarmScript/mqtt_test_script.py tests/ find tests/ py.test --collect-only tests/ cd tests/ From 910abd6cf2c8cc038ece3205941056ce10892ae1 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 09:37:04 -0700 Subject: [PATCH 016/115] add test suite --- .../MqttClient/DeviceFarmScript/mqtt_test_script.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_test_script.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_test_script.py index 90de492f5..644003a07 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_test_script.py +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_test_script.py @@ -30,6 +30,11 @@ def teardown_method(self): if self.driver: self.driver.quit() + @pytest.mark.parametrize("test_suite", [ + "test suite 1", + "test suite 2" + ]) + def start_mqtt(self, test_suite): sleep(3) self.perform_click_element('Setup Client and Start') From 3e02cf8f18e1a2c133035fa5557028267909f81c Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 09:49:49 -0700 Subject: [PATCH 017/115] rename python test file --- .../DeviceFarmScript/{mqtt_test_script.py => mqtt_ios_test.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Test/IntegrationTests/MqttClient/DeviceFarmScript/{mqtt_test_script.py => mqtt_ios_test.py} (100%) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_test_script.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py similarity index 100% rename from Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_test_script.py rename to Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py From 01bba1979409161dde71fcbf65c35ddb5e7c5e57 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 09:56:28 -0700 Subject: [PATCH 018/115] rename python test file --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a75479b9d..e0c327c02 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -139,7 +139,7 @@ jobs: pip install -r ../DeviceFarmScript/requirements.txt # Create a test bundle folder for upload mkdir tests - cp ../DeviceFarmScript/mqtt_test_script.py tests/ + cp ../DeviceFarmScript/mqtt_ios_test.py tests/ find tests/ py.test --collect-only tests/ cd tests/ From 2ba917fc0ce20aae7007dcca9a67aa2910a4d710 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 10:09:02 -0700 Subject: [PATCH 019/115] renmae test script --- .github/workflows/ci.yml | 2 +- .../DeviceFarmScript/{mqtt_ios_test.py => iOSMqttApp_test.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Test/IntegrationTests/MqttClient/DeviceFarmScript/{mqtt_ios_test.py => iOSMqttApp_test.py} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0c327c02..a162db3e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -139,7 +139,7 @@ jobs: pip install -r ../DeviceFarmScript/requirements.txt # Create a test bundle folder for upload mkdir tests - cp ../DeviceFarmScript/mqtt_ios_test.py tests/ + cp ../DeviceFarmScript/iOSMqttApp_test.py tests/ find tests/ py.test --collect-only tests/ cd tests/ diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/iOSMqttApp_test.py similarity index 100% rename from Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py rename to Test/IntegrationTests/MqttClient/DeviceFarmScript/iOSMqttApp_test.py From e108c9a917a8251bab5dbbc6c45544b9f8487f42 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 10:56:23 -0700 Subject: [PATCH 020/115] rename tests --- .github/workflows/ci.yml | 2 +- .../{iOSMqttApp_test.py => mqtt_ios_test.py} | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename Test/IntegrationTests/MqttClient/DeviceFarmScript/{iOSMqttApp_test.py => mqtt_ios_test.py} (94%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a162db3e6..e0c327c02 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -139,7 +139,7 @@ jobs: pip install -r ../DeviceFarmScript/requirements.txt # Create a test bundle folder for upload mkdir tests - cp ../DeviceFarmScript/iOSMqttApp_test.py tests/ + cp ../DeviceFarmScript/mqtt_ios_test.py tests/ find tests/ py.test --collect-only tests/ cd tests/ diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/iOSMqttApp_test.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py similarity index 94% rename from Test/IntegrationTests/MqttClient/DeviceFarmScript/iOSMqttApp_test.py rename to Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py index 644003a07..f540068ac 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/iOSMqttApp_test.py +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py @@ -21,7 +21,7 @@ appium_server_url = 'http://0.0.0.0:4723/wd/hub' -class TestApp: +class TestMqttIOS: def setup_method(self): self.driver = webdriver.Remote(appium_server_url, options=XCUITestOptions().load_capabilities(capabilities)) self.driver.implicitly_wait(10) @@ -35,7 +35,7 @@ def teardown_method(self): "test suite 2" ]) - def start_mqtt(self, test_suite): + def test_mqtt(self, test_suite): sleep(3) self.perform_click_element('Setup Client and Start') sleep(3) @@ -49,4 +49,4 @@ def perform_click_element(self, element_id): pytest.skip(f"Element with ID '{element_id}' not found. Skipped the test") if __name__ == '__main__': - TestApp.start_mqtt() + TestMqttIOS.test_mqtt() From f68eb32f3c9a216ab2cefa5aba5eddca837de8cd Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 11:04:43 -0700 Subject: [PATCH 021/115] clean up path --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0c327c02..060e543b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -159,10 +159,10 @@ jobs: run: | cd aws-crt-swift/Test/IntegrationTests/MqttClient pip install -r ./DeviceFarmScript/requirements.txt - cd devicefarm ls ls ./workspace/ - python -u -c ./DeviceFarmScript/run_ios_ci.py \ + cd workspace + python -u -c ../DeviceFarmScript/run_ios_ci.py \ --run_id ${{ github.run_id }} \ --run_attempt ${{ github.run_attempt }} \ --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f5 -d\" | cut -f1 -d'\') \ From 5e8ab6feb69f59fcf3db97ae690bfc95ff2277f2 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 13:07:12 -0700 Subject: [PATCH 022/115] fix python script --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 060e543b7..b1fbe93e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -162,7 +162,7 @@ jobs: ls ls ./workspace/ cd workspace - python -u -c ../DeviceFarmScript/run_ios_ci.py \ + python ../DeviceFarmScript/run_ios_ci.py \ --run_id ${{ github.run_id }} \ --run_attempt ${{ github.run_attempt }} \ --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f5 -d\" | cut -f1 -d'\') \ From 9936abb190092a0e25cee8df6aff5dbefdc50895 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 13:34:45 -0700 Subject: [PATCH 023/115] update secrets lingt --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1fbe93e7..044c766b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -165,8 +165,8 @@ jobs: python ../DeviceFarmScript/run_ios_ci.py \ --run_id ${{ github.run_id }} \ --run_attempt ${{ github.run_attempt }} \ - --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f5 -d\" | cut -f1 -d'\') \ - --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSPoolArn" --query "SecretString" | cut -f5 -d\" | cut -f1 -d'\') + --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" ) \ + --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSPoolArn" --query "SecretString" ) --app_file_path ./output/MqttClient.ipa --test_file_path ./workspace/test_bundle.zip --test_spec_file_path ./DeviceFarmScript/test_spec.yaml From eb3e590024dcd0032b81263bf0ab465a0a6540ea Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 13:41:05 -0700 Subject: [PATCH 024/115] fix run command --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 044c766b0..bcb3e5a6d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,9 +166,9 @@ jobs: --run_id ${{ github.run_id }} \ --run_attempt ${{ github.run_attempt }} \ --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" ) \ - --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSPoolArn" --query "SecretString" ) - --app_file_path ./output/MqttClient.ipa - --test_file_path ./workspace/test_bundle.zip + --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSPoolArn" --query "SecretString" ) \ + --app_file_path ./output/MqttClient.ipa \ + --test_file_path ./workspace/test_bundle.zip \ --test_spec_file_path ./DeviceFarmScript/test_spec.yaml devices: From b8ef28002719cb990d4f417073414e3decb4f039 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 14:12:01 -0700 Subject: [PATCH 025/115] clean up arn string --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcb3e5a6d..d77615f87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -165,8 +165,8 @@ jobs: python ../DeviceFarmScript/run_ios_ci.py \ --run_id ${{ github.run_id }} \ --run_attempt ${{ github.run_attempt }} \ - --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" ) \ - --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSPoolArn" --query "SecretString" ) \ + --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f2 -d\") \ + --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSPoolArn" --query "SecretString" | cut -f2 -d\") \ --app_file_path ./output/MqttClient.ipa \ --test_file_path ./workspace/test_bundle.zip \ --test_spec_file_path ./DeviceFarmScript/test_spec.yaml From 8956c553f89c1fac7e6c64f2e492f8edc223c84b Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 14:23:26 -0700 Subject: [PATCH 026/115] fix working path --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d77615f87..12291be7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -160,9 +160,7 @@ jobs: cd aws-crt-swift/Test/IntegrationTests/MqttClient pip install -r ./DeviceFarmScript/requirements.txt ls - ls ./workspace/ - cd workspace - python ../DeviceFarmScript/run_ios_ci.py \ + python ./DeviceFarmScript/run_ios_ci.py \ --run_id ${{ github.run_id }} \ --run_attempt ${{ github.run_attempt }} \ --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f2 -d\") \ From 3b3be0878c1064670b3f4079ccb2e0c066eaf88d Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 14:39:01 -0700 Subject: [PATCH 027/115] test with new test spec with appium --- .github/workflows/ci.yml | 2 +- .../DeviceFarmScript/test_spec.yaml | 30 --------- .../MqttClient/DeviceFarmScript/test_spec.yml | 65 +++++++++++++++++++ 3 files changed, 66 insertions(+), 31 deletions(-) delete mode 100644 Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yaml create mode 100644 Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12291be7e..a105ee710 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -167,7 +167,7 @@ jobs: --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSPoolArn" --query "SecretString" | cut -f2 -d\") \ --app_file_path ./output/MqttClient.ipa \ --test_file_path ./workspace/test_bundle.zip \ - --test_spec_file_path ./DeviceFarmScript/test_spec.yaml + --test_spec_file_path ./DeviceFarmScript/test_spec.yml devices: runs-on: ${{ matrix.runner }} diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yaml b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yaml deleted file mode 100644 index 4e179ef98..000000000 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yaml +++ /dev/null @@ -1,30 +0,0 @@ -version: 0.1 - -# Phases are collection of commands that get executed on Device Farm. -phases: - # The install phase includes commands that install dependencies that your tests use. - # Default dependencies for testing frameworks supported on Device Farm are already installed. - install: - commands: - # To install a newer version of Appium such as version 2.1.2. Appium used to run iOS running script - - export APPIUM_VERSION=2.1.2 - - avm $APPIUM_VERSION - - # The pre-test phase includes commands that setup your test environment. - pre_test: - commands: - - # The test phase includes commands that run your test suite execution. - test: - commands: - - # The post test phase includes are commands that are run after your tests are executed. - post_test: - commands: - -# The artifacts phase lets you specify the location where your tests logs, device logs will be stored. -# And also let you specify the location of your test logs and artifacts which you want to be collected by Device Farm. -# These logs and artifacts will be available through ListArtifacts API in Device Farm. -artifacts: - # By default, Device Farm will collect your artifacts from following directories - - $DEVICEFARM_LOG_DIR diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml new file mode 100644 index 000000000..82ac86f69 --- /dev/null +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml @@ -0,0 +1,65 @@ +version: 0.1 + +# Phases are collection of commands that get executed on Device Farm. +phases: + # The install phase includes commands that install dependencies that your tests use. + # Default dependencies for testing frameworks supported on Device Farm are already installed. + install: + commands: + # To install a newer version of Appium such as version 2.1.2. Appium used to run iOS running script + - export APPIUM_VERSION=2.1.2 + - avm $APPIUM_VERSION + + # The pre-test phase includes commands that setup your test environment. + pre_test: + commands: + # Appium downloads Chromedriver using a feature that is considered insecure for multitenant + # environments. This is not a problem for Device Farm because each test host is allocated + # exclusively for one customer, then terminated entirely. For more information, please see + # https://github.com/appium/appium/blob/master/packages/appium/docs/en/guides/security.md + + # We recommend starting the Appium server process in the background using the command below. + # The Appium server log will be written to the $DEVICEFARM_LOG_DIR directory. + # The environment variables passed as capabilities to the server will be automatically assigned + # during your test run based on your test's specific device. + # For more information about which environment variables are set and how they're set, please see + # https://docs.aws.amazon.com/devicefarm/latest/developerguide/custom-test-environment-variables.html + - |- + appium --base-path=$APPIUM_BASE_PATH --log-timestamp \ + --log-no-colors --relaxed-security --default-capabilities \ + "{\"appium:deviceName\": \"$DEVICEFARM_DEVICE_NAME\", \ + \"platformName\": \"$DEVICEFARM_DEVICE_PLATFORM_NAME\", \ + \"appium:app\": \"$DEVICEFARM_APP_PATH\", \ + \"appium:udid\":\"$DEVICEFARM_DEVICE_UDID\", \ + \"appium:platformVersion\": \"$DEVICEFARM_DEVICE_OS_VERSION\", \ + \"appium:chromedriverExecutableDir\": \"$DEVICEFARM_CHROMEDRIVER_EXECUTABLE_DIR\", \ + \"appium:automationName\": \"UiAutomator2\"}" \ + >> $DEVICEFARM_LOG_DIR/appium.log 2>&1 & + + # This code will wait until the Appium server starts. + - |- + appium_initialization_time=0; + until curl --silent --fail "http://0.0.0.0:4723${APPIUM_BASE_PATH}/status"; do + if [[ $appium_initialization_time -gt 30 ]]; then + echo "Appium did not start within 30 seconds. Exiting..."; + exit 1; + fi; + appium_initialization_time=$((appium_initialization_time + 1)); + echo "Waiting for Appium to start on port 4723..."; + sleep 1; + done; + + # The test phase includes commands that run your test suite execution. + test: + commands: + + # The post test phase includes are commands that are run after your tests are executed. + post_test: + commands: + +# The artifacts phase lets you specify the location where your tests logs, device logs will be stored. +# And also let you specify the location of your test logs and artifacts which you want to be collected by Device Farm. +# These logs and artifacts will be available through ListArtifacts API in Device Farm. +artifacts: + # By default, Device Farm will collect your artifacts from following directories + - $DEVICEFARM_LOG_DIR From 29d7fc681637376020f911e631bf1932564ed07b Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 14:46:47 -0700 Subject: [PATCH 028/115] update test spec to use df default --- .../MqttClient/DeviceFarmScript/test_spec.yml | 128 +++++++++++++++--- 1 file changed, 107 insertions(+), 21 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml index 82ac86f69..065bb276f 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml @@ -1,22 +1,97 @@ version: 0.1 +# These default test spec file commands assume that the test package has been built in accordance +# with the instructions in AWS Device Farm's documentation for testing with Appium Python: +# https://docs.aws.amazon.com/devicefarm/latest/developerguide/test-types-appium.html -# Phases are collection of commands that get executed on Device Farm. +# Note that iOS 17 and above devices use a test host with an Apple silicon CPU, whereas +# iOS 16 and below devices use a test host with an Intel CPU. + +# Phases represent collections of commands that are executed during your test run on the test host. phases: - # The install phase includes commands that install dependencies that your tests use. - # Default dependencies for testing frameworks supported on Device Farm are already installed. + + # The install phase contains commands for installing dependencies to run your tests. + # For your convenience, certain dependencies are preinstalled on the test host. + + # For iOS tests, you can use the Python tools pyenv and pip to setup your environment, as well as + # Node.JS tools nvm, npm, and avm to setup your Appium server. By default, Python versions 3.10 + # and 3.7 are available on the test host. install: commands: - # To install a newer version of Appium such as version 2.1.2. Appium used to run iOS running script - - export APPIUM_VERSION=2.1.2 - - avm $APPIUM_VERSION + # The Appium server is written using Node.js. In order to run your desired version of Appium, + # you first need to set up a Node.js environment that is compatible with your version of Appium. + # For iOS, use "nvm use" to switch between the two preinstalled NodeJS versions 14 and 16, and + # use "nvm install" to download a new version of your choice. + - export NVM_DIR=$HOME/.nvm + - . $NVM_DIR/nvm.sh + - nvm use 16 + - node --version + + # For iOS, Appium versions 1.22.2 and 2.2.1 are preinstalled and selectable through avm. + # For all other versions, please use npm to install them. For example: + # - npm install -g appium@2.1.3; + # Note that, for iOS devices, Appium 2 is only supported on iOS version 14 and above using + # NodeJS version 16 and above. + - avm 2.2.1 + - appium --version - # The pre-test phase includes commands that setup your test environment. + # For Appium version 2, for iOS tests, the XCUITest driver is preinstalled using version 5.7.0 + # If you want to install a different version of the driver, you can use the Appium extension CLI + # to uninstall the existing XCUITest driver and install your desired version: + # - |- + # if [ $DEVICEFARM_DEVICE_PLATFORM_NAME = "iOS" ]; + # then + # appium driver uninstall xcuitest; + # appium driver install xcuitest@5.8.1; + # fi; + + # We recommend setting the Appium server's base path explicitly for accepting commands. + - export APPIUM_BASE_PATH=/wd/hub + + # Use pyenv and virtualenv to setup a Python environment on iOS. + - export PYTHON_VERSION=3 + - |- + if printf "%s\n" "14.5" "$DEVICEFARM_DEVICE_OS_VERSION" |sort -VC; + then + # For iOS device versions 14.5 and above, you can switch between Python versions 3.10 + # and 3.7 using pyenv as shown below. + export PATH="$HOME/.pyenv/bin:$PATH"; + eval "$(pyenv init -)"; + pyenv global 3.10; + else + # At this time, only Python version 3.7 is supported for iOS device versions 14.4 and + # below. This is supported using virtualenv as shown below. + . $DEVICEFARM_TEST_PACKAGE_PATH/bin/activate; + fi; + - python --version + + # Install the Python dependencies using pip. + - cd $DEVICEFARM_TEST_PACKAGE_PATH + - python -m pip install -r requirements.txt + + # The pre-test phase contains commands for setting up your test environment. pre_test: commands: - # Appium downloads Chromedriver using a feature that is considered insecure for multitenant - # environments. This is not a problem for Device Farm because each test host is allocated - # exclusively for one customer, then terminated entirely. For more information, please see - # https://github.com/appium/appium/blob/master/packages/appium/docs/en/guides/security.md + # Device farm provides different pre-built versions of WebDriverAgent, an essential Appium + # dependency for iOS devices, and each version is suggested for different versions of Appium: + # DEVICEFARM_WDA_DERIVED_DATA_PATH_V8: this version is suggested for Appium 2 + # DEVICEFARM_WDA_DERIVED_DATA_PATH_V7: this version is suggested for Appium 1 + - |- + if [ $(appium --version | cut -d "." -f1) -ge 2 ]; + then + DEVICEFARM_WDA_DERIVED_DATA_PATH=$DEVICEFARM_WDA_DERIVED_DATA_PATH_V8; + else + DEVICEFARM_WDA_DERIVED_DATA_PATH=$DEVICEFARM_WDA_DERIVED_DATA_PATH_V7; + fi; + + # Additionally, for iOS versions 16 and below, the device unique identifier (UDID) needs + # to be slightly modified for Appium tests. + - |- + if [ $(echo $DEVICEFARM_DEVICE_OS_VERSION | cut -d "." -f 1) -le 16 ]; + then + DEVICEFARM_DEVICE_UDID_FOR_APPIUM=$(echo $DEVICEFARM_DEVICE_UDID | tr -d "-"); + else + DEVICEFARM_DEVICE_UDID_FOR_APPIUM=$DEVICEFARM_DEVICE_UDID; + fi; # We recommend starting the Appium server process in the background using the command below. # The Appium server log will be written to the $DEVICEFARM_LOG_DIR directory. @@ -30,11 +105,12 @@ phases: "{\"appium:deviceName\": \"$DEVICEFARM_DEVICE_NAME\", \ \"platformName\": \"$DEVICEFARM_DEVICE_PLATFORM_NAME\", \ \"appium:app\": \"$DEVICEFARM_APP_PATH\", \ - \"appium:udid\":\"$DEVICEFARM_DEVICE_UDID\", \ + \"appium:udid\":\"$DEVICEFARM_DEVICE_UDID_FOR_APPIUM\", \ \"appium:platformVersion\": \"$DEVICEFARM_DEVICE_OS_VERSION\", \ - \"appium:chromedriverExecutableDir\": \"$DEVICEFARM_CHROMEDRIVER_EXECUTABLE_DIR\", \ - \"appium:automationName\": \"UiAutomator2\"}" \ - >> $DEVICEFARM_LOG_DIR/appium.log 2>&1 & + \"appium:derivedDataPath\": \"$DEVICEFARM_WDA_DERIVED_DATA_PATH\", \ + \"appium:usePrebuiltWDA\": true, \ + \"appium:automationName\": \"XCUITest\"}" \ + >> $DEVICEFARM_LOG_DIR/appium.log 2>&1 & # This code will wait until the Appium server starts. - |- @@ -49,17 +125,27 @@ phases: sleep 1; done; - # The test phase includes commands that run your test suite execution. + # The test phase contains commands for running your tests. test: commands: + # Your test package is downloaded and unpackaged into the $DEVICEFARM_TEST_PACKAGE_PATH directory. + - cd $DEVICEFARM_TEST_PACKAGE_PATH + - echo "Starting the Appium Python test" + + # The following command runs your Appium Python test. + # Please refer to "https://docs.pytest.org/en/latest/usage.html" for more options + # on running pytest from the command line. + - python -m pytest tests/ --junit-xml $DEVICEFARM_LOG_DIR/junitreport.xml - # The post test phase includes are commands that are run after your tests are executed. + # The post-test phase contains commands that are run after your tests have completed. + # If you need to run any commands to generating logs and reports on how your test performed, + # we recommend adding them to this section. post_test: commands: -# The artifacts phase lets you specify the location where your tests logs, device logs will be stored. -# And also let you specify the location of your test logs and artifacts which you want to be collected by Device Farm. -# These logs and artifacts will be available through ListArtifacts API in Device Farm. +# Artifacts are a list of paths on the filesystem where you can store test output and reports. +# All files in these paths will be collected by Device Farm. +# These files will be available through the ListArtifacts API as your "Customer Artifacts". artifacts: - # By default, Device Farm will collect your artifacts from following directories + # By default, Device Farm will collect your artifacts from the $DEVICEFARM_LOG_DIR directory. - $DEVICEFARM_LOG_DIR From e2c66f1d7d0d3c52a1370839064bb07d7338b786 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 10 Jul 2024 15:30:31 -0700 Subject: [PATCH 029/115] fix spec upload type --- .../IntegrationTests/MqttClient/DeviceFarmScript/run_ios_ci.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/run_ios_ci.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/run_ios_ci.py index b97610c90..faba1932b 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/run_ios_ci.py +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/run_ios_ci.py @@ -39,6 +39,7 @@ def upload_file(client, projectArn, unique_prefix, filepath, _type): print(f"Upload of {filename} in state {response['upload']['status']} after " + str( datetime.datetime.now() - started)) if device_farm_upload_status['upload']['status'] == 'FAILED': + print('File upload status code: ' + str(device_farm_upload_status.status_code) + ' reason: ' + device_farm_upload_status.reason) print('Upload failed to process') sys.exit(-1) time.sleep(1) @@ -73,7 +74,7 @@ def main(): unique_prefix = 'CI-' + run_id + '-' + run_attempt device_farm_app_upload_arn = upload_file(client, project_arn, unique_prefix, app_file_path, 'IOS_APP') device_farm_test_upload_arn = upload_file(client, project_arn, unique_prefix, test_file_path, 'APPIUM_PYTHON_TEST_PACKAGE') - device_farm_test_spec_upload_arn = upload_file(client, project_arn, unique_prefix, test_spec_file_path, 'APPIUM_PYTHON_TEST_PACKAGE') + device_farm_test_spec_upload_arn = upload_file(client, project_arn, unique_prefix, test_spec_file_path, 'INSTRUMENTATION_TEST_SPEC') print('scheduling run') schedule_run_response = client.schedule_run( From 3acbe94b63236e6a7b854dd92eb469d14dfda671 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 15 Jul 2024 09:28:32 -0700 Subject: [PATCH 030/115] ios13 quick test --- .github/workflows/ci.yml | 2 +- .../MqttClient/MqttClient/ContentView.swift | 3 +- .../MqttClient/MqttClient/MqttClientApp.swift | 34 ++++++++++++++++++- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a105ee710..8cfb5de9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -164,7 +164,7 @@ jobs: --run_id ${{ github.run_id }} \ --run_attempt ${{ github.run_attempt }} \ --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f2 -d\") \ - --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSPoolArn" --query "SecretString" | cut -f2 -d\") \ + --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOS13PoolArn" --query "SecretString" | cut -f2 -d\") \ --app_file_path ./output/MqttClient.ipa \ --test_file_path ./workspace/test_bundle.zip \ --test_spec_file_path ./DeviceFarmScript/test_spec.yml diff --git a/Test/IntegrationTests/MqttClient/MqttClient/ContentView.swift b/Test/IntegrationTests/MqttClient/MqttClient/ContentView.swift index 9cd65ba0f..ef81a3ebe 100644 --- a/Test/IntegrationTests/MqttClient/MqttClient/ContentView.swift +++ b/Test/IntegrationTests/MqttClient/MqttClient/ContentView.swift @@ -11,9 +11,8 @@ let TEST_PORT: UInt32 = 1883 var mqttTestContext = MqttTestContext() var client: Mqtt5Client? -@available(iOS 14.0, *) struct ContentView: View { - @StateObject var testContext = mqttTestContext + @ObservedObject var testContext = mqttTestContext var body: some View { VStack { Button("Setup Client and Start") { diff --git a/Test/IntegrationTests/MqttClient/MqttClient/MqttClientApp.swift b/Test/IntegrationTests/MqttClient/MqttClient/MqttClientApp.swift index bf1d2b900..0855dfb66 100644 --- a/Test/IntegrationTests/MqttClient/MqttClient/MqttClientApp.swift +++ b/Test/IntegrationTests/MqttClient/MqttClient/MqttClientApp.swift @@ -3,8 +3,22 @@ import SwiftUI -@available(iOS 14.0, *) + @main +struct MqttClientAppWrapper { + static func main() { + if #available(iOS 14.0, *) { + MqttClientApp.main() + } + else { + // The main actor only exists for 14.0 and above. + UIApplicationMain(CommandLine.argc, CommandLine.unsafeArgv, nil, NSStringFromClass(SceneDelegate.self)) + } + } +} + + +@available(iOS 14.0, *) struct MqttClientApp: App { var body: some Scene { WindowGroup { @@ -12,3 +26,21 @@ struct MqttClientApp: App { } } } + + +class SceneDelegate: UIResponder, UIWindowSceneDelegate { + + var window: UIWindow? + + func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { + let contentView = ContentView() + + // Use a UIHostingController as window root view controller. + if let windowScene = scene as? UIWindowScene { + let window = UIWindow(windowScene: windowScene) + window.rootViewController = UIHostingController(rootView: contentView) + self.window = window + window.makeKeyAndVisible() + } + } +} From 2a20b95ce26408cbccc6d1f7eec5315a3b20df81 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 15 Jul 2024 10:55:51 -0700 Subject: [PATCH 031/115] test ios13 --- .../MqttClient.xcodeproj/project.pbxproj | 4 +-- .../MqttClient/MqttClient/Info.plist | 27 +++++++++++++++++++ .../MqttClient/MqttClient/MqttClientApp.swift | 2 +- 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 Test/IntegrationTests/MqttClient/MqttClient/Info.plist diff --git a/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj b/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj index fab7b891d..c710a66c1 100644 --- a/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj +++ b/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj @@ -277,7 +277,7 @@ DEVELOPMENT_TEAM = K33Z8NL3RV; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_FILE = MqttClient/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; @@ -307,7 +307,7 @@ DEVELOPMENT_TEAM = K33Z8NL3RV; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_FILE = MqttClient/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; diff --git a/Test/IntegrationTests/MqttClient/MqttClient/Info.plist b/Test/IntegrationTests/MqttClient/MqttClient/Info.plist new file mode 100644 index 000000000..193aac8b7 --- /dev/null +++ b/Test/IntegrationTests/MqttClient/MqttClient/Info.plist @@ -0,0 +1,27 @@ + + + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneClassName + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + + + + + + + diff --git a/Test/IntegrationTests/MqttClient/MqttClient/MqttClientApp.swift b/Test/IntegrationTests/MqttClient/MqttClient/MqttClientApp.swift index 0855dfb66..a462edb73 100644 --- a/Test/IntegrationTests/MqttClient/MqttClient/MqttClientApp.swift +++ b/Test/IntegrationTests/MqttClient/MqttClient/MqttClientApp.swift @@ -27,7 +27,7 @@ struct MqttClientApp: App { } } - +@available(iOS 13.0, *) class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? From 42fe763a3dc61279aa55b9f6b2d84612d5040b2a Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 15 Jul 2024 12:55:15 -0700 Subject: [PATCH 032/115] ios13 environment only allow boto31.33.12 --- .../MqttClient/DeviceFarmScript/requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index 098b705d5..172363161 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -1,7 +1,7 @@ Appium-Python-Client~=3.1.1 pytest~=7.4.3 -boto3~=1.34.11 +boto3~=1.33.12 requests~=2.32.3 PyYAML~=6.0.1 pytest-html~=4.1.1 -selenium~=4.17.2 \ No newline at end of file +selenium~=4.17.2 From 8019207a39ea9fd9bdb4473693fc6cf7a15c7ff5 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 15 Jul 2024 13:55:17 -0700 Subject: [PATCH 033/115] use boto3 1.28.1 for python3.7 --- .../MqttClient/DeviceFarmScript/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index 172363161..4e71f1d15 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -1,6 +1,6 @@ Appium-Python-Client~=3.1.1 pytest~=7.4.3 -boto3~=1.33.12 +boto3~=1.28.1 requests~=2.32.3 PyYAML~=6.0.1 pytest-html~=4.1.1 From 9effcd60e5a37c4543d5a5b401447a4bf4beca1e Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 15 Jul 2024 14:37:01 -0700 Subject: [PATCH 034/115] update dependency for python3.y --- .../MqttClient/DeviceFarmScript/requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index 4e71f1d15..215c01636 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -1,7 +1,7 @@ Appium-Python-Client~=3.1.1 pytest~=7.4.3 boto3~=1.28.1 -requests~=2.32.3 +requests~=2.24.0 PyYAML~=6.0.1 -pytest-html~=4.1.1 -selenium~=4.17.2 +pytest-html~=4.0.0 +selenium~=4.11.2 From 4cfb606ee62b431858f1641d82e323334e5f4be4 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 15 Jul 2024 14:51:26 -0700 Subject: [PATCH 035/115] update dependency --- .../MqttClient/DeviceFarmScript/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index 215c01636..310cafc12 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -4,4 +4,4 @@ boto3~=1.28.1 requests~=2.24.0 PyYAML~=6.0.1 pytest-html~=4.0.0 -selenium~=4.11.2 +selenium~=4.12.0 From 6953305b1bb0f733324b277733a82c461fa3706b Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 15 Jul 2024 14:56:08 -0700 Subject: [PATCH 036/115] cleanup info.plist for ios14+ --- Test/IntegrationTests/MqttClient/MqttClient/Info.plist | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/MqttClient/Info.plist b/Test/IntegrationTests/MqttClient/MqttClient/Info.plist index 193aac8b7..0b0521734 100644 --- a/Test/IntegrationTests/MqttClient/MqttClient/Info.plist +++ b/Test/IntegrationTests/MqttClient/MqttClient/Info.plist @@ -11,14 +11,10 @@ UIWindowSceneSessionRoleApplication - UISceneClassName - UISceneConfigurationName Default Configuration UISceneDelegateClassName $(PRODUCT_MODULE_NAME).SceneDelegate - UISceneStoryboardFile - From 210e3b821750e0159dc5b0df02ae4834a0c19463 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 15 Jul 2024 15:06:06 -0700 Subject: [PATCH 037/115] try using python3.7 --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8cfb5de9d..f7589d9d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,6 +126,10 @@ jobs: xcodebuild -exportArchive -archivePath $RUNNER_TEMP/MqttClient.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath output cd output ls + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.7' - name: Setup Device Farm test file and environment # Device Farm Instructions: https://docs.aws.amazon.com/devicefarm/latest/developerguide/test-types-appium.html run: | From 85487c2e5b304ec7f481a813a0c0195b044523ea Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 15 Jul 2024 15:07:33 -0700 Subject: [PATCH 038/115] generate new dependency --- .github/workflows/ci.yml | 2 +- .../MqttClient/DeviceFarmScript/requirements.txt | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f7589d9d0..7b1d34f3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,7 +140,7 @@ jobs: virtualenv workspace cd workspace source bin/activate - pip install -r ../DeviceFarmScript/requirements.txt + # pip install -r ../DeviceFarmScript/requirements.txt # Create a test bundle folder for upload mkdir tests cp ../DeviceFarmScript/mqtt_ios_test.py tests/ diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index 310cafc12..e69de29bb 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -1,7 +0,0 @@ -Appium-Python-Client~=3.1.1 -pytest~=7.4.3 -boto3~=1.28.1 -requests~=2.24.0 -PyYAML~=6.0.1 -pytest-html~=4.0.0 -selenium~=4.12.0 From dbb50fb48cfd225550448a24ba3aad489a68bd95 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 15 Jul 2024 15:37:20 -0700 Subject: [PATCH 039/115] update requirement for python3.7 --- .github/workflows/ci.yml | 6 +----- .../MqttClient/DeviceFarmScript/requirements.txt | 7 +++++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b1d34f3d..8cfb5de9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,10 +126,6 @@ jobs: xcodebuild -exportArchive -archivePath $RUNNER_TEMP/MqttClient.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath output cd output ls - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.7' - name: Setup Device Farm test file and environment # Device Farm Instructions: https://docs.aws.amazon.com/devicefarm/latest/developerguide/test-types-appium.html run: | @@ -140,7 +136,7 @@ jobs: virtualenv workspace cd workspace source bin/activate - # pip install -r ../DeviceFarmScript/requirements.txt + pip install -r ../DeviceFarmScript/requirements.txt # Create a test bundle folder for upload mkdir tests cp ../DeviceFarmScript/mqtt_ios_test.py tests/ diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index e69de29bb..94af09273 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -0,0 +1,7 @@ +Appium-Python-Client~=2.9.0 +pytest~=7.4.3 +boto3~=1.28.1 +requests~=2.24.0 +PyYAML~=6.0.1 +pytest-html~=4.0.0 +selenium~=4.11.2 From 1c3f8909e299f181bf848632026879e2f327cb7b Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 15 Jul 2024 15:56:53 -0700 Subject: [PATCH 040/115] test for requests 2.31.0 --- .../MqttClient/DeviceFarmScript/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index 94af09273..7c48d4df6 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -1,7 +1,7 @@ Appium-Python-Client~=2.9.0 pytest~=7.4.3 boto3~=1.28.1 -requests~=2.24.0 +requests~=2.31.0 PyYAML~=6.0.1 pytest-html~=4.0.0 selenium~=4.11.2 From 5522c6e6cb128e0f60658af4eecc2893f1419e19 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Mon, 15 Jul 2024 16:41:34 -0700 Subject: [PATCH 041/115] update dependency --- .../MqttClient/DeviceFarmScript/requirements.txt | 5 +++-- .../MqttClient/DeviceFarmScript/test_spec.yml | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index 7c48d4df6..e32a129d4 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -1,7 +1,8 @@ Appium-Python-Client~=2.9.0 pytest~=7.4.3 boto3~=1.28.1 -requests~=2.31.0 +urllib3==1.26.0 +requests~=2.28.0 PyYAML~=6.0.1 -pytest-html~=4.0.0 +pytest-html~=3.2.0 selenium~=4.11.2 diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml index 065bb276f..dcdca0d49 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml @@ -66,7 +66,8 @@ phases: # Install the Python dependencies using pip. - cd $DEVICEFARM_TEST_PACKAGE_PATH - - python -m pip install -r requirements.txt + # Use 2020 resolver for python3.7 + - python -m pip install -r requirements.txt --use-feature=2020-resolver # The pre-test phase contains commands for setting up your test environment. pre_test: From 24f85d1d6b9d4ad4b86542256582ca7130e04bd4 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 16 Jul 2024 09:13:25 -0700 Subject: [PATCH 042/115] missing lib six --- .../MqttClient/DeviceFarmScript/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index e32a129d4..5d5e6d270 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -6,3 +6,4 @@ requests~=2.28.0 PyYAML~=6.0.1 pytest-html~=3.2.0 selenium~=4.11.2 +six From d6888b862c839ec7e6126e9ed925b2bc5f860aef Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 16 Jul 2024 09:39:49 -0700 Subject: [PATCH 043/115] missing lib six --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8cfb5de9d..17ee16ffc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -158,6 +158,7 @@ jobs: - name: Execute device farm test run: | cd aws-crt-swift/Test/IntegrationTests/MqttClient + pip uninstall -r ./DeviceFarmScript/requirements.txt pip install -r ./DeviceFarmScript/requirements.txt ls python ./DeviceFarmScript/run_ios_ci.py \ From d6106593d93eb0cb8d521e351460dd0ccbe38edf Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 16 Jul 2024 10:17:58 -0700 Subject: [PATCH 044/115] update lib3 version --- .github/workflows/ci.yml | 1 - .../MqttClient/DeviceFarmScript/requirements.txt | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17ee16ffc..8cfb5de9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -158,7 +158,6 @@ jobs: - name: Execute device farm test run: | cd aws-crt-swift/Test/IntegrationTests/MqttClient - pip uninstall -r ./DeviceFarmScript/requirements.txt pip install -r ./DeviceFarmScript/requirements.txt ls python ./DeviceFarmScript/run_ios_ci.py \ diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index 5d5e6d270..a1f458586 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -1,9 +1,8 @@ Appium-Python-Client~=2.9.0 pytest~=7.4.3 boto3~=1.28.1 -urllib3==1.26.0 +urllib3==1.26.18 requests~=2.28.0 PyYAML~=6.0.1 pytest-html~=3.2.0 selenium~=4.11.2 -six From 12d6dac6c1b60ce69744484892aac1b568b4b26c Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 16 Jul 2024 10:48:44 -0700 Subject: [PATCH 045/115] add package --- .../MqttClient/DeviceFarmScript/requirements.txt | 3 ++- .../MqttClient/DeviceFarmScript/test_spec.yml | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index a1f458586..83b44dca5 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -1,3 +1,4 @@ +packaging==24.0 Appium-Python-Client~=2.9.0 pytest~=7.4.3 boto3~=1.28.1 @@ -5,4 +6,4 @@ urllib3==1.26.18 requests~=2.28.0 PyYAML~=6.0.1 pytest-html~=3.2.0 -selenium~=4.11.2 +selenium~=4.10.0 diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml index dcdca0d49..b2f9ea5ed 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml @@ -66,8 +66,8 @@ phases: # Install the Python dependencies using pip. - cd $DEVICEFARM_TEST_PACKAGE_PATH - # Use 2020 resolver for python3.7 - - python -m pip install -r requirements.txt --use-feature=2020-resolver + # Use 2020 resolver for python3.7, where Python3.7 is running on iOS13 + - python -m pip install -r requirements.txt # The pre-test phase contains commands for setting up your test environment. pre_test: From 96e84ae4ba444ad51a42fa188cf925aa2e4d9c28 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 16 Jul 2024 11:31:35 -0700 Subject: [PATCH 046/115] do pip upgrade --- .../MqttClient/DeviceFarmScript/requirements.txt | 1 + Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index 83b44dca5..91fd12020 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -7,3 +7,4 @@ requests~=2.28.0 PyYAML~=6.0.1 pytest-html~=3.2.0 selenium~=4.10.0 +pluggy==1.2.0 diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml index b2f9ea5ed..62c0a394f 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml @@ -66,6 +66,7 @@ phases: # Install the Python dependencies using pip. - cd $DEVICEFARM_TEST_PACKAGE_PATH + - pip install --upgrade pip # Use 2020 resolver for python3.7, where Python3.7 is running on iOS13 - python -m pip install -r requirements.txt From c98d115afe0ef32cf31e5a42e421569b996ec1b6 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 16 Jul 2024 13:24:49 -0700 Subject: [PATCH 047/115] setup veresion for pytest --- .github/workflows/ci.yml | 2 +- .../MqttClient/DeviceFarmScript/requirements.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8cfb5de9d..16c49e6a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,7 +87,7 @@ jobs: - name: Install the Apple certificate and provisioning profile run: | CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 - PP_PATH=$RUNNER_TEMP/shoppingmacdev.mobileprovision + PP_PATH=$RUNNER_TEMP/mqttclient.mobileprovision KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db pkcs12_identity_base64=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/base64_pkcs12" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") pkcs12_identity_pw=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/pw_pkcs12" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index 91fd12020..4515d4709 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -5,6 +5,7 @@ boto3~=1.28.1 urllib3==1.26.18 requests~=2.28.0 PyYAML~=6.0.1 +pytest-metadata~=3.0.0 pytest-html~=3.2.0 selenium~=4.10.0 pluggy==1.2.0 From 99c69893d99daea80d76342e641f9275354890ae Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 16 Jul 2024 13:40:56 -0700 Subject: [PATCH 048/115] setup trio version --- .../MqttClient/DeviceFarmScript/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index 4515d4709..575cce561 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -9,3 +9,4 @@ pytest-metadata~=3.0.0 pytest-html~=3.2.0 selenium~=4.10.0 pluggy==1.2.0 +trio~=0.22.2 From a0bdbd669eaca6483d23c151dfd0d6cd7062e546 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 16 Jul 2024 14:14:04 -0700 Subject: [PATCH 049/115] update capabilities for webdriver --- .../MqttClient/DeviceFarmScript/mqtt_ios_test.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py index f540068ac..7704a4524 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py @@ -23,7 +23,8 @@ class TestMqttIOS: def setup_method(self): - self.driver = webdriver.Remote(appium_server_url, options=XCUITestOptions().load_capabilities(capabilities)) + # self.driver = webdriver.Remote(appium_server_url, options=XCUITestOptions().load_capabilities(capabilities)) + self.driver = webdriver.Remote(appium_server_url, capabilities=capabilities) self.driver.implicitly_wait(10) def teardown_method(self): @@ -38,7 +39,10 @@ def teardown_method(self): def test_mqtt(self, test_suite): sleep(3) self.perform_click_element('Setup Client and Start') - sleep(3) + # Sleep to make sure the connection is finished + sleep(10) + # put the application in background + self.driver.runAppInBackground(-1) def perform_click_element(self, element_id): try: From f0a1fd690998a49ab90733309727cfe0e676dab5 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 16 Jul 2024 14:38:30 -0700 Subject: [PATCH 050/115] use capabilties for webdriver --- .../MqttClient/DeviceFarmScript/mqtt_ios_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py index 7704a4524..ea37af75e 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py @@ -24,7 +24,7 @@ class TestMqttIOS: def setup_method(self): # self.driver = webdriver.Remote(appium_server_url, options=XCUITestOptions().load_capabilities(capabilities)) - self.driver = webdriver.Remote(appium_server_url, capabilities=capabilities) + self.driver = webdriver.Remote(appium_server_url, capabilities) self.driver.implicitly_wait(10) def teardown_method(self): From 9e5cc0f91e04eb447876dda817a223e047e0d5ee Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 16 Jul 2024 15:15:16 -0700 Subject: [PATCH 051/115] use a selenium 4.9 --- .../MqttClient/DeviceFarmScript/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index 575cce561..aa8fa5268 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -7,6 +7,6 @@ requests~=2.28.0 PyYAML~=6.0.1 pytest-metadata~=3.0.0 pytest-html~=3.2.0 -selenium~=4.10.0 +selenium~=4.9.0 pluggy==1.2.0 trio~=0.22.2 From 55b996b0913bb6c97665937d77e3ee4fe15cbf60 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Tue, 16 Jul 2024 15:34:10 -0700 Subject: [PATCH 052/115] use options for mqtt test --- .../MqttClient/DeviceFarmScript/mqtt_ios_test.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py index ea37af75e..e7342906f 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py @@ -23,8 +23,7 @@ class TestMqttIOS: def setup_method(self): - # self.driver = webdriver.Remote(appium_server_url, options=XCUITestOptions().load_capabilities(capabilities)) - self.driver = webdriver.Remote(appium_server_url, capabilities) + self.driver = webdriver.Remote(appium_server_url, options=XCUITestOptions().load_capabilities(capabilities)) self.driver.implicitly_wait(10) def teardown_method(self): From e183b4b8f498afd0c66296ef6b17affc7d59ee68 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 17 Jul 2024 09:04:05 -0700 Subject: [PATCH 053/115] test on high avaliable pool --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16c49e6a3..4f6ebdf5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -164,7 +164,7 @@ jobs: --run_id ${{ github.run_id }} \ --run_attempt ${{ github.run_attempt }} \ --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f2 -d\") \ - --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOS13PoolArn" --query "SecretString" | cut -f2 -d\") \ + --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSPoolArn" --query "SecretString" | cut -f2 -d\") \ --app_file_path ./output/MqttClient.ipa \ --test_file_path ./workspace/test_bundle.zip \ --test_spec_file_path ./DeviceFarmScript/test_spec.yml From 7897a5d2749cdaf6067cff8ee1805d629d9a6bc8 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 17 Jul 2024 09:20:58 -0700 Subject: [PATCH 054/115] revert dependency for latest update --- .../MqttClient/DeviceFarmScript/mqtt_ios_test.py | 5 ++--- .../MqttClient/DeviceFarmScript/requirements.txt | 15 +++++---------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py index e7342906f..b9596e09f 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py @@ -30,9 +30,8 @@ def teardown_method(self): if self.driver: self.driver.quit() - @pytest.mark.parametrize("test_suite", [ - "test suite 1", - "test suite 2" + @pytest.mark.parametrize("Eventloop Test", [ + "Background Process" ]) def test_mqtt(self, test_suite): diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index aa8fa5268..00eeadc69 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -1,12 +1,7 @@ -packaging==24.0 -Appium-Python-Client~=2.9.0 +Appium-Python-Client~=3.1.1 pytest~=7.4.3 -boto3~=1.28.1 -urllib3==1.26.18 -requests~=2.28.0 +boto3~=1.34.11 +requests~=2.32.3 PyYAML~=6.0.1 -pytest-metadata~=3.0.0 -pytest-html~=3.2.0 -selenium~=4.9.0 -pluggy==1.2.0 -trio~=0.22.2 +pytest-html~=4.1.1 +selenium~=4.17.2 From 10dd2c3aa22551e7928d0a9c9bc2b99e0b65c9da Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 17 Jul 2024 09:45:49 -0700 Subject: [PATCH 055/115] clean up test args --- .../MqttClient/DeviceFarmScript/mqtt_ios_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py index b9596e09f..233a772e6 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py @@ -30,11 +30,11 @@ def teardown_method(self): if self.driver: self.driver.quit() - @pytest.mark.parametrize("Eventloop Test", [ + @pytest.mark.parametrize("event_loop_tests", [ "Background Process" ]) - def test_mqtt(self, test_suite): + def test_mqtt(self, event_loop_tests): sleep(3) self.perform_click_element('Setup Client and Start') # Sleep to make sure the connection is finished From 49d7a9f289a0974242558b1e59ff6c2291eef78a Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 17 Jul 2024 10:25:28 -0700 Subject: [PATCH 056/115] update background app --- .../MqttClient/DeviceFarmScript/mqtt_ios_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py index 233a772e6..89f0f2728 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py @@ -40,7 +40,7 @@ def test_mqtt(self, event_loop_tests): # Sleep to make sure the connection is finished sleep(10) # put the application in background - self.driver.runAppInBackground(-1) + self.driver.background_app(-1) def perform_click_element(self, element_id): try: From 6834932bda95b6d7e142a2741b6921a2e7e3ec35 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 17 Jul 2024 10:42:49 -0700 Subject: [PATCH 057/115] quick test for ios13 --- .github/workflows/ci.yml | 2 +- .../MqttClient/DeviceFarmScript/requirements.txt | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f6ebdf5d..16c49e6a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -164,7 +164,7 @@ jobs: --run_id ${{ github.run_id }} \ --run_attempt ${{ github.run_attempt }} \ --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f2 -d\") \ - --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSPoolArn" --query "SecretString" | cut -f2 -d\") \ + --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOS13PoolArn" --query "SecretString" | cut -f2 -d\") \ --app_file_path ./output/MqttClient.ipa \ --test_file_path ./workspace/test_bundle.zip \ --test_spec_file_path ./DeviceFarmScript/test_spec.yml diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index 00eeadc69..aa8fa5268 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -1,7 +1,12 @@ -Appium-Python-Client~=3.1.1 +packaging==24.0 +Appium-Python-Client~=2.9.0 pytest~=7.4.3 -boto3~=1.34.11 -requests~=2.32.3 +boto3~=1.28.1 +urllib3==1.26.18 +requests~=2.28.0 PyYAML~=6.0.1 -pytest-html~=4.1.1 -selenium~=4.17.2 +pytest-metadata~=3.0.0 +pytest-html~=3.2.0 +selenium~=4.9.0 +pluggy==1.2.0 +trio~=0.22.2 From 50ca46f3de596a41369cf94fc02e84d3fe2c427f Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 17 Jul 2024 11:09:27 -0700 Subject: [PATCH 058/115] run on both 14+ and 13 --- .github/workflows/ci.yml | 15 ++++++++++++++- .../MqttClient/DeviceFarmScript/mqtt_ios_test.py | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16c49e6a3..24b42b6bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -155,7 +155,20 @@ jobs: with: role-to-assume: arn:aws:iam::976188456881:role/CI_DEVICE_FARM_ROLE aws-region: us-west-2 - - name: Execute device farm test + - name: Execute device farm iOS Highly Available + run: | + cd aws-crt-swift/Test/IntegrationTests/MqttClient + pip install -r ./DeviceFarmScript/requirements.txt + ls + python ./DeviceFarmScript/run_ios_ci.py \ + --run_id ${{ github.run_id }} \ + --run_attempt ${{ github.run_attempt }} \ + --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f2 -d\") \ + --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSPoolArn" --query "SecretString" | cut -f2 -d\") \ + --app_file_path ./output/MqttClient.ipa \ + --test_file_path ./workspace/test_bundle.zip \ + --test_spec_file_path ./DeviceFarmScript/test_spec.yml + - name: Execute device farm iOS 13 run: | cd aws-crt-swift/Test/IntegrationTests/MqttClient pip install -r ./DeviceFarmScript/requirements.txt diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py index 89f0f2728..9a811d1c6 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/mqtt_ios_test.py @@ -41,6 +41,8 @@ def test_mqtt(self, event_loop_tests): sleep(10) # put the application in background self.driver.background_app(-1) + # Wait to see if the connection is interrupted + sleep(15) def perform_click_element(self, element_id): try: From 0e2c7bcf6e73c94fc1731aa3a9948484cd063d7d Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 17 Jul 2024 13:09:32 -0700 Subject: [PATCH 059/115] install xcuitest --- .../MqttClient/DeviceFarmScript/requirements.txt | 2 +- Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index aa8fa5268..e44fc67c6 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -1,5 +1,5 @@ packaging==24.0 -Appium-Python-Client~=2.9.0 +Appium-Python-Client~=2.11.0 pytest~=7.4.3 boto3~=1.28.1 urllib3==1.26.18 diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml index 62c0a394f..ba74f1493 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml @@ -33,6 +33,8 @@ phases: # NodeJS version 16 and above. - avm 2.2.1 - appium --version + # make sure install xcuitest + - appium driver install xcuitest # For Appium version 2, for iOS tests, the XCUITest driver is preinstalled using version 5.7.0 # If you want to install a different version of the driver, you can use the Appium extension CLI From ae87a5630f5d0fe86c2601f0b5916668b0c6e626 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 17 Jul 2024 15:54:00 -0700 Subject: [PATCH 060/115] update to use crt account --- .github/workflows/ci.yml | 26 +++++-------------- .../MqttClient.xcodeproj/project.pbxproj | 4 +-- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24b42b6bf..ab35acc0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,29 +72,20 @@ jobs: NSUnbufferedIO: YES BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.MOBILEPROVISION_BASE64 }} KEYCHAIN_PASSWORD: ${{ secrets.TEST_KEYCHAIN_PASSWORD }} - CI_TEST_SECRET_MANAGER_ROLE: arn:aws:iam::976188456881:role/CI_TEST_PROVIDER_ASSUME_ROLE steps: - name: Build ${{ env.PACKAGE_NAME }} + consumers run: | python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" chmod a+x builder ./builder build -p ${{ env.PACKAGE_NAME }} - - name: configure AWS credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: ${{ env.CI_TEST_SECRET_MANAGER_ROLE }} - aws-region: us-east-1 - name: Install the Apple certificate and provisioning profile run: | CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 PP_PATH=$RUNNER_TEMP/mqttclient.mobileprovision KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db - pkcs12_identity_base64=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/base64_pkcs12" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") - pkcs12_identity_pw=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/pw_pkcs12" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") - provision_base64=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/test/provision_base64" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") - # import certificate and provisioning profile from secrets - echo -n "$pkcs12_identity_base64" | base64 --decode -o $CERTIFICATE_PATH - echo -n "$provision_base64" | base64 --decode -o $PP_PATH + aws s3 cp s3://aws-crt-test-stuff/iosTestApp.p12 $CERTIFICATE_PATH + aws s3 cp s3://aws-crt-test-stuff/aws-common-runtime.MqttClient.mobileprovision $PP_PATH + pkcs12_identity_pw=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/ios/pkcs12_identity_password" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") # create temporary keychain security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH security set-keychain-settings -lut 21600 $KEYCHAIN_PATH @@ -150,11 +141,6 @@ jobs: cd .. pip freeze > requirements.txt zip -r test_bundle.zip tests/ requirements.txt - - name: configure AWS credentials - uses: aws-actions/configure-aws-credentials@v2 - with: - role-to-assume: arn:aws:iam::976188456881:role/CI_DEVICE_FARM_ROLE - aws-region: us-west-2 - name: Execute device farm iOS Highly Available run: | cd aws-crt-swift/Test/IntegrationTests/MqttClient @@ -163,8 +149,8 @@ jobs: python ./DeviceFarmScript/run_ios_ci.py \ --run_id ${{ github.run_id }} \ --run_attempt ${{ github.run_attempt }} \ - --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f2 -d\") \ - --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSPoolArn" --query "SecretString" | cut -f2 -d\") \ + --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSProjectArn" --query "SecretString" | cut -f2 -d\") \ + --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSHighlyAvailablePool" --query "SecretString" | cut -f2 -d\") \ --app_file_path ./output/MqttClient.ipa \ --test_file_path ./workspace/test_bundle.zip \ --test_spec_file_path ./DeviceFarmScript/test_spec.yml @@ -176,7 +162,7 @@ jobs: python ./DeviceFarmScript/run_ios_ci.py \ --run_id ${{ github.run_id }} \ --run_attempt ${{ github.run_attempt }} \ - --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/ProjectArn" --query "SecretString" | cut -f2 -d\") \ + --project_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOSProjectArn" --query "SecretString" | cut -f2 -d\") \ --device_pool_arn $(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/DeviceFarm/iOS13PoolArn" --query "SecretString" | cut -f2 -d\") \ --app_file_path ./output/MqttClient.ipa \ --test_file_path ./workspace/test_bundle.zip \ diff --git a/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj b/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj index c710a66c1..0b80d7900 100644 --- a/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj +++ b/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj @@ -274,7 +274,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = K33Z8NL3RV; + DEVELOPMENT_TEAM = 3V5W3HV3D4; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = MqttClient/Info.plist; @@ -304,7 +304,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = K33Z8NL3RV; + DEVELOPMENT_TEAM = 3V5W3HV3D4; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = MqttClient/Info.plist; From dbc00019e17429d0a3b00348f620ee6282412d03 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 17 Jul 2024 17:26:52 -0700 Subject: [PATCH 061/115] update export option file --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab35acc0f..b9f09ca26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -112,8 +112,7 @@ jobs: - name: Export ipa run: | cd aws-crt-swift/Test/IntegrationTests/MqttClient - exportFileData=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "ci/iOSApp/exportOption" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") - echo -n "$exportFileData" | base64 --decode -o ExportOptions.plist + aws s3 cp s3://aws-crt-test-stuff/ExportOptions.plist ExportOptions.plist xcodebuild -exportArchive -archivePath $RUNNER_TEMP/MqttClient.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath output cd output ls From 092be19d7c699114fde64871850a20dd4c86c3fb Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Wed, 17 Jul 2024 18:33:17 -0700 Subject: [PATCH 062/115] device farm in us-west-2; use appium 1 --- .github/workflows/ci.yml | 4 ++++ .../MqttClient/DeviceFarmScript/run_ios_ci.py | 4 ++-- .../MqttClient/DeviceFarmScript/test_spec.yml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9f09ca26..4f4f29283 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,6 +140,10 @@ jobs: cd .. pip freeze > requirements.txt zip -r test_bundle.zip tests/ requirements.txt + - name: configure AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-region: us-west-2 # Device Farm only available on us-west-2 - name: Execute device farm iOS Highly Available run: | cd aws-crt-swift/Test/IntegrationTests/MqttClient diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/run_ios_ci.py b/Test/IntegrationTests/MqttClient/DeviceFarmScript/run_ios_ci.py index faba1932b..1dba16225 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/run_ios_ci.py +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/run_ios_ci.py @@ -7,7 +7,7 @@ import requests # - for uploading files import boto3 -parser = argparse.ArgumentParser(description="Utility script to upload and run Android Device tests on AWS Device Farm for CI") +parser = argparse.ArgumentParser(description="Utility script to upload and run Device tests on AWS Device Farm for CI") parser.add_argument('--run_id', required=True, help="A unique number for each workflow run within a repository") parser.add_argument('--run_attempt', required=True, help="A unique number for each attempt of a particular workflow run in a repository") parser.add_argument('--project_arn', required=True, help="Arn for the Device Farm Project the apk will be tested on") @@ -60,7 +60,7 @@ def main(): region = os.getenv('AWS_DEVICE_FARM_REGION') - print("Beginning Android Device Farm Setup \n") + print("Beginning Device Farm Setup \n") # Create Boto3 client for Device Farm try: diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml index ba74f1493..c72b2d7be 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml @@ -31,7 +31,7 @@ phases: # - npm install -g appium@2.1.3; # Note that, for iOS devices, Appium 2 is only supported on iOS version 14 and above using # NodeJS version 16 and above. - - avm 2.2.1 + - avm 1.22.2 - appium --version # make sure install xcuitest - appium driver install xcuitest From bd3ae01e487c43ddba6fafb97d8e95237fcebaf3 Mon Sep 17 00:00:00 2001 From: Zhihui Xia Date: Thu, 18 Jul 2024 09:23:50 -0700 Subject: [PATCH 063/115] set different appium version --- .../MqttClient/DeviceFarmScript/test_spec.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml index c72b2d7be..a754332b6 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/test_spec.yml @@ -31,7 +31,13 @@ phases: # - npm install -g appium@2.1.3; # Note that, for iOS devices, Appium 2 is only supported on iOS version 14 and above using # NodeJS version 16 and above. - - avm 1.22.2 + - |- + if printf "%s\n" "14.5" "$DEVICEFARM_DEVICE_OS_VERSION" |sort -VC; + then + avm 2.2.1; + else + avm 1.22.2; + fi; - appium --version # make sure install xcuitest - appium driver install xcuitest From aad4d769a7533061f3ed3542aad74612e7e5ddb5 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Tue, 1 Oct 2024 09:06:23 -0700 Subject: [PATCH 064/115] allow tls --- Package.swift | 1 + Source/AwsCommonRuntimeKit/io/TLSContextOptions.swift | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index 369d7f68b..2197af288 100644 --- a/Package.swift +++ b/Package.swift @@ -130,6 +130,7 @@ awsCIoPlatformExcludes.append("source/darwin") awsCIoPlatformExcludes.append("source/windows") awsCIoPlatformExcludes.append("source/linux") awsCIoPlatformExcludes.append("source/s2n") +cSettingsIO.append(.define("AWS_USE_DISPATCH_QUEUE")) #endif ////////////////////////////////////////////////////////////////////// diff --git a/Source/AwsCommonRuntimeKit/io/TLSContextOptions.swift b/Source/AwsCommonRuntimeKit/io/TLSContextOptions.swift index f5bc55598..048b8a710 100644 --- a/Source/AwsCommonRuntimeKit/io/TLSContextOptions.swift +++ b/Source/AwsCommonRuntimeKit/io/TLSContextOptions.swift @@ -37,7 +37,7 @@ public class TLSContextOptions: CStruct { public static func makeMTLS( certificateData: Data, privateKeyData: Data) throws -> TLSContextOptions { - #if os(tvOS) || os(iOS) || os(watchOS) + #if os(watchOS) throw CommonRunTimeError.crtError(CRTError(code: AWS_ERROR_PLATFORM_NOT_SUPPORTED.rawValue)) #endif return try TLSContextOptions(certificateData: certificateData, privateKeyData: privateKeyData) @@ -55,7 +55,7 @@ public class TLSContextOptions: CStruct { public static func makeMTLS( certificatePath: String, privateKeyPath: String) throws -> TLSContextOptions { - #if os(tvOS) || os(iOS) || os(watchOS) + #if os(watchOS) throw CommonRunTimeError.crtError(CRTError(code: AWS_ERROR_PLATFORM_NOT_SUPPORTED.rawValue)) #endif return try TLSContextOptions(certificatePath: certificatePath, privateKeyPath: privateKeyPath) From f248f538bb07e1a567aa628a557ccf3908e44809 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 2 Oct 2024 10:14:01 -0700 Subject: [PATCH 065/115] add setting of secitem options --- .../io/TLSContextOptions.swift | 16 ++++++++ .../io/TLSSecitemOptions.swift | 37 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 Source/AwsCommonRuntimeKit/io/TLSSecitemOptions.swift diff --git a/Source/AwsCommonRuntimeKit/io/TLSContextOptions.swift b/Source/AwsCommonRuntimeKit/io/TLSContextOptions.swift index 048b8a710..f21f40225 100644 --- a/Source/AwsCommonRuntimeKit/io/TLSContextOptions.swift +++ b/Source/AwsCommonRuntimeKit/io/TLSContextOptions.swift @@ -126,6 +126,22 @@ public class TLSContextOptions: CStruct { public func setMinimumTLSVersion(_ tlsVersion: TLSVersion) { aws_tls_ctx_options_set_minimum_tls_version(rawValue, aws_tls_versions(rawValue: tlsVersion.rawValue)) } + + /// Updates TLSContextOptions to use specified options when importing certificate and key into keychain. + /// + /// NOTE: This only works on Apple devices using Apple keychain via Secitem.. The library is currently only tested on iOS. + /// + /// - Parameters: + /// - certLabel: Human readable label to apply to certificate being imported into keychain. + /// - keyLabel: Human readable label to apply to key being imported into keychain. + /// - Throws: CommonRuntimeError.crtError + public func setSecitemLabels(certLabel: String? = nil, keyLabel: String? = nil) throws { + let secitemOptions = TLSSecitemOptions(certLabel: certLabel, keyLabel: keyLabel) + + if aws_tls_ctx_options_set_secitem_options(rawValue, secitemOptions.rawValue) != AWS_OP_SUCCESS { + throw CommonRunTimeError.crtError(CRTError.makeFromLastError()) + } + } typealias RawType = aws_tls_ctx_options func withCStruct(_ body: (aws_tls_ctx_options) -> Result) -> Result { diff --git a/Source/AwsCommonRuntimeKit/io/TLSSecitemOptions.swift b/Source/AwsCommonRuntimeKit/io/TLSSecitemOptions.swift new file mode 100644 index 000000000..be309a8d9 --- /dev/null +++ b/Source/AwsCommonRuntimeKit/io/TLSSecitemOptions.swift @@ -0,0 +1,37 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0. + +import AwsCIo + +public class TLSSecitemOptions : CStruct { + var rawValue: UnsafeMutablePointer + + public init( + certLabel: String? = nil, + keyLabel: String? = nil) { + + self.rawValue = allocator.allocate(capacity: 1) + + self.rawValue.pointee.cert_label = certLabel?.withByteCursorPointer { certLabelCursorPointer in + aws_string_new_from_cursor( + allocator.rawValue, + certLabelCursorPointer) + } + + self.rawValue.pointee.key_label = keyLabel?.withByteCursorPointer { keyLabelCursorPointer in + aws_string_new_from_cursor( + allocator.rawValue, + keyLabelCursorPointer) + } + } + + typealias RawType = aws_secitem_options + func withCStruct(_ body: (aws_secitem_options) -> Result) -> Result { + return body(rawValue.pointee) + } + + deinit { + aws_tls_secitem_options_clean_up(rawValue) + allocator.release(rawValue) + } +} From 0406905c2aaa4eff073ff4d6509aabfb04eff482 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 2 Oct 2024 11:39:45 -0700 Subject: [PATCH 066/115] aws-c-io nw_secitem branch --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index c345d7727..ced9f88dc 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit c345d77274db83c0c2e30331814093e7c84c45e2 +Subproject commit ced9f88dc13e6bdf305a42d68cca9e02f81c510f From d261d8a336b7e71b7ba415e2b1a9d0a729bc2ae4 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 2 Oct 2024 11:48:22 -0700 Subject: [PATCH 067/115] latest aws-c-io nw_secitem --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index ced9f88dc..bdcbf39e2 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit ced9f88dc13e6bdf305a42d68cca9e02f81c510f +Subproject commit bdcbf39e28d400b3264d0ce32932f343b46c64b4 From 08308e8642611736b6ece49ed3644527806fdfe5 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 2 Oct 2024 11:53:03 -0700 Subject: [PATCH 068/115] update aws-c-io --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index bdcbf39e2..b9e54115b 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit bdcbf39e28d400b3264d0ce32932f343b46c64b4 +Subproject commit b9e54115b38f4b21f98eebcc882b9423cf317e2c From 54ff235eb6ebd410cd2dc863fd5af416097159f0 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 2 Oct 2024 13:21:19 -0700 Subject: [PATCH 069/115] use AWS_USE_SECITEM define --- Package.swift | 1 + aws-common-runtime/aws-c-io | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 5798ac048..400bf1433 100644 --- a/Package.swift +++ b/Package.swift @@ -133,6 +133,7 @@ awsCIoPlatformExcludes.append("source/windows") awsCIoPlatformExcludes.append("source/linux") awsCIoPlatformExcludes.append("source/s2n") cSettingsIO.append(.define("AWS_USE_DISPATCH_QUEUE")) +cSettingsIO.append(.define("AWS_USE_SECITEM")) #endif ////////////////////////////////////////////////////////////////////// diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index b9e54115b..c3a6bd6ca 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit b9e54115b38f4b21f98eebcc882b9423cf317e2c +Subproject commit c3a6bd6cac1a674367a54ea6e402660387cb2d32 From e19519ac0379176dd0a26d07bead6e50d7415c8a Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 2 Oct 2024 13:50:47 -0700 Subject: [PATCH 070/115] add eventloop types to other platforms --- Package.swift | 2 ++ aws-common-runtime/aws-c-io | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 400bf1433..4b132026e 100644 --- a/Package.swift +++ b/Package.swift @@ -124,10 +124,12 @@ awsCIoPlatformExcludes.append("source/posix") awsCIoPlatformExcludes.append("source/linux") awsCIoPlatformExcludes.append("source/s2n") awsCIoPlatformExcludes.append("source/darwin") +cSettingsIO.append(.define("AWS_USE_IO_COMPLETION_PORTS")) #elseif os(Linux) awsCIoPlatformExcludes.append("source/windows") awsCIoPlatformExcludes.append("source/bsd") awsCIoPlatformExcludes.append("source/darwin") +cSettingsIO.append(.define("AWS_USE_EPOLL")) #else // macOS, iOS, watchOS, tvOS awsCIoPlatformExcludes.append("source/windows") awsCIoPlatformExcludes.append("source/linux") diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index c3a6bd6ca..b7e75a97a 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit c3a6bd6cac1a674367a54ea6e402660387cb2d32 +Subproject commit b7e75a97aa2427a29c0ffd1699b8beec6cee944d From b338b5d94a64cd042b74f22e88f092a2d60daa4f Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 2 Oct 2024 14:11:21 -0700 Subject: [PATCH 071/115] lint error and differetiate between macOS and iOS/tvOS --- Package.swift | 3 +++ Source/AwsCommonRuntimeKit/io/TLSSecitemOptions.swift | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 4b132026e..9623bde08 100644 --- a/Package.swift +++ b/Package.swift @@ -134,6 +134,9 @@ cSettingsIO.append(.define("AWS_USE_EPOLL")) awsCIoPlatformExcludes.append("source/windows") awsCIoPlatformExcludes.append("source/linux") awsCIoPlatformExcludes.append("source/s2n") +#if os(macOS) +cSettingsIO.append(.define("AWS_USE_KQUEUE")) +#else // iOS, tvOS cSettingsIO.append(.define("AWS_USE_DISPATCH_QUEUE")) cSettingsIO.append(.define("AWS_USE_SECITEM")) #endif diff --git a/Source/AwsCommonRuntimeKit/io/TLSSecitemOptions.swift b/Source/AwsCommonRuntimeKit/io/TLSSecitemOptions.swift index be309a8d9..c976af1f4 100644 --- a/Source/AwsCommonRuntimeKit/io/TLSSecitemOptions.swift +++ b/Source/AwsCommonRuntimeKit/io/TLSSecitemOptions.swift @@ -3,7 +3,7 @@ import AwsCIo -public class TLSSecitemOptions : CStruct { +public class TLSSecitemOptions: CStruct { var rawValue: UnsafeMutablePointer public init( From 9c2ba7f5f5df7d5acd362a2685f0d732b0c2f35a Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 2 Oct 2024 14:21:20 -0700 Subject: [PATCH 072/115] add missing endif --- Package.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Package.swift b/Package.swift index 9623bde08..a4e2b8577 100644 --- a/Package.swift +++ b/Package.swift @@ -140,6 +140,7 @@ cSettingsIO.append(.define("AWS_USE_KQUEUE")) cSettingsIO.append(.define("AWS_USE_DISPATCH_QUEUE")) cSettingsIO.append(.define("AWS_USE_SECITEM")) #endif +#endif ////////////////////////////////////////////////////////////////////// /// aws-c-checksums From 827c071a3d655195c6a3e028e3022d76f12eefe9 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 2 Oct 2024 14:34:29 -0700 Subject: [PATCH 073/115] try excluding dispatch queue related source files --- Package.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Package.swift b/Package.swift index a4e2b8577..5a4d4b11e 100644 --- a/Package.swift +++ b/Package.swift @@ -136,6 +136,8 @@ awsCIoPlatformExcludes.append("source/linux") awsCIoPlatformExcludes.append("source/s2n") #if os(macOS) cSettingsIO.append(.define("AWS_USE_KQUEUE")) +awsCIoPlatformExcludes.append("source/darwin/dispatch_queue_event_loop.c") +awsCIoPlatformExcludes.append("source/darwin/nw_socket.c") #else // iOS, tvOS cSettingsIO.append(.define("AWS_USE_DISPATCH_QUEUE")) cSettingsIO.append(.define("AWS_USE_SECITEM")) From e0dfcad5685df48aded0acf6a6b5f662bbc63887 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Thu, 3 Oct 2024 10:13:40 -0700 Subject: [PATCH 074/115] CRT changes --- Package.swift | 10 +++------- aws-common-runtime/aws-c-common | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Package.swift b/Package.swift index 5a4d4b11e..58949c3f6 100644 --- a/Package.swift +++ b/Package.swift @@ -134,14 +134,10 @@ cSettingsIO.append(.define("AWS_USE_EPOLL")) awsCIoPlatformExcludes.append("source/windows") awsCIoPlatformExcludes.append("source/linux") awsCIoPlatformExcludes.append("source/s2n") -#if os(macOS) -cSettingsIO.append(.define("AWS_USE_KQUEUE")) -awsCIoPlatformExcludes.append("source/darwin/dispatch_queue_event_loop.c") -awsCIoPlatformExcludes.append("source/darwin/nw_socket.c") -#else // iOS, tvOS -cSettingsIO.append(.define("AWS_USE_DISPATCH_QUEUE")) -cSettingsIO.append(.define("AWS_USE_SECITEM")) #endif + +#if os(iOS) +#error("iOS") #endif ////////////////////////////////////////////////////////////////////// diff --git a/aws-common-runtime/aws-c-common b/aws-common-runtime/aws-c-common index b9959f592..cda4d0ed9 160000 --- a/aws-common-runtime/aws-c-common +++ b/aws-common-runtime/aws-c-common @@ -1 +1 @@ -Subproject commit b9959f5922a4b969beab8f0b99aa0b34bc9ee55c +Subproject commit cda4d0ed9f63e327338120102ab3eea5e721b38b From b507465cd916b93b5c04a1f49f25471eaf6fd0bf Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Thu, 3 Oct 2024 10:15:36 -0700 Subject: [PATCH 075/115] aws-c-io changes --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index b7e75a97a..849d00932 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit b7e75a97aa2427a29c0ffd1699b8beec6cee944d +Subproject commit 849d0093233376a3e2bdca413107d5360d080c61 From a50380c55be949ba1ee2c7cbf5961ab02328b078 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Thu, 3 Oct 2024 10:37:53 -0700 Subject: [PATCH 076/115] update aws-c-io changes --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index 849d00932..99e1ed0a6 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit 849d0093233376a3e2bdca413107d5360d080c61 +Subproject commit 99e1ed0a619209d78ecc366c0756c35699b59f7f From fb1b50176bf46639d3817f75ad6a66748e1993ba Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Thu, 3 Oct 2024 11:34:33 -0700 Subject: [PATCH 077/115] remove test error --- Package.swift | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Package.swift b/Package.swift index 58949c3f6..7f05e53d0 100644 --- a/Package.swift +++ b/Package.swift @@ -136,10 +136,6 @@ awsCIoPlatformExcludes.append("source/linux") awsCIoPlatformExcludes.append("source/s2n") #endif -#if os(iOS) -#error("iOS") -#endif - ////////////////////////////////////////////////////////////////////// /// aws-c-checksums ////////////////////////////////////////////////////////////////////// From 1f3cee0b52971c951026c0ae9e2453af88a484bd Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Thu, 3 Oct 2024 14:43:25 -0700 Subject: [PATCH 078/115] latest submodules --- aws-common-runtime/aws-c-common | 2 +- aws-common-runtime/aws-c-io | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aws-common-runtime/aws-c-common b/aws-common-runtime/aws-c-common index cda4d0ed9..b9959f592 160000 --- a/aws-common-runtime/aws-c-common +++ b/aws-common-runtime/aws-c-common @@ -1 +1 @@ -Subproject commit cda4d0ed9f63e327338120102ab3eea5e721b38b +Subproject commit b9959f5922a4b969beab8f0b99aa0b34bc9ee55c diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index 99e1ed0a6..968edded6 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit 99e1ed0a619209d78ecc366c0756c35699b59f7f +Subproject commit 968edded6d2e2037445d73c0ed7c70c8abb2e33a From 81946d3db3b679ef779c265ca1a60b18d9b2ba6b Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Fri, 4 Oct 2024 10:05:30 -0700 Subject: [PATCH 079/115] update aws-c-io --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index 968edded6..e102c3237 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit 968edded6d2e2037445d73c0ed7c70c8abb2e33a +Subproject commit e102c323717bb7d69e19882e5fe8a3f7b4e11e96 From 78e5ac9f660135a69b475b1ce678caab9df0ab61 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Fri, 4 Oct 2024 11:36:02 -0700 Subject: [PATCH 080/115] use latest aws-c-io --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index e102c3237..cde0b76b3 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit e102c323717bb7d69e19882e5fe8a3f7b4e11e96 +Subproject commit cde0b76b382f34f68b11f2c6a6b824431434e1ef From b9a6ed2da4ce0a5c78e95f255c557ed845f37bf7 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Fri, 4 Oct 2024 13:48:29 -0700 Subject: [PATCH 081/115] add defines in package.Swift --- Package.swift | 4 ++++ aws-common-runtime/aws-c-io | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 7f05e53d0..ea19400bc 100644 --- a/Package.swift +++ b/Package.swift @@ -134,6 +134,10 @@ cSettingsIO.append(.define("AWS_USE_EPOLL")) awsCIoPlatformExcludes.append("source/windows") awsCIoPlatformExcludes.append("source/linux") awsCIoPlatformExcludes.append("source/s2n") +cSettingsIO.append(.define("__APPLE__")) +cSettingsIO.append(.define("AWS_USE_DISPATCH_QUEUE", .when(platforms: [.iOS, .tvOS]))) +cSettingsIO.append(.define("AWS_USE_SECITEM", .when(platforms: [.iOS, .tvOS]))) +cSettingsIO.append(.define("AWS_USE_KQUEUE", .when(platforms: [.macOS]))) #endif ////////////////////////////////////////////////////////////////////// diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index cde0b76b3..3caac5e05 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit cde0b76b382f34f68b11f2c6a6b824431434e1ef +Subproject commit 3caac5e053052d14de2b7700a815b67921538aba From b2b21d16c8faab5ac1715e2496c24afbfece7651 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Mon, 7 Oct 2024 10:09:12 -0700 Subject: [PATCH 082/115] latest aws-c-io --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index 3caac5e05..8d353f153 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit 3caac5e053052d14de2b7700a815b67921538aba +Subproject commit 8d353f153ad1d409f6d99b96f01664d8f905ec87 From e6a95063db741c118b827e26a70607e6a9f0e7bd Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Mon, 7 Oct 2024 10:11:07 -0700 Subject: [PATCH 083/115] add defines to test and secitem options test --- Package.swift | 5 +++++ .../io/TLSContextTests.swift | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Package.swift b/Package.swift index ea19400bc..cdf29a8ce 100644 --- a/Package.swift +++ b/Package.swift @@ -310,6 +310,11 @@ packageTargets.append(contentsOf: [ path: "Test/AwsCommonRuntimeKitTests", resources: [ .process("Resources") + ], + cSettings: [ + .define("AWS_USE_SECITEM", .when(platforms: [.iOS, .tvOS])), + .define("AWS_USE_DISPATCH_QUEUE", .when(platforms: [.iOS, .tvOS])), + .define("AWS_USE_KQUEUE", .when(platforms: [.macOS])) ] ), .executableTarget( diff --git a/Test/AwsCommonRuntimeKitTests/io/TLSContextTests.swift b/Test/AwsCommonRuntimeKitTests/io/TLSContextTests.swift index ccc77a4f1..0dae4ef35 100644 --- a/Test/AwsCommonRuntimeKitTests/io/TLSContextTests.swift +++ b/Test/AwsCommonRuntimeKitTests/io/TLSContextTests.swift @@ -39,4 +39,21 @@ class TLSContextTests: XCBaseTestCase { _ = TLSConnectionOptions(context: context) } #endif + +#if AWS_USE_SECITEM + func testCreateTlsContextWithSecitemOptions() throws { + let certPath = try getEnvironmentVarOrSkipTest(environmentVarName: "AWS_TEST_MQTT311_IOT_CORE_X509_CERT") + let privateKeyPath = try getEnvironmentVarOrSkipTest(environmentVarName: "AWS_TEST_MQTT311_IOT_CORE_X509_KEY") + + let certificateData = try Data(contentsOf: URL(fileURLWithPath: certPath)) + let privateKeyData = try Data(contentsOf: URL(fileURLWithPath: privateKeyPath)) + + let options = try TLSContextOptions.makeMTLS(certificateData: certificateData, privateKeyData: privateKeyData) + try options.setSecitemLabels(certLabel: "TEST_CERT_LABEL", keyLabel: "TEST_KEY_LABEL") + + let context = try TLSContext(options:options, mode: .client) + _ = TLSConnectionOptions(context: context) + } + +#endif } From 610e716e2f5367aba95007e00b8031dca04bb1a9 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Mon, 7 Oct 2024 11:24:08 -0700 Subject: [PATCH 084/115] defines for swift test target --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index cdf29a8ce..7d37aa2b8 100644 --- a/Package.swift +++ b/Package.swift @@ -311,7 +311,7 @@ packageTargets.append(contentsOf: [ resources: [ .process("Resources") ], - cSettings: [ + swiftSettings: [ .define("AWS_USE_SECITEM", .when(platforms: [.iOS, .tvOS])), .define("AWS_USE_DISPATCH_QUEUE", .when(platforms: [.iOS, .tvOS])), .define("AWS_USE_KQUEUE", .when(platforms: [.macOS])) From 06451a05fb6cfd57d149c91089697e9211e77901 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Mon, 7 Oct 2024 13:25:33 -0700 Subject: [PATCH 085/115] add defines to tests in swift --- Package.swift | 15 ++++++++++----- .../io/TLSContextTests.swift | 1 - 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Package.swift b/Package.swift index 7d37aa2b8..56876e98d 100644 --- a/Package.swift +++ b/Package.swift @@ -22,6 +22,9 @@ let cSettings: [CSetting] = [ .define("AWS_APPSTORE_SAFE"), ] +/// Store any defines that will be used by Swift Tests in swiftTestSettings +var swiftTestSettings: [SwiftSetting] = [] + ////////////////////////////////////////////////////////////////////// /// Configure C targets. /// Note: We can not use unsafe flags because SwiftPM makes the target ineligible for use by other packages. @@ -125,11 +128,13 @@ awsCIoPlatformExcludes.append("source/linux") awsCIoPlatformExcludes.append("source/s2n") awsCIoPlatformExcludes.append("source/darwin") cSettingsIO.append(.define("AWS_USE_IO_COMPLETION_PORTS")) +swiftTestSettings.append(.define("AWS_USE_IO_COMPLETION_PORTS")) #elseif os(Linux) awsCIoPlatformExcludes.append("source/windows") awsCIoPlatformExcludes.append("source/bsd") awsCIoPlatformExcludes.append("source/darwin") cSettingsIO.append(.define("AWS_USE_EPOLL")) +swiftTestSettings.append(.define("AWS_USE_EPOLL")) #else // macOS, iOS, watchOS, tvOS awsCIoPlatformExcludes.append("source/windows") awsCIoPlatformExcludes.append("source/linux") @@ -138,6 +143,10 @@ cSettingsIO.append(.define("__APPLE__")) cSettingsIO.append(.define("AWS_USE_DISPATCH_QUEUE", .when(platforms: [.iOS, .tvOS]))) cSettingsIO.append(.define("AWS_USE_SECITEM", .when(platforms: [.iOS, .tvOS]))) cSettingsIO.append(.define("AWS_USE_KQUEUE", .when(platforms: [.macOS]))) +swiftTestSettings.append(.define("__APPLE__")) +swiftTestSettings.append(.define("AWS_USE_DISPATCH_QUEUE", .when(platforms: [.iOS, .tvOS]))) +swiftTestSettings.append(.define("AWS_USE_SECITEM", .when(platforms: [.iOS, .tvOS]))) +swiftTestSettings.append(.define("AWS_USE_KQUEUE", .when(platforms: [.macOS]))) #endif ////////////////////////////////////////////////////////////////////// @@ -311,11 +320,7 @@ packageTargets.append(contentsOf: [ resources: [ .process("Resources") ], - swiftSettings: [ - .define("AWS_USE_SECITEM", .when(platforms: [.iOS, .tvOS])), - .define("AWS_USE_DISPATCH_QUEUE", .when(platforms: [.iOS, .tvOS])), - .define("AWS_USE_KQUEUE", .when(platforms: [.macOS])) - ] + swiftSettings: swiftTestSettings ), .executableTarget( name: "Elasticurl", diff --git a/Test/AwsCommonRuntimeKitTests/io/TLSContextTests.swift b/Test/AwsCommonRuntimeKitTests/io/TLSContextTests.swift index 0dae4ef35..f2326bf07 100644 --- a/Test/AwsCommonRuntimeKitTests/io/TLSContextTests.swift +++ b/Test/AwsCommonRuntimeKitTests/io/TLSContextTests.swift @@ -54,6 +54,5 @@ class TLSContextTests: XCBaseTestCase { let context = try TLSContext(options:options, mode: .client) _ = TLSConnectionOptions(context: context) } - #endif } From 9b177d2c0f75690ce527e438788c94b033402bad Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Mon, 7 Oct 2024 13:42:49 -0700 Subject: [PATCH 086/115] remove watchOS testing --- .github/workflows/ci.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39aab6ec3..9c80eacff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,7 @@ jobs: strategy: fail-fast: false matrix: - # This matrix runs tests on iOS, tvOS & watchOS, on oldest & newest supported Xcodes + # This matrix runs tests on iOS and tvOS on oldest & newest supported Xcodes runner: - macos-12 # x64 - macos-13 # x64 @@ -81,9 +81,7 @@ jobs: [{ os: ios, destination: 'iOS Simulator,OS=16.1,name=iPhone 14'}, { os: ios, destination: 'iOS Simulator,OS=17.2,name=iPhone 15'}, { os: tvos, destination: 'tvOS Simulator,OS=16.1,name=Apple TV 4K (3rd generation) (at 1080p)'}, - { os: tvos, destination: 'tvOS Simulator,OS=17.2,name=Apple TV 4K (3rd generation) (at 1080p)'}, - { os: watchos, destination: 'watchOS Simulator,OS=10.2,name=Apple Watch SE (40mm) (2nd generation)'}, - { os: watchos, destination: 'watchOS Simulator,OS=9.1,name=Apple Watch Series 5 (40mm)'}] + { os: tvos, destination: 'tvOS Simulator,OS=17.2,name=Apple TV 4K (3rd generation) (at 1080p)'}] xcode: - Xcode_14.1 - Xcode_15.2 @@ -110,10 +108,6 @@ jobs: xcode: Xcode_14.1 - target: { os: ios, destination: 'iOS Simulator,OS=17.2,name=iPhone 15'} xcode: Xcode_14.1 - - target: { os: watchos, destination: 'watchOS Simulator,OS=10.2,name=Apple Watch SE (40mm) (2nd generation)'} - xcode: Xcode_14.1 - - target: { os: watchos, destination: 'watchOS Simulator,OS=9.1,name=Apple Watch Series 5 (40mm)'} - xcode: Xcode_15.2 steps: - name: Build ${{ env.PACKAGE_NAME }} + consumers run: | From 97ed422b1cc46bf0d8b21464dd624339b57c9215 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Mon, 7 Oct 2024 14:43:36 -0700 Subject: [PATCH 087/115] pull latest aws-c-io changes --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index 8d353f153..286146272 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit 8d353f153ad1d409f6d99b96f01664d8f905ec87 +Subproject commit 2861462727e8d397a45f1b49466569384195d23e From 9a50b8d6f0c268cd74e53e54bceb5d72e5aa0b1d Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Mon, 7 Oct 2024 14:48:25 -0700 Subject: [PATCH 088/115] update aws-c-io again --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index 286146272..ca520611a 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit 2861462727e8d397a45f1b49466569384195d23e +Subproject commit ca520611adf329778a94f3bf155a86d971f71da8 From 5e5bf337d350884e644926f950426a0b4f4632fd Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 16 Oct 2024 14:32:52 -0700 Subject: [PATCH 089/115] update aws-c-io --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index ca520611a..521294c8b 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit ca520611adf329778a94f3bf155a86d971f71da8 +Subproject commit 521294c8bf603fea8207571c57ba36d8b71dca7f From 52a458ac52412217d20c97f2bb5a3b733e18e018 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Tue, 5 Nov 2024 10:34:04 -0800 Subject: [PATCH 090/115] latest wip aws-c-io --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index ecc4417e7..b3b6645d5 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit ecc4417e79ddcdf6b7e51186d4000f9318c652db +Subproject commit b3b6645d5658e2e2fb4cc24eb3d3a509f4c7fbca From e80b8a48de944f63e7077b3f7d83fc28e761de42 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Tue, 5 Nov 2024 13:43:58 -0800 Subject: [PATCH 091/115] pull latest changes --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index b3b6645d5..8674aa798 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit b3b6645d5658e2e2fb4cc24eb3d3a509f4c7fbca +Subproject commit 8674aa798aed59ecb13506860143c076fdfde3ea From 2af72b89057bdd8ed4c08c4eac229087be42fde9 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 6 Nov 2024 11:06:02 -0800 Subject: [PATCH 092/115] update aws-c-io --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index 8674aa798..b4c9306a8 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit 8674aa798aed59ecb13506860143c076fdfde3ea +Subproject commit b4c9306a861769e88d18bfe7b1a018a4c1cf282d From aac5d8933b305473cf264a8caedb0c2acb7762b3 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Fri, 8 Nov 2024 09:33:46 -0800 Subject: [PATCH 093/115] updated submodules --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index b4c9306a8..bd6d2da1b 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit b4c9306a861769e88d18bfe7b1a018a4c1cf282d +Subproject commit bd6d2da1b3c43dd715f062163a05554401ebec61 From 1baa40b194e4cbfa71bafb7df404e7cf74f063c6 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Fri, 8 Nov 2024 10:36:02 -0800 Subject: [PATCH 094/115] update submodule --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index bd6d2da1b..5e95bbb09 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit bd6d2da1b3c43dd715f062163a05554401ebec61 +Subproject commit 5e95bbb09b312a16776f8de683c447fc57941fc3 From 986c9375186447f864adf49fbb51219e19dd7e75 Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 13 Nov 2024 09:48:27 -0800 Subject: [PATCH 095/115] pull in latest changes from merged nw_socket --- Package.swift | 16 ++++++++-------- aws-common-runtime/aws-c-common | 2 +- aws-common-runtime/aws-c-http | 2 +- aws-common-runtime/aws-c-io | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Package.swift b/Package.swift index 56876e98d..778bc1804 100644 --- a/Package.swift +++ b/Package.swift @@ -127,26 +127,26 @@ awsCIoPlatformExcludes.append("source/posix") awsCIoPlatformExcludes.append("source/linux") awsCIoPlatformExcludes.append("source/s2n") awsCIoPlatformExcludes.append("source/darwin") -cSettingsIO.append(.define("AWS_USE_IO_COMPLETION_PORTS")) -swiftTestSettings.append(.define("AWS_USE_IO_COMPLETION_PORTS")) +cSettingsIO.append(.define("AWS_ENABLE_IO_COMPLETION_PORTS")) +swiftTestSettings.append(.define("AWS_ENABLE_IO_COMPLETION_PORTS")) #elseif os(Linux) awsCIoPlatformExcludes.append("source/windows") awsCIoPlatformExcludes.append("source/bsd") awsCIoPlatformExcludes.append("source/darwin") -cSettingsIO.append(.define("AWS_USE_EPOLL")) -swiftTestSettings.append(.define("AWS_USE_EPOLL")) +cSettingsIO.append(.define("AWS_ENABLE_EPOLL")) +swiftTestSettings.append(.define("AWS_ENABLE_EPOLL")) #else // macOS, iOS, watchOS, tvOS awsCIoPlatformExcludes.append("source/windows") awsCIoPlatformExcludes.append("source/linux") awsCIoPlatformExcludes.append("source/s2n") cSettingsIO.append(.define("__APPLE__")) -cSettingsIO.append(.define("AWS_USE_DISPATCH_QUEUE", .when(platforms: [.iOS, .tvOS]))) +cSettingsIO.append(.define("AWS_ENABLE_DISPATCH_QUEUE", .when(platforms: [.iOS, .tvOS, .macOS]))) cSettingsIO.append(.define("AWS_USE_SECITEM", .when(platforms: [.iOS, .tvOS]))) -cSettingsIO.append(.define("AWS_USE_KQUEUE", .when(platforms: [.macOS]))) +cSettingsIO.append(.define("AWS_ENABLE_KQUEUE", .when(platforms: [.macOS]))) swiftTestSettings.append(.define("__APPLE__")) -swiftTestSettings.append(.define("AWS_USE_DISPATCH_QUEUE", .when(platforms: [.iOS, .tvOS]))) +swiftTestSettings.append(.define("AWS_ENABLE_DISPATCH_QUEUE", .when(platforms: [.iOS, .tvOS, .macOS]))) swiftTestSettings.append(.define("AWS_USE_SECITEM", .when(platforms: [.iOS, .tvOS]))) -swiftTestSettings.append(.define("AWS_USE_KQUEUE", .when(platforms: [.macOS]))) +swiftTestSettings.append(.define("AWS_ENABLE_KQUEUE", .when(platforms: [.macOS]))) #endif ////////////////////////////////////////////////////////////////////// diff --git a/aws-common-runtime/aws-c-common b/aws-common-runtime/aws-c-common index faa6c0f00..f88218867 160000 --- a/aws-common-runtime/aws-c-common +++ b/aws-common-runtime/aws-c-common @@ -1 +1 @@ -Subproject commit faa6c0f00802fc861e7252404f65fb1e0617ca8e +Subproject commit f88218867ba85b463d9f6f00561295e7d90f159e diff --git a/aws-common-runtime/aws-c-http b/aws-common-runtime/aws-c-http index 6068653e1..fc3eded24 160000 --- a/aws-common-runtime/aws-c-http +++ b/aws-common-runtime/aws-c-http @@ -1 +1 @@ -Subproject commit 6068653e1d582bd8e7d1c9f81f86beaf10444e3d +Subproject commit fc3eded2465c37d07fd9cc15e9b5b011224c9c9a diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index 5e95bbb09..41923c106 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit 5e95bbb09b312a16776f8de683c447fc57941fc3 +Subproject commit 41923c106c7b378bc73327790773480b4ca21f17 From 6e34fc85885b458f150703f0dfade7a75b0dd49b Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 13 Nov 2024 13:49:52 -0800 Subject: [PATCH 096/115] latest aws-c-io --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index 41923c106..14a79cc6e 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit 41923c106c7b378bc73327790773480b4ca21f17 +Subproject commit 14a79cc6e5ff2a268117a11b23e647336d19f7f1 From 9a55e43401bb3c30ef0a25f6d6e0444ced94e07a Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Wed, 13 Nov 2024 14:53:01 -0800 Subject: [PATCH 097/115] make HostResolver init public --- Source/AwsCommonRuntimeKit/io/HostResolver.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/AwsCommonRuntimeKit/io/HostResolver.swift b/Source/AwsCommonRuntimeKit/io/HostResolver.swift index ca17a9cd8..94a588fab 100644 --- a/Source/AwsCommonRuntimeKit/io/HostResolver.swift +++ b/Source/AwsCommonRuntimeKit/io/HostResolver.swift @@ -40,7 +40,7 @@ public class HostResolver: HostResolverProtocol { shutdownCallback: shutdownCallback) } - init(eventLoopGroup: EventLoopGroup, + public init(eventLoopGroup: EventLoopGroup, maxHosts: Int, maxTTL: Int, shutdownCallback: ShutdownCallback? = nil) throws { From 468d6d6962fe6496ffb4216423deca17f08423ad Mon Sep 17 00:00:00 2001 From: Steve Kim Date: Mon, 2 Dec 2024 09:56:53 -0800 Subject: [PATCH 098/115] update HostResolver to make init public --- Source/AwsCommonRuntimeKit/io/HostResolver.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Source/AwsCommonRuntimeKit/io/HostResolver.swift b/Source/AwsCommonRuntimeKit/io/HostResolver.swift index 94a588fab..4a1bf35b0 100644 --- a/Source/AwsCommonRuntimeKit/io/HostResolver.swift +++ b/Source/AwsCommonRuntimeKit/io/HostResolver.swift @@ -40,10 +40,7 @@ public class HostResolver: HostResolverProtocol { shutdownCallback: shutdownCallback) } - public init(eventLoopGroup: EventLoopGroup, - maxHosts: Int, - maxTTL: Int, - shutdownCallback: ShutdownCallback? = nil) throws { + public init(eventLoopGroup: EventLoopGroup, maxHosts: Int, maxTTL: Int, shutdownCallback: ShutdownCallback? = nil) throws { let shutdownCallbackCore = ShutdownCallbackCore(shutdownCallback) let getRawValue: () -> UnsafeMutablePointer? = { withUnsafePointer(to: shutdownCallbackCore.getRetainedShutdownOptions()) { shutdownCallbackCorePointer in From 89a9431a17a1fb30ddee96b928d1d9fcf2d1e780 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 10:16:47 -0800 Subject: [PATCH 099/115] test ios app --- .../MqttClient/MqttClient/ContentView.swift | 40 +++++++++++++++++-- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/MqttClient/ContentView.swift b/Test/IntegrationTests/MqttClient/MqttClient/ContentView.swift index 9bcfab10e..1a4cf6819 100644 --- a/Test/IntegrationTests/MqttClient/MqttClient/ContentView.swift +++ b/Test/IntegrationTests/MqttClient/MqttClient/ContentView.swift @@ -150,7 +150,7 @@ class MqttTestContext: ObservableObject { self.semaphoreConnectionFailure.signal() } self.onLifecycleEventDisconnection = onLifecycleEventDisconnection ?? { disconnectionData in - self.printView(contextName + " Mqtt5ClientTests: onLifecycleEventDisconnection") + self.printView(contextName + " Mqtt5ClientTests: onLifecycleEventDisconnection: \(disconnectionData.crtError.code)") self.lifecycleDisconnectionData = disconnectionData self.semaphoreDisconnection.signal() } @@ -208,15 +208,47 @@ func setupClientAndStart() { let ConnectPacket = MqttConnectOptions(keepAliveInterval: 60, clientId: createClientId()) +// let certPath = Bundle.main.path(forResource: "cert", ofType: "pem")! +// let keypath = Bundle.main.path(forResource: "privatekey", ofType: "pem")! +// +// let certtext = try! String(contentsOf: Bundle.main.url(forResource: "cert", withExtension: "pem")!) +// let keytext = try! String(contentsOf: Bundle.main.url(forResource: "privatekey", withExtension: "pem")!) +// + let certData = try! Data(contentsOf: Bundle.main.url(forResource: "cert", withExtension: "pem")!) + let keyData = try! Data(contentsOf: Bundle.main.url(forResource: "privatekey", withExtension: "pem")!) +// +// mqttTestContext.printView("cert path" + certtext); +// mqttTestContext.printView("key path" + keytext); +// +// + let tlsOptions = try! TLSContextOptions.makeMTLS( + certificateData: certData, privateKeyData: keyData + ) + let tlsContext = try! TLSContext(options: tlsOptions, mode: .client) + + let clientOptions = MqttClientOptions( hostName: TEST_HOST, port: TEST_PORT, + tlsCtx: tlsContext, connectOptions: ConnectPacket, - connackTimeout: TimeInterval(10)) - + connackTimeout: TimeInterval(10000)) do { - client = try createClient(clientOptions: clientOptions, testContext: mqttTestContext) + client = try! createClient(clientOptions: clientOptions, testContext: mqttTestContext) try connectClient(client: client!, testContext: mqttTestContext) + + let topic = "test/topic"; + + Task { + var index = 0; + while(true){ + let publishPacket = PublishPacket(qos: QoS.atLeastOnce, topic: topic, payload: ("Hello World \(index)".data(using: .utf8))); + let _: PublishResult = try! await client!.publish(publishPacket: publishPacket) + index += 1; + sleep(1); + } + } + } catch { mqttTestContext.printView("Failed to setup client.") } From 43ce1566146107f59cded9b7440de54aa04f95f4 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 11:14:56 -0800 Subject: [PATCH 100/115] test with device farm --- .github/workflows/ci.yml | 9 ++++++++- Package.swift | 2 +- .../MqttClient/MqttClient.xcodeproj/project.pbxproj | 12 ++++++++++-- .../MqttClient/MqttClient/ContentView.swift | 4 ++-- aws-common-runtime/aws-c-io | 2 +- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6375f59e5..1743b49d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,6 +73,13 @@ jobs: BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.MOBILEPROVISION_BASE64 }} KEYCHAIN_PASSWORD: ${{ secrets.TEST_KEYCHAIN_PASSWORD }} steps: + - name : + run : | + cd aws-crt-swift/Test/IntegrationTests/MqttClient + ENDPOINT=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/endpoint" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") + cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > ./cert.pem + key=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/privatekey" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > ./privatekey.pem + sed -i '' "s//${ENDPOINT}/g" ContextView.swift - name: Build ${{ env.PACKAGE_NAME }} + consumers run: | python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" @@ -96,7 +103,7 @@ jobs: # apply provisioning profile mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles - - name: Buil Test App + - name: Build Test App run: | xcode-select --print-path pwd diff --git a/Package.swift b/Package.swift index 778bc1804..5455635a2 100644 --- a/Package.swift +++ b/Package.swift @@ -145,7 +145,7 @@ cSettingsIO.append(.define("AWS_USE_SECITEM", .when(platforms: [.iOS, .tvOS]))) cSettingsIO.append(.define("AWS_ENABLE_KQUEUE", .when(platforms: [.macOS]))) swiftTestSettings.append(.define("__APPLE__")) swiftTestSettings.append(.define("AWS_ENABLE_DISPATCH_QUEUE", .when(platforms: [.iOS, .tvOS, .macOS]))) -swiftTestSettings.append(.define("AWS_USE_SECITEM", .when(platforms: [.iOS, .tvOS]))) +swiftTestSettings.append(.define("AWS_USE_SECITEM", .when(platforms: [.macOS, .iOS, .tvOS]))) swiftTestSettings.append(.define("AWS_ENABLE_KQUEUE", .when(platforms: [.macOS]))) #endif diff --git a/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj b/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj index 0b80d7900..5c33643e8 100644 --- a/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj +++ b/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + A6183C4B2CFE3157007281B8 /* cert.pem in Resources */ = {isa = PBXBuildFile; fileRef = A6183C482CFE3157007281B8 /* cert.pem */; }; + A6183C4F2CFE322E007281B8 /* privatekey.pem in Resources */ = {isa = PBXBuildFile; fileRef = A6183C4E2CFE322E007281B8 /* privatekey.pem */; }; A63CEBB52C238347003A71B7 /* MqttClientApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = A63CEBB42C238347003A71B7 /* MqttClientApp.swift */; }; A63CEBB72C238347003A71B7 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A63CEBB62C238347003A71B7 /* ContentView.swift */; }; A63CEBC62C2387A3003A71B7 /* AwsCommonRuntimeKit in Frameworks */ = {isa = PBXBuildFile; productRef = A63CEBC52C2387A3003A71B7 /* AwsCommonRuntimeKit */; }; @@ -16,6 +18,8 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + A6183C482CFE3157007281B8 /* cert.pem */ = {isa = PBXFileReference; lastKnownFileType = text; path = cert.pem; sourceTree = ""; }; + A6183C4E2CFE322E007281B8 /* privatekey.pem */ = {isa = PBXFileReference; lastKnownFileType = text; path = privatekey.pem; sourceTree = ""; }; A63CEBB12C238347003A71B7 /* MqttClient.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MqttClient.app; sourceTree = BUILT_PRODUCTS_DIR; }; A63CEBB42C238347003A71B7 /* MqttClientApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MqttClientApp.swift; sourceTree = ""; }; A63CEBB62C238347003A71B7 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -58,6 +62,8 @@ A6C798762C238DD30055AE09 /* Assets.xcassets */, A63CEBB42C238347003A71B7 /* MqttClientApp.swift */, A63CEBB62C238347003A71B7 /* ContentView.swift */, + A6183C482CFE3157007281B8 /* cert.pem */, + A6183C4E2CFE322E007281B8 /* privatekey.pem */, ); path = MqttClient; sourceTree = ""; @@ -128,7 +134,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + A6183C4F2CFE322E007281B8 /* privatekey.pem in Resources */, A6C798772C238DD30055AE09 /* Assets.xcassets in Resources */, + A6183C4B2CFE3157007281B8 /* cert.pem in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -274,7 +282,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = 3V5W3HV3D4; + DEVELOPMENT_TEAM = K33Z8NL3RV; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = MqttClient/Info.plist; @@ -304,7 +312,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = 3V5W3HV3D4; + DEVELOPMENT_TEAM = K33Z8NL3RV; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_FILE = MqttClient/Info.plist; diff --git a/Test/IntegrationTests/MqttClient/MqttClient/ContentView.swift b/Test/IntegrationTests/MqttClient/MqttClient/ContentView.swift index 1a4cf6819..1a440fec5 100644 --- a/Test/IntegrationTests/MqttClient/MqttClient/ContentView.swift +++ b/Test/IntegrationTests/MqttClient/MqttClient/ContentView.swift @@ -7,7 +7,7 @@ import AwsCommonRuntimeKit // The app setup a direct connection with default TLS options. // Update the host and port before run the app. let TEST_HOST = "" -let TEST_PORT: UInt32 = 1883 +let TEST_PORT: UInt32 = 8883 var mqttTestContext = MqttTestContext() var client: Mqtt5Client? @@ -216,7 +216,7 @@ func setupClientAndStart() { // let certData = try! Data(contentsOf: Bundle.main.url(forResource: "cert", withExtension: "pem")!) let keyData = try! Data(contentsOf: Bundle.main.url(forResource: "privatekey", withExtension: "pem")!) -// + // mqttTestContext.printView("cert path" + certtext); // mqttTestContext.printView("key path" + keytext); // diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index 14a79cc6e..79db77671 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit 14a79cc6e5ff2a268117a11b23e647336d19f7f1 +Subproject commit 79db77671f53b24bf1c1d676dd454bc2e6334512 From 5b843c8c73a490d65af56f207101e4dede2e0593 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 11:18:03 -0800 Subject: [PATCH 101/115] figure out the folder --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1743b49d4..2e557efc0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,6 +75,7 @@ jobs: steps: - name : run : | + pwd cd aws-crt-swift/Test/IntegrationTests/MqttClient ENDPOINT=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/endpoint" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > ./cert.pem From 15ad1edbf8ba4dead8607860510240906d18723d Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 11:19:26 -0800 Subject: [PATCH 102/115] switch to test folder --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e557efc0..746cccc8e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,8 +75,7 @@ jobs: steps: - name : run : | - pwd - cd aws-crt-swift/Test/IntegrationTests/MqttClient + cd Test/IntegrationTests/MqttClient ENDPOINT=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/endpoint" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > ./cert.pem key=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/privatekey" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > ./privatekey.pem From f83e1d8baf2a25f12a314cb0cf883f0dc5d0e5e1 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 11:23:34 -0800 Subject: [PATCH 103/115] list file.... --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 746cccc8e..3026f863f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,6 +75,7 @@ jobs: steps: - name : run : | + ls cd Test/IntegrationTests/MqttClient ENDPOINT=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/endpoint" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > ./cert.pem From cc9a31b9e508e80dc3299578ecdd66553d501077 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 13:30:23 -0800 Subject: [PATCH 104/115] test device farm --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3026f863f..2e557efc0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,8 +75,8 @@ jobs: steps: - name : run : | - ls - cd Test/IntegrationTests/MqttClient + pwd + cd aws-crt-swift/Test/IntegrationTests/MqttClient ENDPOINT=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/endpoint" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > ./cert.pem key=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/privatekey" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > ./privatekey.pem From ad90ebd96817b25ce33246a82825e855974dac57 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 13:35:45 -0800 Subject: [PATCH 105/115] checkout source --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e557efc0..fb29b8a5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,9 +73,15 @@ jobs: BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.MOBILEPROVISION_BASE64 }} KEYCHAIN_PASSWORD: ${{ secrets.TEST_KEYCHAIN_PASSWORD }} steps: + - name: Checkout Source + uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 - name : run : | pwd + ls cd aws-crt-swift/Test/IntegrationTests/MqttClient ENDPOINT=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/endpoint" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > ./cert.pem From 47c41c4098d553e89b863b37e980e6d42272bb5d Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 13:38:02 -0800 Subject: [PATCH 106/115] update path --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb29b8a5f..179aecc65 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,9 +80,7 @@ jobs: fetch-depth: 0 - name : run : | - pwd - ls - cd aws-crt-swift/Test/IntegrationTests/MqttClient + cd Test/IntegrationTests/MqttClient ENDPOINT=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/endpoint" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > ./cert.pem key=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/privatekey" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > ./privatekey.pem From 22778ebc17609782dc5b45c0bb8ed828e934051c Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 13:46:34 -0800 Subject: [PATCH 107/115] use different certs and endpoint --- .github/workflows/ci.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 179aecc65..afd364314 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,18 +73,6 @@ jobs: BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.MOBILEPROVISION_BASE64 }} KEYCHAIN_PASSWORD: ${{ secrets.TEST_KEYCHAIN_PASSWORD }} steps: - - name: Checkout Source - uses: actions/checkout@v4 - with: - submodules: true - fetch-depth: 0 - - name : - run : | - cd Test/IntegrationTests/MqttClient - ENDPOINT=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/endpoint" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") - cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/cert" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > ./cert.pem - key=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "test/privatekey" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > ./privatekey.pem - sed -i '' "s//${ENDPOINT}/g" ContextView.swift - name: Build ${{ env.PACKAGE_NAME }} + consumers run: | python3 -c "from urllib.request import urlretrieve; urlretrieve('${{ env.BUILDER_HOST }}/${{ env.BUILDER_SOURCE }}/${{ env.BUILDER_VERSION }}/builder.pyz?run=${{ env.RUN }}', 'builder')" @@ -108,6 +96,13 @@ jobs: # apply provisioning profile mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles + - name : Setup iOS App Credentials + run : | + cd aws-crt-swift/Test/IntegrationTests/MqttClient + ENDPOINT=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "unit-test/endpoint" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") + cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "unit-test/certificate" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > ./cert.pem + key=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "unit-test/privatekey" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > ./privatekey.pem + sed -i '' "s//${ENDPOINT}/g" ContextView.swift - name: Build Test App run: | xcode-select --print-path From fb0f2f3f7d1833bad65ec85f701817e8535c0139 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 13:52:25 -0800 Subject: [PATCH 108/115] setup aws-c-io --- aws-common-runtime/aws-c-io | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws-common-runtime/aws-c-io b/aws-common-runtime/aws-c-io index 79db77671..c850837ed 160000 --- a/aws-common-runtime/aws-c-io +++ b/aws-common-runtime/aws-c-io @@ -1 +1 @@ -Subproject commit 79db77671f53b24bf1c1d676dd454bc2e6334512 +Subproject commit c850837edb14886f594252736f4ad3415851ee42 From d19c527ed4eb41d2c42d58b3a14b2743ce8595f6 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 13:58:18 -0800 Subject: [PATCH 109/115] fix credential file path --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index afd364314..9ea815310 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,7 +98,7 @@ jobs: cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles - name : Setup iOS App Credentials run : | - cd aws-crt-swift/Test/IntegrationTests/MqttClient + cd aws-crt-swift/Test/IntegrationTests/MqttClient/MqttClient ENDPOINT=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "unit-test/endpoint" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "unit-test/certificate" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > ./cert.pem key=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "unit-test/privatekey" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > ./privatekey.pem From 0106f8b4955cea4c6d673aa4453bc27570024815 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 14:24:36 -0800 Subject: [PATCH 110/115] fix file name --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ea815310..148b0f115 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,7 +102,7 @@ jobs: ENDPOINT=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "unit-test/endpoint" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") cert=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "unit-test/certificate" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$cert" > ./cert.pem key=$(aws secretsmanager get-secret-value --region us-east-1 --secret-id "unit-test/privatekey" --query "SecretString" | cut -f2 -d":" | cut -f2 -d\") && echo -e "$key" > ./privatekey.pem - sed -i '' "s//${ENDPOINT}/g" ContextView.swift + sed -i '' "s//${ENDPOINT}/g" ContentView.swift - name: Build Test App run: | xcode-select --print-path From 0ac6f705ad00f4f15584a1cdad73bbd758b2de5c Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 14:34:11 -0800 Subject: [PATCH 111/115] use the test info.plist file --- .../MqttClient/MqttClient.xcodeproj/project.pbxproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj b/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj index 5c33643e8..0416bd83b 100644 --- a/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj +++ b/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj @@ -285,7 +285,6 @@ DEVELOPMENT_TEAM = K33Z8NL3RV; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = MqttClient/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; @@ -315,7 +314,6 @@ DEVELOPMENT_TEAM = K33Z8NL3RV; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_FILE = MqttClient/Info.plist; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; From 14253c154aad0cd74e29b9051a0dc5223f4a16f6 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 14:57:41 -0800 Subject: [PATCH 112/115] use apple account aws-common-runtime --- .../MqttClient/MqttClient.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj b/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj index 0416bd83b..82f21e0f9 100644 --- a/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj +++ b/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj @@ -282,7 +282,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = K33Z8NL3RV; + DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; @@ -311,7 +311,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = K33Z8NL3RV; + DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; From 8d2a0953acaf6c0a7ec4bbbe463d202149cdb457 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 2 Dec 2024 15:06:59 -0800 Subject: [PATCH 113/115] update developer team id --- .../MqttClient/MqttClient.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj b/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj index 82f21e0f9..aec6d6227 100644 --- a/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj +++ b/Test/IntegrationTests/MqttClient/MqttClient.xcodeproj/project.pbxproj @@ -282,7 +282,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 3V5W3HV3D4; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; @@ -311,7 +311,7 @@ CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = ""; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 3V5W3HV3D4; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; From dba5e48ce2bf7119bb8b50f2c651b5ce0cf8f0d7 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Wed, 11 Dec 2024 09:32:29 -0800 Subject: [PATCH 114/115] force use PyYAML6.0.1 --- .../MqttClient/DeviceFarmScript/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index e44fc67c6..1baebb96c 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -4,7 +4,7 @@ pytest~=7.4.3 boto3~=1.28.1 urllib3==1.26.18 requests~=2.28.0 -PyYAML~=6.0.1 +PyYAML==6.0.1 pytest-metadata~=3.0.0 pytest-html~=3.2.0 selenium~=4.9.0 From 9f2f58dc03dee0b9edaa89135722f1fa4c4b062d Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Wed, 11 Dec 2024 09:53:51 -0800 Subject: [PATCH 115/115] test with fixed dependency version --- .../MqttClient/DeviceFarmScript/requirements.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt index 1baebb96c..3b3284191 100644 --- a/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt +++ b/Test/IntegrationTests/MqttClient/DeviceFarmScript/requirements.txt @@ -1,12 +1,12 @@ packaging==24.0 -Appium-Python-Client~=2.11.0 -pytest~=7.4.3 -boto3~=1.28.1 +Appium-Python-Client==2.11.0 +pytest==7.4.3 +boto3==1.28.1 urllib3==1.26.18 -requests~=2.28.0 +requests==2.28.0 PyYAML==6.0.1 -pytest-metadata~=3.0.0 -pytest-html~=3.2.0 -selenium~=4.9.0 +pytest-metadata==3.0.0 +pytest-html==3.2.0 +selenium==4.9.0 pluggy==1.2.0 -trio~=0.22.2 +trio==0.22.2