From e6c131c8cfd0a5fb24752d28cacaa3997317cd43 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:32:52 -0400 Subject: [PATCH 01/23] test: build then test - unit test suites --- .../action.yml | 55 +++ .../action.yml | 52 +++ .github/workflows/unit_test_split_flow.yml | 372 ++++++++++++++++++ .gitignore | 1 + 4 files changed, 480 insertions(+) create mode 100644 .github/composite_actions/run_xcodebuild_build_for_testing/action.yml create mode 100644 .github/composite_actions/run_xcodebuild_test_without_building/action.yml create mode 100644 .github/workflows/unit_test_split_flow.yml diff --git a/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml b/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml new file mode 100644 index 0000000000..86212d7dae --- /dev/null +++ b/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml @@ -0,0 +1,55 @@ +name: 'Run xcodebuild build-for-testing' +description: 'Action builds the specified scheme for testing' + +inputs: + scheme: + required: true + type: string + sdk: + required: true + type: string + destination: + required: true + type: string + cloned_source_packages_path: + required: false + type: string + default: '' + derived_data_path: + required: true + type: string + disable_package_resolution: + required: false + type: boolean + default: false + +runs: + using: "composite" + steps: + - name: Test ${{ inputs.scheme }} + env: + SCHEME: ${{ inputs.scheme }} + PROJECT_PATH: ${{ inputs.project_path }} + CLONED_SOURCE_PACKAGES_PATH: ${{ inputs.cloned_source_packages_path }} + DERIVED_DATA_PATH: ${{ inputs.derived_data_path }} + run: | + sudo xcode-select -s /Applications/Xcode_14.3.app + + clonedSourcePackagesPath="" + if [ ! -z "$CLONED_SOURCE_PACKAGES_PATH" ]; then + echo "Using custom cloned source packages path" + clonedSourcePackagesPath+="-clonedSourcePackagesDirPath $CLONED_SOURCE_PACKAGES_PATH" + fi + + if [ "${{ inputs.disable_package_resolution }}" == "true" ]; then + echo "Disabling Automatic Package Resolution" + clonedSourcePackagesPath+=" -disableAutomaticPackageResolution" + fi + + xcode-select -p + xcodebuild -version + xcodebuild build-for-testing -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' $clonedSourcePackagesPath -derivedDataPath '${{ inputs.derived_data_path }}' | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + shell: bash + + + xcodebuild build-for-testing -scheme AWSAPIPlugin -sdk 'iphonesimulator' -destination 'platform=iOS Simulator,name=iPhone 14,OS=16.4' -derivedDataPath 'Build' diff --git a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml new file mode 100644 index 0000000000..06160aec9c --- /dev/null +++ b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml @@ -0,0 +1,52 @@ +name: 'Run xcodebuild test-without-building' +description: 'Action tests the specified scheme without building' + +inputs: + scheme: + required: true + type: string + sdk: + required: true + type: string + destination: + required: true + type: string + derived_data_path: + required: true + type: string + generate_coverage: + required: true + type: boolean + +runs: + using: "composite" + steps: + - name: Test ${{ inputs.scheme }} + env: + SCHEME: ${{ inputs.scheme }} + SDK: ${{ input.sdk }} + DESTINATION: ${{ inputs.destination }} + DERIVED_DATA_PATH: ${{ inputs.derived_data_path }} + run: | + sudo xcode-select -s /Applications/Xcode_14.3.app + + derivedDataPath="" + if [ ! -z "$DERIVED_DATA_PATH" ]; then + echo "Using custom DerivedData path" + derivedDataPath+="-derivedDataPath $DERIVED_DATA_PATH" + fi + + coverageFlags="" + if [ "${{ inputs.generate_coverage }}" == "true" ]; then + echo "Code Coverage is enabled!" + coverageFlags+="-enableCodeCoverage YES" + + if [ -z "$derivedDataPath" ]; then + derivedDataPath+="-derivedDataPath Build/" + fi + fi + + xcode-select -p + xcodebuild -version + xcodebuild test-without-building -scheme $SCHEME -sdk $SDK -destination $DESTINATION $derivedDataPath $coverageFlags | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + shell: bash diff --git a/.github/workflows/unit_test_split_flow.yml b/.github/workflows/unit_test_split_flow.yml new file mode 100644 index 0000000000..8dff37d313 --- /dev/null +++ b/.github/workflows/unit_test_split_flow.yml @@ -0,0 +1,372 @@ +name: Unit Test - Split Flow | All +on: + workflow_call: + inputs: + identifier: + required: true + type: string + + workflow_dispatch: + push: + branches-ignore: + - main + - release + +permissions: + contents: read + actions: write + +concurrency: + group: ${{ inputs.identifier || github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref_name != 'main'}} + +jobs: + build-for-testing-ios: + name: Amplify-Package build for testing - iOS + runs-on: macos-13 + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + with: + persist-credentials: false + - name: Attempt to restore dependencies cache + id: cache-packages + timeout-minutes: 4 + continue-on-error: true + uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ~/Library/Developer/Xcode/DerivedData/Amplify + key: amplify-packages-${{ hashFiles('Package.resolved') }} + restore-keys: | + amplify-packages- + - name: Attempt to restore the build cache for this SHA + id: restore-build + timeout-minutes: 4 + continue-on-error: true + uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ${{ github.workspace }}/Build + key: ${{ env.SCHEME }}-iOS-build-${{ github.sha }} + restore-keys: | + ${{ env.SCHEME }}-iOS-build- + - name: Attempt to restore the build cache from main + if: steps.restore-build.outputs.cache-hit != 'true' + id: restore-main-build + timeout-minutes: 4 + continue-on-error: true + uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ${{ github.workspace }}/Build + key: ${{ env.SCHEME }}-iOS-latest-build-main + - name: Build for Testing iOS + id: build-for-testing-amplify-package-ios + continue-on-error: false + uses: ./.github/composite_actions/run_xcodebuild_build_for_testing + with: + scheme: 'Amplify-Package' + sdk: 'iphonesimulator' + destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4' + cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify + derived_data_path: ${{ github.workspace }}/Build + disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }} + + build-for-testing-macos: + name: Amplify-Package build for testing - macOS + runs-on: macos-13 + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + with: + persist-credentials: false + - name: Attempt to restore dependencies cache + id: cache-packages + timeout-minutes: 4 + continue-on-error: true + uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ~/Library/Developer/Xcode/DerivedData/Amplify + key: amplify-packages-${{ hashFiles('Package.resolved') }} + restore-keys: | + amplify-packages- + - name: Attempt to restore the build cache for this SHA + id: restore-build + timeout-minutes: 4 + continue-on-error: true + uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ${{ github.workspace }}/Build + key: ${{ env.SCHEME }}-macOS-build-${{ github.sha }} + restore-keys: | + ${{ env.SCHEME }}-macOS-build- + - name: Attempt to restore the build cache from main + if: steps.restore-build.outputs.cache-hit != 'true' + id: restore-main-build + timeout-minutes: 4 + continue-on-error: true + uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ${{ github.workspace }}/Build + key: ${{ env.SCHEME }}-macOS-latest-build-main + - name: Build for Testing macOS + id: build-for-testing-amplify-package-macOS + continue-on-error: false + uses: ./.github/composite_actions/run_xcodebuild_build_for_testing + with: + scheme: 'Amplify-Package' + sdk: 'macosx' + destination: 'platform=macOS,arch=x86_64' + cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify + derived_data_path: ${{ github.workspace }}/Build + disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }} + + build-for-testing-tvos: + name: Amplify-Package build for testing - tvOS + runs-on: macos-13 + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + with: + persist-credentials: false + - name: Attempt to restore dependencies cache + id: cache-packages + timeout-minutes: 4 + continue-on-error: true + uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ~/Library/Developer/Xcode/DerivedData/Amplify + key: amplify-packages-${{ hashFiles('Package.resolved') }} + restore-keys: | + amplify-packages- + - name: Attempt to restore the build cache for this SHA + id: restore-build + timeout-minutes: 4 + continue-on-error: true + uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ${{ github.workspace }}/Build + key: ${{ env.SCHEME }}-tvOS-build-${{ github.sha }} + restore-keys: | + ${{ env.SCHEME }}-tvOS-build- + - name: Attempt to restore the build cache from main + if: steps.restore-build.outputs.cache-hit != 'true' + id: restore-main-build + timeout-minutes: 4 + continue-on-error: true + uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ${{ github.workspace }}/Build + key: ${{ env.SCHEME }}-tvOS-latest-build-main + - name: Build for Testing tvOS + id: build-for-testing-amplify-package-tvOS + continue-on-error: false + uses: ./.github/composite_actions/run_xcodebuild_build_for_testing + with: + scheme: 'Amplify-Package' + sdk: 'appletvsimulator' + destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4' + cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify + derived_data_path: ${{ github.workspace }}/Build + disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }} + + build-for-testing-watchos: + name: Amplify-Package build for testing - watchOS + runs-on: macos-13 + steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + with: + persist-credentials: false + - name: Attempt to restore dependencies cache + id: cache-packages + timeout-minutes: 4 + continue-on-error: true + uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ~/Library/Developer/Xcode/DerivedData/Amplify + key: amplify-packages-${{ hashFiles('Package.resolved') }} + restore-keys: | + amplify-packages- + - name: Attempt to restore the build cache for this SHA + id: restore-build + timeout-minutes: 4 + continue-on-error: true + uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ${{ github.workspace }}/Build + key: ${{ env.SCHEME }}-watchOS-build-${{ github.sha }} + restore-keys: | + ${{ env.SCHEME }}-watchOS-build- + - name: Attempt to restore the build cache from main + if: steps.restore-build.outputs.cache-hit != 'true' + id: restore-main-build + timeout-minutes: 4 + continue-on-error: true + uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ${{ github.workspace }}/Build + key: ${{ env.SCHEME }}-watchOS-latest-build-main + - name: Build for Testing watchOS + id: build-for-testing-amplify-package-watchOS + continue-on-error: false + uses: ./.github/composite_actions/run_xcodebuild_build_for_testing + with: + scheme: 'Amplify-Package' + sdk: 'watchsimulator' + destination: 'platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4' + cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify + derived_data_path: ${{ github.workspace }}/Build + disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }} + + unit-tests-with-coverage-ios: + name: ${{ matrix.scheme }} Unit Tests + needs: build-for-testing-ios + strategy: + fail-fast: false + matrix: + scheme: [ + Amplify, + AWSPluginsCore, + AWSAPIPlugin, + AWSCloudWatchLoggingPlugin, + AWSCognitoAuthPlugin, + AWSDataStorePlugin, + AWSLocationGeoPlugin, + AWSPredictionsPlugin, + AWSPinpointAnalyticsPlugin, + AWSPinpointPushNotificationsPlugin, + AWSS3StoragePlugin, + CoreMLPredictionsPlugin + ] + uses: ./.github/composite_actions/run_xcodebuild_test_without_building + with: + scheme: ${{ matrix.scheme }} + sdk: 'iphonesimulator' + destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4' + derived_data_path: ${{ github.workspace }}/Build + generate_coverage: true + + unit-tests-with-coverage-macos: + name: ${{ matrix.scheme }} Unit Tests + needs: build-for-testing-macos + strategy: + fail-fast: false + matrix: + scheme: [ + Amplify, + AWSPluginsCore, + AWSAPIPlugin, + AWSCloudWatchLoggingPlugin, + AWSCognitoAuthPlugin, + AWSDataStorePlugin, + AWSLocationGeoPlugin, + AWSPredictionsPlugin, + AWSPinpointAnalyticsPlugin, + AWSPinpointPushNotificationsPlugin, + AWSS3StoragePlugin, + CoreMLPredictionsPlugin + ] + uses: ./.github/composite_actions/run_xcodebuild_test_without_building + with: + scheme: ${{ matrix.scheme }} + sdk: 'macosx' + destination: 'platform=macOS,arch=x86_64' + derived_data_path: ${{ github.workspace }}/Build + generate_coverage: true + + unit-tests-with-coverage-tvos: + name: ${{ matrix.scheme }} Unit Tests + needs: build-for-testing-tvos + strategy: + fail-fast: false + matrix: + scheme: [ + Amplify, + AWSPluginsCore, + AWSAPIPlugin, + AWSCloudWatchLoggingPlugin, + AWSCognitoAuthPlugin, + AWSDataStorePlugin, + AWSLocationGeoPlugin, + AWSPredictionsPlugin, + AWSPinpointAnalyticsPlugin, + AWSPinpointPushNotificationsPlugin, + AWSS3StoragePlugin, + CoreMLPredictionsPlugin + ] + uses: ./.github/composite_actions/run_xcodebuild_test_without_building + with: + scheme: ${{ matrix.scheme }} + sdk: 'appletvsimulator' + destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4' + derived_data_path: ${{ github.workspace }}/Build + generate_coverage: true + + unit-tests-with-coverage-macos: + name: ${{ matrix.scheme }} Unit Tests + needs: build-for-testing-watchos + strategy: + fail-fast: false + matrix: + scheme: [ + Amplify, + AWSPluginsCore, + AWSAPIPlugin, + AWSCloudWatchLoggingPlugin, + AWSCognitoAuthPlugin, + AWSDataStorePlugin, + AWSLocationGeoPlugin, + AWSPredictionsPlugin, + AWSPinpointAnalyticsPlugin, + AWSPinpointPushNotificationsPlugin, + AWSS3StoragePlugin, + CoreMLPredictionsPlugin + ] + uses: ./.github/composite_actions/run_xcodebuild_test_without_building + with: + scheme: ${{ matrix.scheme }} + sdk: 'watchsimulator' + destination: 'platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4' + derived_data_path: ${{ github.workspace }}/Build + generate_coverage: true + + report-coverage: + name: ${{ matrix.file.scheme }} Coverage Report + needs: [ + unit-tests-with-coverage-ios, + unit-tests-with-coverage-macos, + unit-tests-with-coverage-tvos, + unit-tests-with-coverage-watchos + ] + strategy: + fail-fast: false + matrix: + file: [ + { scheme: Amplify, flags: 'Amplify,unit_tests' }, + { scheme: AWSPluginsCore, flags: 'AWSPluginsCore,unit_tests' }, + { scheme: AWSAPIPlugin, flags: 'API_plugin_unit_test,unit_tests' }, + { scheme: AWSCloudWatchLoggingPlugin, flags: 'Logging_plugin_unit_test,unit_tests' }, + { scheme: AWSCognitoAuthPlugin, flags: 'Auth_plugin_unit_test,unit_tests' }, + { scheme: AWSDataStorePlugin, flags: 'DataStore_plugin_unit_test,unit_tests' }, + { scheme: AWSLocationGeoPlugin, flags: 'Geo_plugin_unit_test,unit_tests' }, + { scheme: AWSPredictionsPlugin, flags: 'Predictions_plugin_unit_test,unit_tests' }, + { scheme: AWSPinpointAnalyticsPlugin, flags: 'Analytics_plugin_unit_test,unit_tests' }, + { scheme: AWSPinpointPushNotificationsPlugin, flags: 'PushNotifications_plugin_unit_test,unit_tests' }, + { scheme: AWSS3StoragePlugin, flags: 'Storage_plugin_unit_test,unit_tests' }, + { scheme: CoreMLPredictionsPlugin, flags: 'CoreMLPredictions_plugin_unit_test,unit_tests' } + ] + uses: ./.github/workflows/upload_coverage_report.yml + with: + scheme: ${{ matrix.file.scheme }} + flags: ${{ matrix.file.flags }} + + unit-test-pass-confirmation: + runs-on: ubuntu-latest + name: Confirm Passing Unit Tests + if: ${{ !cancelled() }} + needs: [ + unit-tests-with-coverage-ios, + unit-tests-with-coverage-macos, + unit-tests-with-coverage-watchos, + unit-tests-with-coverage-tvos, + unit-tests-without-coverage + ] + env: + EXIT_CODE: ${{ contains(needs.*.result, 'failure') && 1 || 0 }} + steps: + - run: exit $EXIT_CODE diff --git a/.gitignore b/.gitignore index ee2ee74060..2b4616a6ac 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ Thumbs.db **/*.xcuserdata *.xcworkspace/ +!amplify.xcworkspace !.swiftpm/xcode/package.xcworkspace !AmplifyPlugins/Analytics/Tests/AnalyticsHostApp/AnalyticsHostApp.xcodeproj/project.xcworkspace !AmplifyPlugins/Auth/Tests/AuthHostApp/AuthHostApp.xcodeproj/project.xcworkspace From 3dc99438907b6f3bb1293e6f328b0b13cb0c641f Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:35:25 -0400 Subject: [PATCH 02/23] fix job name typo [skip ci] --- .github/workflows/unit_test_split_flow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit_test_split_flow.yml b/.github/workflows/unit_test_split_flow.yml index 8dff37d313..770aec6ccd 100644 --- a/.github/workflows/unit_test_split_flow.yml +++ b/.github/workflows/unit_test_split_flow.yml @@ -297,7 +297,7 @@ jobs: derived_data_path: ${{ github.workspace }}/Build generate_coverage: true - unit-tests-with-coverage-macos: + unit-tests-with-coverage-watchos: name: ${{ matrix.scheme }} Unit Tests needs: build-for-testing-watchos strategy: From e810fbfb50e39a073889a99784688b3b6e6aec77 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:40:16 -0400 Subject: [PATCH 03/23] disable other unit test flow temporarily --- .github/workflows/unit_test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml index d329901675..0a00ff99ae 100644 --- a/.github/workflows/unit_test.yml +++ b/.github/workflows/unit_test.yml @@ -11,6 +11,7 @@ on: branches-ignore: - main - release + - test-for-building permissions: contents: read From 3156ac71ed923796f0b1a40c6a6da2d0da132004 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 18 Oct 2023 16:59:28 -0400 Subject: [PATCH 04/23] disable other runs on push (temp) and use steps for uses invokation --- .github/workflows/build_amplify_swift.yml | 1 + .github/workflows/fortify_scan.yml | 1 + .github/workflows/unit_test_split_flow.yml | 63 +++++++++++----------- 3 files changed, 35 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build_amplify_swift.yml b/.github/workflows/build_amplify_swift.yml index 35ed0b77f3..df079678f1 100644 --- a/.github/workflows/build_amplify_swift.yml +++ b/.github/workflows/build_amplify_swift.yml @@ -10,6 +10,7 @@ on: branches-ignore: - main - release + - test-for-building permissions: contents: read diff --git a/.github/workflows/fortify_scan.yml b/.github/workflows/fortify_scan.yml index c601d1f92f..86cce81580 100644 --- a/.github/workflows/fortify_scan.yml +++ b/.github/workflows/fortify_scan.yml @@ -11,6 +11,7 @@ on: branches-ignore: - main - release + - test-for-building permissions: id-token: write diff --git a/.github/workflows/unit_test_split_flow.yml b/.github/workflows/unit_test_split_flow.yml index 770aec6ccd..08ef71eb0d 100644 --- a/.github/workflows/unit_test_split_flow.yml +++ b/.github/workflows/unit_test_split_flow.yml @@ -233,13 +233,14 @@ jobs: AWSS3StoragePlugin, CoreMLPredictionsPlugin ] - uses: ./.github/composite_actions/run_xcodebuild_test_without_building - with: - scheme: ${{ matrix.scheme }} - sdk: 'iphonesimulator' - destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4' - derived_data_path: ${{ github.workspace }}/Build - generate_coverage: true + steps: + - uses: ./.github/composite_actions/run_xcodebuild_test_without_building + with: + scheme: ${{ matrix.scheme }} + sdk: 'iphonesimulator' + destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4' + derived_data_path: ${{ github.workspace }}/Build + generate_coverage: true unit-tests-with-coverage-macos: name: ${{ matrix.scheme }} Unit Tests @@ -261,13 +262,14 @@ jobs: AWSS3StoragePlugin, CoreMLPredictionsPlugin ] - uses: ./.github/composite_actions/run_xcodebuild_test_without_building - with: - scheme: ${{ matrix.scheme }} - sdk: 'macosx' - destination: 'platform=macOS,arch=x86_64' - derived_data_path: ${{ github.workspace }}/Build - generate_coverage: true + steps: + - uses: ./.github/composite_actions/run_xcodebuild_test_without_building + with: + scheme: ${{ matrix.scheme }} + sdk: 'macosx' + destination: 'platform=macOS,arch=x86_64' + derived_data_path: ${{ github.workspace }}/Build + generate_coverage: true unit-tests-with-coverage-tvos: name: ${{ matrix.scheme }} Unit Tests @@ -289,13 +291,14 @@ jobs: AWSS3StoragePlugin, CoreMLPredictionsPlugin ] - uses: ./.github/composite_actions/run_xcodebuild_test_without_building - with: - scheme: ${{ matrix.scheme }} - sdk: 'appletvsimulator' - destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4' - derived_data_path: ${{ github.workspace }}/Build - generate_coverage: true + steps: + - uses: ./.github/composite_actions/run_xcodebuild_test_without_building + with: + scheme: ${{ matrix.scheme }} + sdk: 'appletvsimulator' + destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4' + derived_data_path: ${{ github.workspace }}/Build + generate_coverage: true unit-tests-with-coverage-watchos: name: ${{ matrix.scheme }} Unit Tests @@ -317,13 +320,14 @@ jobs: AWSS3StoragePlugin, CoreMLPredictionsPlugin ] - uses: ./.github/composite_actions/run_xcodebuild_test_without_building - with: - scheme: ${{ matrix.scheme }} - sdk: 'watchsimulator' - destination: 'platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4' - derived_data_path: ${{ github.workspace }}/Build - generate_coverage: true + steps: + - uses: ./.github/composite_actions/run_xcodebuild_test_without_building + with: + scheme: ${{ matrix.scheme }} + sdk: 'watchsimulator' + destination: 'platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4' + derived_data_path: ${{ github.workspace }}/Build + generate_coverage: true report-coverage: name: ${{ matrix.file.scheme }} Coverage Report @@ -363,8 +367,7 @@ jobs: unit-tests-with-coverage-ios, unit-tests-with-coverage-macos, unit-tests-with-coverage-watchos, - unit-tests-with-coverage-tvos, - unit-tests-without-coverage + unit-tests-with-coverage-tvos ] env: EXIT_CODE: ${{ contains(needs.*.result, 'failure') && 1 || 0 }} From 714760d6362ab7c036fa2770ac7c61062305d06e Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 18 Oct 2023 17:01:03 -0400 Subject: [PATCH 05/23] add runs-on --- .github/workflows/unit_test_split_flow.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/unit_test_split_flow.yml b/.github/workflows/unit_test_split_flow.yml index 08ef71eb0d..2a7c257386 100644 --- a/.github/workflows/unit_test_split_flow.yml +++ b/.github/workflows/unit_test_split_flow.yml @@ -214,6 +214,7 @@ jobs: disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }} unit-tests-with-coverage-ios: + runs-on: macos-13 name: ${{ matrix.scheme }} Unit Tests needs: build-for-testing-ios strategy: @@ -243,6 +244,7 @@ jobs: generate_coverage: true unit-tests-with-coverage-macos: + runs-on: macos-13 name: ${{ matrix.scheme }} Unit Tests needs: build-for-testing-macos strategy: @@ -272,6 +274,7 @@ jobs: generate_coverage: true unit-tests-with-coverage-tvos: + runs-on: macos-13 name: ${{ matrix.scheme }} Unit Tests needs: build-for-testing-tvos strategy: @@ -301,6 +304,7 @@ jobs: generate_coverage: true unit-tests-with-coverage-watchos: + runs-on: macos-13 name: ${{ matrix.scheme }} Unit Tests needs: build-for-testing-watchos strategy: From 7a3335ab18baf5bc47c8b475315099024972c0ad Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 18 Oct 2023 17:11:56 -0400 Subject: [PATCH 06/23] remove extra command that was hanging around --- .../run_xcodebuild_build_for_testing/action.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml b/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml index 86212d7dae..fe3b39552c 100644 --- a/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml +++ b/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml @@ -50,6 +50,3 @@ runs: xcodebuild -version xcodebuild build-for-testing -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' $clonedSourcePackagesPath -derivedDataPath '${{ inputs.derived_data_path }}' | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} shell: bash - - - xcodebuild build-for-testing -scheme AWSAPIPlugin -sdk 'iphonesimulator' -destination 'platform=iOS Simulator,name=iPhone 14,OS=16.4' -derivedDataPath 'Build' From 94a14ed256200d33f6edd1bc8d04371f08017a6d Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 18 Oct 2023 17:25:29 -0400 Subject: [PATCH 07/23] add checkout step --- .github/workflows/unit_test_split_flow.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/unit_test_split_flow.yml b/.github/workflows/unit_test_split_flow.yml index 2a7c257386..9849403e95 100644 --- a/.github/workflows/unit_test_split_flow.yml +++ b/.github/workflows/unit_test_split_flow.yml @@ -235,6 +235,9 @@ jobs: CoreMLPredictionsPlugin ] steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + with: + persist-credentials: false - uses: ./.github/composite_actions/run_xcodebuild_test_without_building with: scheme: ${{ matrix.scheme }} @@ -265,6 +268,9 @@ jobs: CoreMLPredictionsPlugin ] steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + with: + persist-credentials: false - uses: ./.github/composite_actions/run_xcodebuild_test_without_building with: scheme: ${{ matrix.scheme }} @@ -295,6 +301,9 @@ jobs: CoreMLPredictionsPlugin ] steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + with: + persist-credentials: false - uses: ./.github/composite_actions/run_xcodebuild_test_without_building with: scheme: ${{ matrix.scheme }} @@ -325,6 +334,9 @@ jobs: CoreMLPredictionsPlugin ] steps: + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + with: + persist-credentials: false - uses: ./.github/composite_actions/run_xcodebuild_test_without_building with: scheme: ${{ matrix.scheme }} From 1a66beb73205d633298daa4d55a46a1dd11d3a9a Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 18 Oct 2023 18:20:42 -0400 Subject: [PATCH 08/23] input -> inputs typo --- .../run_xcodebuild_test_without_building/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml index 06160aec9c..1e44e0e65e 100644 --- a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml +++ b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml @@ -24,7 +24,7 @@ runs: - name: Test ${{ inputs.scheme }} env: SCHEME: ${{ inputs.scheme }} - SDK: ${{ input.sdk }} + SDK: ${{ inputs.sdk }} DESTINATION: ${{ inputs.destination }} DERIVED_DATA_PATH: ${{ inputs.derived_data_path }} run: | From 3d64355145d4970d3f7de129728a1cd0b9dd7e8a Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 18 Oct 2023 18:48:57 -0400 Subject: [PATCH 09/23] tweak xcodebuild input and run only ios for now --- .../action.yml | 12 +- .github/workflows/unit_test_split_flow.yml | 490 +++++++++--------- 2 files changed, 246 insertions(+), 256 deletions(-) diff --git a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml index 1e44e0e65e..8650b5c9e1 100644 --- a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml +++ b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml @@ -30,23 +30,13 @@ runs: run: | sudo xcode-select -s /Applications/Xcode_14.3.app - derivedDataPath="" - if [ ! -z "$DERIVED_DATA_PATH" ]; then - echo "Using custom DerivedData path" - derivedDataPath+="-derivedDataPath $DERIVED_DATA_PATH" - fi - coverageFlags="" if [ "${{ inputs.generate_coverage }}" == "true" ]; then echo "Code Coverage is enabled!" coverageFlags+="-enableCodeCoverage YES" - - if [ -z "$derivedDataPath" ]; then - derivedDataPath+="-derivedDataPath Build/" - fi fi xcode-select -p xcodebuild -version - xcodebuild test-without-building -scheme $SCHEME -sdk $SDK -destination $DESTINATION $derivedDataPath $coverageFlags | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + xcodebuild test-without-building -scheme $SCHEME -sdk $SDK -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -enableCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} shell: bash diff --git a/.github/workflows/unit_test_split_flow.yml b/.github/workflows/unit_test_split_flow.yml index 9849403e95..f96200c4a2 100644 --- a/.github/workflows/unit_test_split_flow.yml +++ b/.github/workflows/unit_test_split_flow.yml @@ -69,149 +69,149 @@ jobs: derived_data_path: ${{ github.workspace }}/Build disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }} - build-for-testing-macos: - name: Amplify-Package build for testing - macOS - runs-on: macos-13 - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 - with: - persist-credentials: false - - name: Attempt to restore dependencies cache - id: cache-packages - timeout-minutes: 4 - continue-on-error: true - uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: ~/Library/Developer/Xcode/DerivedData/Amplify - key: amplify-packages-${{ hashFiles('Package.resolved') }} - restore-keys: | - amplify-packages- - - name: Attempt to restore the build cache for this SHA - id: restore-build - timeout-minutes: 4 - continue-on-error: true - uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: ${{ github.workspace }}/Build - key: ${{ env.SCHEME }}-macOS-build-${{ github.sha }} - restore-keys: | - ${{ env.SCHEME }}-macOS-build- - - name: Attempt to restore the build cache from main - if: steps.restore-build.outputs.cache-hit != 'true' - id: restore-main-build - timeout-minutes: 4 - continue-on-error: true - uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: ${{ github.workspace }}/Build - key: ${{ env.SCHEME }}-macOS-latest-build-main - - name: Build for Testing macOS - id: build-for-testing-amplify-package-macOS - continue-on-error: false - uses: ./.github/composite_actions/run_xcodebuild_build_for_testing - with: - scheme: 'Amplify-Package' - sdk: 'macosx' - destination: 'platform=macOS,arch=x86_64' - cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify - derived_data_path: ${{ github.workspace }}/Build - disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }} + # build-for-testing-macos: + # name: Amplify-Package build for testing - macOS + # runs-on: macos-13 + # steps: + # - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + # with: + # persist-credentials: false + # - name: Attempt to restore dependencies cache + # id: cache-packages + # timeout-minutes: 4 + # continue-on-error: true + # uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + # with: + # path: ~/Library/Developer/Xcode/DerivedData/Amplify + # key: amplify-packages-${{ hashFiles('Package.resolved') }} + # restore-keys: | + # amplify-packages- + # - name: Attempt to restore the build cache for this SHA + # id: restore-build + # timeout-minutes: 4 + # continue-on-error: true + # uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + # with: + # path: ${{ github.workspace }}/Build + # key: ${{ env.SCHEME }}-macOS-build-${{ github.sha }} + # restore-keys: | + # ${{ env.SCHEME }}-macOS-build- + # - name: Attempt to restore the build cache from main + # if: steps.restore-build.outputs.cache-hit != 'true' + # id: restore-main-build + # timeout-minutes: 4 + # continue-on-error: true + # uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + # with: + # path: ${{ github.workspace }}/Build + # key: ${{ env.SCHEME }}-macOS-latest-build-main + # - name: Build for Testing macOS + # id: build-for-testing-amplify-package-macOS + # continue-on-error: false + # uses: ./.github/composite_actions/run_xcodebuild_build_for_testing + # with: + # scheme: 'Amplify-Package' + # sdk: 'macosx' + # destination: 'platform=macOS,arch=x86_64' + # cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify + # derived_data_path: ${{ github.workspace }}/Build + # disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }} - build-for-testing-tvos: - name: Amplify-Package build for testing - tvOS - runs-on: macos-13 - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 - with: - persist-credentials: false - - name: Attempt to restore dependencies cache - id: cache-packages - timeout-minutes: 4 - continue-on-error: true - uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: ~/Library/Developer/Xcode/DerivedData/Amplify - key: amplify-packages-${{ hashFiles('Package.resolved') }} - restore-keys: | - amplify-packages- - - name: Attempt to restore the build cache for this SHA - id: restore-build - timeout-minutes: 4 - continue-on-error: true - uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: ${{ github.workspace }}/Build - key: ${{ env.SCHEME }}-tvOS-build-${{ github.sha }} - restore-keys: | - ${{ env.SCHEME }}-tvOS-build- - - name: Attempt to restore the build cache from main - if: steps.restore-build.outputs.cache-hit != 'true' - id: restore-main-build - timeout-minutes: 4 - continue-on-error: true - uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: ${{ github.workspace }}/Build - key: ${{ env.SCHEME }}-tvOS-latest-build-main - - name: Build for Testing tvOS - id: build-for-testing-amplify-package-tvOS - continue-on-error: false - uses: ./.github/composite_actions/run_xcodebuild_build_for_testing - with: - scheme: 'Amplify-Package' - sdk: 'appletvsimulator' - destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4' - cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify - derived_data_path: ${{ github.workspace }}/Build - disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }} + # build-for-testing-tvos: + # name: Amplify-Package build for testing - tvOS + # runs-on: macos-13 + # steps: + # - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + # with: + # persist-credentials: false + # - name: Attempt to restore dependencies cache + # id: cache-packages + # timeout-minutes: 4 + # continue-on-error: true + # uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + # with: + # path: ~/Library/Developer/Xcode/DerivedData/Amplify + # key: amplify-packages-${{ hashFiles('Package.resolved') }} + # restore-keys: | + # amplify-packages- + # - name: Attempt to restore the build cache for this SHA + # id: restore-build + # timeout-minutes: 4 + # continue-on-error: true + # uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + # with: + # path: ${{ github.workspace }}/Build + # key: ${{ env.SCHEME }}-tvOS-build-${{ github.sha }} + # restore-keys: | + # ${{ env.SCHEME }}-tvOS-build- + # - name: Attempt to restore the build cache from main + # if: steps.restore-build.outputs.cache-hit != 'true' + # id: restore-main-build + # timeout-minutes: 4 + # continue-on-error: true + # uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + # with: + # path: ${{ github.workspace }}/Build + # key: ${{ env.SCHEME }}-tvOS-latest-build-main + # - name: Build for Testing tvOS + # id: build-for-testing-amplify-package-tvOS + # continue-on-error: false + # uses: ./.github/composite_actions/run_xcodebuild_build_for_testing + # with: + # scheme: 'Amplify-Package' + # sdk: 'appletvsimulator' + # destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4' + # cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify + # derived_data_path: ${{ github.workspace }}/Build + # disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }} - build-for-testing-watchos: - name: Amplify-Package build for testing - watchOS - runs-on: macos-13 - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 - with: - persist-credentials: false - - name: Attempt to restore dependencies cache - id: cache-packages - timeout-minutes: 4 - continue-on-error: true - uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: ~/Library/Developer/Xcode/DerivedData/Amplify - key: amplify-packages-${{ hashFiles('Package.resolved') }} - restore-keys: | - amplify-packages- - - name: Attempt to restore the build cache for this SHA - id: restore-build - timeout-minutes: 4 - continue-on-error: true - uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: ${{ github.workspace }}/Build - key: ${{ env.SCHEME }}-watchOS-build-${{ github.sha }} - restore-keys: | - ${{ env.SCHEME }}-watchOS-build- - - name: Attempt to restore the build cache from main - if: steps.restore-build.outputs.cache-hit != 'true' - id: restore-main-build - timeout-minutes: 4 - continue-on-error: true - uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: ${{ github.workspace }}/Build - key: ${{ env.SCHEME }}-watchOS-latest-build-main - - name: Build for Testing watchOS - id: build-for-testing-amplify-package-watchOS - continue-on-error: false - uses: ./.github/composite_actions/run_xcodebuild_build_for_testing - with: - scheme: 'Amplify-Package' - sdk: 'watchsimulator' - destination: 'platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4' - cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify - derived_data_path: ${{ github.workspace }}/Build - disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }} + # build-for-testing-watchos: + # name: Amplify-Package build for testing - watchOS + # runs-on: macos-13 + # steps: + # - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + # with: + # persist-credentials: false + # - name: Attempt to restore dependencies cache + # id: cache-packages + # timeout-minutes: 4 + # continue-on-error: true + # uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + # with: + # path: ~/Library/Developer/Xcode/DerivedData/Amplify + # key: amplify-packages-${{ hashFiles('Package.resolved') }} + # restore-keys: | + # amplify-packages- + # - name: Attempt to restore the build cache for this SHA + # id: restore-build + # timeout-minutes: 4 + # continue-on-error: true + # uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + # with: + # path: ${{ github.workspace }}/Build + # key: ${{ env.SCHEME }}-watchOS-build-${{ github.sha }} + # restore-keys: | + # ${{ env.SCHEME }}-watchOS-build- + # - name: Attempt to restore the build cache from main + # if: steps.restore-build.outputs.cache-hit != 'true' + # id: restore-main-build + # timeout-minutes: 4 + # continue-on-error: true + # uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + # with: + # path: ${{ github.workspace }}/Build + # key: ${{ env.SCHEME }}-watchOS-latest-build-main + # - name: Build for Testing watchOS + # id: build-for-testing-amplify-package-watchOS + # continue-on-error: false + # uses: ./.github/composite_actions/run_xcodebuild_build_for_testing + # with: + # scheme: 'Amplify-Package' + # sdk: 'watchsimulator' + # destination: 'platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4' + # cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify + # derived_data_path: ${{ github.workspace }}/Build + # disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }} unit-tests-with-coverage-ios: runs-on: macos-13 @@ -246,112 +246,112 @@ jobs: derived_data_path: ${{ github.workspace }}/Build generate_coverage: true - unit-tests-with-coverage-macos: - runs-on: macos-13 - name: ${{ matrix.scheme }} Unit Tests - needs: build-for-testing-macos - strategy: - fail-fast: false - matrix: - scheme: [ - Amplify, - AWSPluginsCore, - AWSAPIPlugin, - AWSCloudWatchLoggingPlugin, - AWSCognitoAuthPlugin, - AWSDataStorePlugin, - AWSLocationGeoPlugin, - AWSPredictionsPlugin, - AWSPinpointAnalyticsPlugin, - AWSPinpointPushNotificationsPlugin, - AWSS3StoragePlugin, - CoreMLPredictionsPlugin - ] - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 - with: - persist-credentials: false - - uses: ./.github/composite_actions/run_xcodebuild_test_without_building - with: - scheme: ${{ matrix.scheme }} - sdk: 'macosx' - destination: 'platform=macOS,arch=x86_64' - derived_data_path: ${{ github.workspace }}/Build - generate_coverage: true + # unit-tests-with-coverage-macos: + # runs-on: macos-13 + # name: ${{ matrix.scheme }} Unit Tests + # needs: build-for-testing-macos + # strategy: + # fail-fast: false + # matrix: + # scheme: [ + # Amplify, + # AWSPluginsCore, + # AWSAPIPlugin, + # AWSCloudWatchLoggingPlugin, + # AWSCognitoAuthPlugin, + # AWSDataStorePlugin, + # AWSLocationGeoPlugin, + # AWSPredictionsPlugin, + # AWSPinpointAnalyticsPlugin, + # AWSPinpointPushNotificationsPlugin, + # AWSS3StoragePlugin, + # CoreMLPredictionsPlugin + # ] + # steps: + # - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + # with: + # persist-credentials: false + # - uses: ./.github/composite_actions/run_xcodebuild_test_without_building + # with: + # scheme: ${{ matrix.scheme }} + # sdk: 'macosx' + # destination: 'platform=macOS,arch=x86_64' + # derived_data_path: ${{ github.workspace }}/Build + # generate_coverage: true - unit-tests-with-coverage-tvos: - runs-on: macos-13 - name: ${{ matrix.scheme }} Unit Tests - needs: build-for-testing-tvos - strategy: - fail-fast: false - matrix: - scheme: [ - Amplify, - AWSPluginsCore, - AWSAPIPlugin, - AWSCloudWatchLoggingPlugin, - AWSCognitoAuthPlugin, - AWSDataStorePlugin, - AWSLocationGeoPlugin, - AWSPredictionsPlugin, - AWSPinpointAnalyticsPlugin, - AWSPinpointPushNotificationsPlugin, - AWSS3StoragePlugin, - CoreMLPredictionsPlugin - ] - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 - with: - persist-credentials: false - - uses: ./.github/composite_actions/run_xcodebuild_test_without_building - with: - scheme: ${{ matrix.scheme }} - sdk: 'appletvsimulator' - destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4' - derived_data_path: ${{ github.workspace }}/Build - generate_coverage: true + # unit-tests-with-coverage-tvos: + # runs-on: macos-13 + # name: ${{ matrix.scheme }} Unit Tests + # needs: build-for-testing-tvos + # strategy: + # fail-fast: false + # matrix: + # scheme: [ + # Amplify, + # AWSPluginsCore, + # AWSAPIPlugin, + # AWSCloudWatchLoggingPlugin, + # AWSCognitoAuthPlugin, + # AWSDataStorePlugin, + # AWSLocationGeoPlugin, + # AWSPredictionsPlugin, + # AWSPinpointAnalyticsPlugin, + # AWSPinpointPushNotificationsPlugin, + # AWSS3StoragePlugin, + # CoreMLPredictionsPlugin + # ] + # steps: + # - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + # with: + # persist-credentials: false + # - uses: ./.github/composite_actions/run_xcodebuild_test_without_building + # with: + # scheme: ${{ matrix.scheme }} + # sdk: 'appletvsimulator' + # destination: 'platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4' + # derived_data_path: ${{ github.workspace }}/Build + # generate_coverage: true - unit-tests-with-coverage-watchos: - runs-on: macos-13 - name: ${{ matrix.scheme }} Unit Tests - needs: build-for-testing-watchos - strategy: - fail-fast: false - matrix: - scheme: [ - Amplify, - AWSPluginsCore, - AWSAPIPlugin, - AWSCloudWatchLoggingPlugin, - AWSCognitoAuthPlugin, - AWSDataStorePlugin, - AWSLocationGeoPlugin, - AWSPredictionsPlugin, - AWSPinpointAnalyticsPlugin, - AWSPinpointPushNotificationsPlugin, - AWSS3StoragePlugin, - CoreMLPredictionsPlugin - ] - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 - with: - persist-credentials: false - - uses: ./.github/composite_actions/run_xcodebuild_test_without_building - with: - scheme: ${{ matrix.scheme }} - sdk: 'watchsimulator' - destination: 'platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4' - derived_data_path: ${{ github.workspace }}/Build - generate_coverage: true + # unit-tests-with-coverage-watchos: + # runs-on: macos-13 + # name: ${{ matrix.scheme }} Unit Tests + # needs: build-for-testing-watchos + # strategy: + # fail-fast: false + # matrix: + # scheme: [ + # Amplify, + # AWSPluginsCore, + # AWSAPIPlugin, + # AWSCloudWatchLoggingPlugin, + # AWSCognitoAuthPlugin, + # AWSDataStorePlugin, + # AWSLocationGeoPlugin, + # AWSPredictionsPlugin, + # AWSPinpointAnalyticsPlugin, + # AWSPinpointPushNotificationsPlugin, + # AWSS3StoragePlugin, + # CoreMLPredictionsPlugin + # ] + # steps: + # - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 + # with: + # persist-credentials: false + # - uses: ./.github/composite_actions/run_xcodebuild_test_without_building + # with: + # scheme: ${{ matrix.scheme }} + # sdk: 'watchsimulator' + # destination: 'platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4' + # derived_data_path: ${{ github.workspace }}/Build + # generate_coverage: true report-coverage: name: ${{ matrix.file.scheme }} Coverage Report needs: [ - unit-tests-with-coverage-ios, - unit-tests-with-coverage-macos, - unit-tests-with-coverage-tvos, - unit-tests-with-coverage-watchos + unit-tests-with-coverage-ios + # unit-tests-with-coverage-macos, + # unit-tests-with-coverage-tvos, + # unit-tests-with-coverage-watchos ] strategy: fail-fast: false @@ -380,10 +380,10 @@ jobs: name: Confirm Passing Unit Tests if: ${{ !cancelled() }} needs: [ - unit-tests-with-coverage-ios, - unit-tests-with-coverage-macos, - unit-tests-with-coverage-watchos, - unit-tests-with-coverage-tvos + unit-tests-with-coverage-ios + # unit-tests-with-coverage-macos, + # unit-tests-with-coverage-watchos, + # unit-tests-with-coverage-tvos ] env: EXIT_CODE: ${{ contains(needs.*.result, 'failure') && 1 || 0 }} From 016916fddf92efc26b2c84e0d0d0f1a06453dcd3 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 18 Oct 2023 19:33:46 -0400 Subject: [PATCH 10/23] remove derivedData path from build-without-testing --- .../run_xcodebuild_test_without_building/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml index 8650b5c9e1..1ae0bf6424 100644 --- a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml +++ b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml @@ -38,5 +38,5 @@ runs: xcode-select -p xcodebuild -version - xcodebuild test-without-building -scheme $SCHEME -sdk $SDK -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -enableCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + xcodebuild test-without-building -scheme $SCHEME -sdk $SDK -destination $DESTINATION -enableCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} shell: bash From ba3a7200466c3b2eedaebe6fe7b848da68f58bd1 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 18 Oct 2023 19:54:16 -0400 Subject: [PATCH 11/23] try remove derivedData path from build-for-testing job --- .../run_xcodebuild_build_for_testing/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml b/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml index fe3b39552c..92a0389e59 100644 --- a/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml +++ b/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml @@ -48,5 +48,5 @@ runs: xcode-select -p xcodebuild -version - xcodebuild build-for-testing -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' $clonedSourcePackagesPath -derivedDataPath '${{ inputs.derived_data_path }}' | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + xcodebuild build-for-testing -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' $clonedSourcePackagesPath | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} shell: bash From 4f87a049e639250ae78e10ed349590b1af488125 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 18 Oct 2023 21:35:22 -0400 Subject: [PATCH 12/23] pull cache before test-without-building --- .../action.yml | 2 +- .../action.yml | 9 +------ .github/workflows/unit_test_split_flow.yml | 27 ++++++++++++++++--- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml b/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml index 92a0389e59..2d27c9c38d 100644 --- a/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml +++ b/.github/composite_actions/run_xcodebuild_build_for_testing/action.yml @@ -48,5 +48,5 @@ runs: xcode-select -p xcodebuild -version - xcodebuild build-for-testing -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' $clonedSourcePackagesPath | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + xcodebuild build-for-testing -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' -derivedDataPath $DERIVED_DATA_PATH $clonedSourcePackagesPath | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} shell: bash diff --git a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml index 1ae0bf6424..2d8e62d5dc 100644 --- a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml +++ b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml @@ -29,14 +29,7 @@ runs: DERIVED_DATA_PATH: ${{ inputs.derived_data_path }} run: | sudo xcode-select -s /Applications/Xcode_14.3.app - - coverageFlags="" - if [ "${{ inputs.generate_coverage }}" == "true" ]; then - echo "Code Coverage is enabled!" - coverageFlags+="-enableCodeCoverage YES" - fi - xcode-select -p xcodebuild -version - xcodebuild test-without-building -scheme $SCHEME -sdk $SDK -destination $DESTINATION -enableCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + xcodebuild test-without-building -scheme $SCHEME -sdk $SDK -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -enableCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} shell: bash diff --git a/.github/workflows/unit_test_split_flow.yml b/.github/workflows/unit_test_split_flow.yml index f96200c4a2..d3c965dab8 100644 --- a/.github/workflows/unit_test_split_flow.yml +++ b/.github/workflows/unit_test_split_flow.yml @@ -21,8 +21,8 @@ concurrency: cancel-in-progress: ${{ github.ref_name != 'main'}} jobs: - build-for-testing-ios: - name: Amplify-Package build for testing - iOS + test-ios: + name: Unit Test iOS runs-on: macos-13 steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 @@ -68,6 +68,11 @@ jobs: cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify derived_data_path: ${{ github.workspace }}/Build disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }} + - name: cache build directory + uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ${{ github.workspace }}/Build + key: ${{ env.SCHEME }}-iOS-build-${{ github.sha }} # build-for-testing-macos: # name: Amplify-Package build for testing - macOS @@ -238,13 +243,29 @@ jobs: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 with: persist-credentials: false - - uses: ./.github/composite_actions/run_xcodebuild_test_without_building + - name: Restore build for test-without-build + id: restore-build + timeout-minutes: 2 + uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: ${{ github.workspace }}/Build + key: ${{ env.SCHEME }}-iOS-build-${{ github.sha }} + restore-keys: | + ${{ env.SCHEME }}-iOS-build- + - name: test-without-building iOS + uses: ./.github/composite_actions/run_xcodebuild_test_without_building with: scheme: ${{ matrix.scheme }} sdk: 'iphonesimulator' destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4' derived_data_path: ${{ github.workspace }}/Build generate_coverage: true + - name: Delete the build cache + env: + GH_TOKEN: ${{ github.token }} + continue-on-error: true + run: | + gh cache delete ${{ steps.restore-build.outputs.cache-matched-key }} # unit-tests-with-coverage-macos: # runs-on: macos-13 From 52b5d6b5acc09df76e3baf3f8f1d1832fed7189f Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 18 Oct 2023 21:39:18 -0400 Subject: [PATCH 13/23] fix build-for-testing job name --- .github/workflows/unit_test_split_flow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit_test_split_flow.yml b/.github/workflows/unit_test_split_flow.yml index d3c965dab8..3ec7ace68c 100644 --- a/.github/workflows/unit_test_split_flow.yml +++ b/.github/workflows/unit_test_split_flow.yml @@ -21,7 +21,7 @@ concurrency: cancel-in-progress: ${{ github.ref_name != 'main'}} jobs: - test-ios: + build-for-testing-ios: name: Unit Test iOS runs-on: macos-13 steps: From 486d1545606483c1d41aa9674ae98896e255e05a Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Wed, 18 Oct 2023 22:50:41 -0400 Subject: [PATCH 14/23] disable automatic package resolution on test-without-building --- .../run_xcodebuild_test_without_building/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml index 2d8e62d5dc..2a3ca8a84e 100644 --- a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml +++ b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml @@ -29,7 +29,8 @@ runs: DERIVED_DATA_PATH: ${{ inputs.derived_data_path }} run: | sudo xcode-select -s /Applications/Xcode_14.3.app + xcode-select -p xcodebuild -version - xcodebuild test-without-building -scheme $SCHEME -sdk $SDK -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -enableCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + xcodebuild test-without-building -scheme $SCHEME -sdk $SDK -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -clonedSourcePackagesDirPath '~/Library/Developer/Xcode/DerivedData/Amplify' -disableAutomaticPackageResolution -enableCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} shell: bash From abc9efa9a4653f1fa5ff20b2f5b6ef10ac57a15f Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Thu, 19 Oct 2023 13:34:04 -0400 Subject: [PATCH 15/23] remove extra cache restores and drop scheme from key to isolate --- .github/workflows/unit_test_split_flow.yml | 44 +++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.github/workflows/unit_test_split_flow.yml b/.github/workflows/unit_test_split_flow.yml index 3ec7ace68c..2727fe01fe 100644 --- a/.github/workflows/unit_test_split_flow.yml +++ b/.github/workflows/unit_test_split_flow.yml @@ -38,25 +38,25 @@ jobs: key: amplify-packages-${{ hashFiles('Package.resolved') }} restore-keys: | amplify-packages- - - name: Attempt to restore the build cache for this SHA - id: restore-build - timeout-minutes: 4 - continue-on-error: true - uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: ${{ github.workspace }}/Build - key: ${{ env.SCHEME }}-iOS-build-${{ github.sha }} - restore-keys: | - ${{ env.SCHEME }}-iOS-build- - - name: Attempt to restore the build cache from main - if: steps.restore-build.outputs.cache-hit != 'true' - id: restore-main-build - timeout-minutes: 4 - continue-on-error: true - uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 - with: - path: ${{ github.workspace }}/Build - key: ${{ env.SCHEME }}-iOS-latest-build-main + # - name: Attempt to restore the build cache for this SHA + # id: restore-build + # timeout-minutes: 4 + # continue-on-error: true + # uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + # with: + # path: ${{ github.workspace }}/Build + # key: ${{ env.SCHEME }}-iOS-build-${{ github.sha }} + # restore-keys: | + # ${{ env.SCHEME }}-iOS-build- + # - name: Attempt to restore the build cache from main + # if: steps.restore-build.outputs.cache-hit != 'true' + # id: restore-main-build + # timeout-minutes: 4 + # continue-on-error: true + # uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + # with: + # path: ${{ github.workspace }}/Build + # key: ${{ env.SCHEME }}-iOS-latest-build-main - name: Build for Testing iOS id: build-for-testing-amplify-package-ios continue-on-error: false @@ -72,7 +72,7 @@ jobs: uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 with: path: ${{ github.workspace }}/Build - key: ${{ env.SCHEME }}-iOS-build-${{ github.sha }} + key: iOS-build-${{ github.sha }} # build-for-testing-macos: # name: Amplify-Package build for testing - macOS @@ -249,9 +249,9 @@ jobs: uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 with: path: ${{ github.workspace }}/Build - key: ${{ env.SCHEME }}-iOS-build-${{ github.sha }} + key: iOS-build-${{ github.sha }} restore-keys: | - ${{ env.SCHEME }}-iOS-build- + iOS-build- - name: test-without-building iOS uses: ./.github/composite_actions/run_xcodebuild_test_without_building with: From ca15a93ba72f03740229ab95b09d3c8341deb50a Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Thu, 19 Oct 2023 13:55:34 -0400 Subject: [PATCH 16/23] disable code coverage from test-without-building --- .../run_xcodebuild_test_without_building/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml index 2a3ca8a84e..806bed9fff 100644 --- a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml +++ b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml @@ -32,5 +32,5 @@ runs: xcode-select -p xcodebuild -version - xcodebuild test-without-building -scheme $SCHEME -sdk $SDK -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -clonedSourcePackagesDirPath '~/Library/Developer/Xcode/DerivedData/Amplify' -disableAutomaticPackageResolution -enableCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + xcodebuild test-without-building -scheme $SCHEME -sdk $SDK -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -clonedSourcePackagesDirPath '~/Library/Developer/Xcode/DerivedData/Amplify' -disableAutomaticPackageResolution | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} shell: bash From c59f344b16705e176439a72a091d759b04ed12b0 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Thu, 19 Oct 2023 15:09:49 -0400 Subject: [PATCH 17/23] remove restore-key from cache retrieval --- .../run_xcodebuild_test_without_building/action.yml | 2 +- .github/workflows/unit_test_split_flow.yml | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml index 806bed9fff..8db64a494d 100644 --- a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml +++ b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml @@ -32,5 +32,5 @@ runs: xcode-select -p xcodebuild -version - xcodebuild test-without-building -scheme $SCHEME -sdk $SDK -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -clonedSourcePackagesDirPath '~/Library/Developer/Xcode/DerivedData/Amplify' -disableAutomaticPackageResolution | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + xcodebuild test-without-building -scheme '$SCHEME' -sdk '$SDK' -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -clonedSourcePackagesDirPath '~/Library/Developer/Xcode/DerivedData/Amplify' -disableAutomaticPackageResolution -enabledCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} shell: bash diff --git a/.github/workflows/unit_test_split_flow.yml b/.github/workflows/unit_test_split_flow.yml index 2727fe01fe..9e77f77d1e 100644 --- a/.github/workflows/unit_test_split_flow.yml +++ b/.github/workflows/unit_test_split_flow.yml @@ -250,8 +250,6 @@ jobs: with: path: ${{ github.workspace }}/Build key: iOS-build-${{ github.sha }} - restore-keys: | - iOS-build- - name: test-without-building iOS uses: ./.github/composite_actions/run_xcodebuild_test_without_building with: From 4b28a58b89eb1152594cfdac98662136ed679729 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Thu, 19 Oct 2023 15:48:02 -0400 Subject: [PATCH 18/23] enable not enabled --- .../run_xcodebuild_test_without_building/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml index 8db64a494d..78ab14b250 100644 --- a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml +++ b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml @@ -32,5 +32,5 @@ runs: xcode-select -p xcodebuild -version - xcodebuild test-without-building -scheme '$SCHEME' -sdk '$SDK' -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -clonedSourcePackagesDirPath '~/Library/Developer/Xcode/DerivedData/Amplify' -disableAutomaticPackageResolution -enabledCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + xcodebuild test-without-building -scheme '$SCHEME' -sdk '$SDK' -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -clonedSourcePackagesDirPath '~/Library/Developer/Xcode/DerivedData/Amplify' -disableAutomaticPackageResolution -enableCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} shell: bash From 8b690ac06bfa67b7f37dde2f143efdf35edd9af2 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Thu, 19 Oct 2023 16:09:14 -0400 Subject: [PATCH 19/23] remove quotes around env vars --- .../run_xcodebuild_test_without_building/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml index 78ab14b250..b22d6bdce8 100644 --- a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml +++ b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml @@ -32,5 +32,5 @@ runs: xcode-select -p xcodebuild -version - xcodebuild test-without-building -scheme '$SCHEME' -sdk '$SDK' -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -clonedSourcePackagesDirPath '~/Library/Developer/Xcode/DerivedData/Amplify' -disableAutomaticPackageResolution -enableCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + xcodebuild test-without-building -scheme $SCHEME -sdk $SDK -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -clonedSourcePackagesDirPath '~/Library/Developer/Xcode/DerivedData/Amplify' -disableAutomaticPackageResolution -enableCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} shell: bash From 297fe256e0cb1d108d180f16f15d41aa962a0720 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Thu, 19 Oct 2023 21:21:21 -0400 Subject: [PATCH 20/23] test-without-building with xctestrun and -only-testing flag --- .../action.yml | 6 ++- .github/workflows/unit_test_split_flow.yml | 43 +++++++++++++------ 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml index b22d6bdce8..cde401e2ac 100644 --- a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml +++ b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml @@ -29,8 +29,10 @@ runs: DERIVED_DATA_PATH: ${{ inputs.derived_data_path }} run: | sudo xcode-select -s /Applications/Xcode_14.3.app - xcode-select -p xcodebuild -version - xcodebuild test-without-building -scheme $SCHEME -sdk $SDK -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -clonedSourcePackagesDirPath '~/Library/Developer/Xcode/DerivedData/Amplify' -disableAutomaticPackageResolution -enableCodeCoverage YES | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + ls Build/ + ls Build/Build/Products/ + + xcodebuild test-without-building -xctestrun $(find . type f -name "*.xctestrun") -sdk $SDK -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -clonedSourcePackagesDirPath '~/Library/Developer/Xcode/DerivedData/Amplify' -disableAutomaticPackageResolution -enableCodeCoverage YES -only-testing:$SCHEME | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} shell: bash diff --git a/.github/workflows/unit_test_split_flow.yml b/.github/workflows/unit_test_split_flow.yml index 9e77f77d1e..75f537ed69 100644 --- a/.github/workflows/unit_test_split_flow.yml +++ b/.github/workflows/unit_test_split_flow.yml @@ -22,7 +22,7 @@ concurrency: jobs: build-for-testing-ios: - name: Unit Test iOS + name: Build for Testing - iOS runs-on: macos-13 steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 @@ -71,7 +71,7 @@ jobs: - name: cache build directory uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 with: - path: ${{ github.workspace }}/Build + path: ${{ github.workspace }}/Build/Build/Products key: iOS-build-${{ github.sha }} # build-for-testing-macos: @@ -226,18 +226,33 @@ jobs: fail-fast: false matrix: scheme: [ - Amplify, - AWSPluginsCore, - AWSAPIPlugin, - AWSCloudWatchLoggingPlugin, - AWSCognitoAuthPlugin, - AWSDataStorePlugin, - AWSLocationGeoPlugin, - AWSPredictionsPlugin, - AWSPinpointAnalyticsPlugin, - AWSPinpointPushNotificationsPlugin, - AWSS3StoragePlugin, - CoreMLPredictionsPlugin + AWSAPIPluginTests, + AWSCloudWatchLoggingPluginTests, + AWSCognitoAuthPluginUnitTests, + AWSDataStoreCategoryPluginTests, + AWSLocationGeoPluginTests, + AWSPinpointAnalyticsPluginUnitTests, + AWSPinpointPushNotificationsPluginUnitTests, + AWSPluginsCoreTests, + AWSPredictionsPluginUnitTests, + AWSS3StoragePluginTests, + AmplifyAsyncTestingTests, + AmplifyBigIntegerTests, + AmplifyTests, + CoreMLPredictionsPluginUnitTests, + InternalAWSPinpointUnitTests + # Amplify, + # AWSPluginsCore, + # AWSAPIPlugin, + # AWSCloudWatchLoggingPlugin, + # AWSCognitoAuthPlugin, + # AWSDataStorePlugin, + # AWSLocationGeoPlugin, + # AWSPredictionsPlugin, + # AWSPinpointAnalyticsPlugin, + # AWSPinpointPushNotificationsPlugin, + # AWSS3StoragePlugin, + # CoreMLPredictionsPlugin ] steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3 From e456b99da2d3bbd2fa17dc42596d47240d8ef901 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Thu, 19 Oct 2023 21:46:18 -0400 Subject: [PATCH 21/23] remove ls --- .../run_xcodebuild_test_without_building/action.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml index cde401e2ac..36e380a925 100644 --- a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml +++ b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml @@ -31,8 +31,5 @@ runs: sudo xcode-select -s /Applications/Xcode_14.3.app xcode-select -p xcodebuild -version - ls Build/ - ls Build/Build/Products/ - xcodebuild test-without-building -xctestrun $(find . type f -name "*.xctestrun") -sdk $SDK -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -clonedSourcePackagesDirPath '~/Library/Developer/Xcode/DerivedData/Amplify' -disableAutomaticPackageResolution -enableCodeCoverage YES -only-testing:$SCHEME | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} shell: bash From ee9dd2fe72fb1643603a26714be754ad2c0ff297 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Thu, 19 Oct 2023 22:03:10 -0400 Subject: [PATCH 22/23] update restore path and specify only one target scheme --- .github/workflows/unit_test_split_flow.yml | 33 +++++++++++----------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/unit_test_split_flow.yml b/.github/workflows/unit_test_split_flow.yml index 75f537ed69..58ab6abfb4 100644 --- a/.github/workflows/unit_test_split_flow.yml +++ b/.github/workflows/unit_test_split_flow.yml @@ -226,21 +226,22 @@ jobs: fail-fast: false matrix: scheme: [ - AWSAPIPluginTests, - AWSCloudWatchLoggingPluginTests, - AWSCognitoAuthPluginUnitTests, - AWSDataStoreCategoryPluginTests, - AWSLocationGeoPluginTests, - AWSPinpointAnalyticsPluginUnitTests, - AWSPinpointPushNotificationsPluginUnitTests, - AWSPluginsCoreTests, - AWSPredictionsPluginUnitTests, - AWSS3StoragePluginTests, - AmplifyAsyncTestingTests, - AmplifyBigIntegerTests, - AmplifyTests, - CoreMLPredictionsPluginUnitTests, - InternalAWSPinpointUnitTests + AWSAPIPluginTests + # AWSCloudWatchLoggingPluginTests, + # AWSCognitoAuthPluginUnitTests, + # AWSDataStoreCategoryPluginTests, + # AWSLocationGeoPluginTests, + # AWSPinpointAnalyticsPluginUnitTests, + # AWSPinpointPushNotificationsPluginUnitTests, + # AWSPluginsCoreTests, + # AWSPredictionsPluginUnitTests, + # AWSS3StoragePluginTests, + # AmplifyAsyncTestingTests, + # AmplifyBigIntegerTests, + # AmplifyTests, + # CoreMLPredictionsPluginUnitTests, + # InternalAWSPinpointUnitTests + ## # Amplify, # AWSPluginsCore, # AWSAPIPlugin, @@ -263,7 +264,7 @@ jobs: timeout-minutes: 2 uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 with: - path: ${{ github.workspace }}/Build + path: ${{ github.workspace }}/Build/Build/Products key: iOS-build-${{ github.sha }} - name: test-without-building iOS uses: ./.github/composite_actions/run_xcodebuild_test_without_building From b82b6ad2e3bb60452e396fff1ec6c00b10685fa8 Mon Sep 17 00:00:00 2001 From: Ian Saultz <52051793+atierian@users.noreply.github.com> Date: Thu, 19 Oct 2023 22:19:47 -0400 Subject: [PATCH 23/23] find type flag --- .../run_xcodebuild_test_without_building/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml index 36e380a925..74e1d37c49 100644 --- a/.github/composite_actions/run_xcodebuild_test_without_building/action.yml +++ b/.github/composite_actions/run_xcodebuild_test_without_building/action.yml @@ -31,5 +31,5 @@ runs: sudo xcode-select -s /Applications/Xcode_14.3.app xcode-select -p xcodebuild -version - xcodebuild test-without-building -xctestrun $(find . type f -name "*.xctestrun") -sdk $SDK -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -clonedSourcePackagesDirPath '~/Library/Developer/Xcode/DerivedData/Amplify' -disableAutomaticPackageResolution -enableCodeCoverage YES -only-testing:$SCHEME | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} + xcodebuild test-without-building -xctestrun $(find . -type f -name "*.xctestrun") -sdk $SDK -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH -clonedSourcePackagesDirPath '~/Library/Developer/Xcode/DerivedData/Amplify' -disableAutomaticPackageResolution -enableCodeCoverage YES -only-testing:$SCHEME | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]} shell: bash