Skip to content

Commit

Permalink
chore: Adding caching and retries to Integration Tests workflows (#3339)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruisebas authored Nov 2, 2023
1 parent e122799 commit 2604241
Show file tree
Hide file tree
Showing 46 changed files with 697 additions and 2,663 deletions.
60 changes: 60 additions & 0 deletions .github/composite_actions/get_platform_parameters/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: 'Get the build parameters for a given platform'
inputs:
platform:
description: 'The name of the platform. Valid values are iOS, tvOS, watchOS and macOS'
required: true
type: string
xcode_version:
description: 'The version of Xcode. Valid values are 14.3 and 15.0'
required: true
type: string
outputs:
destination:
description: "The destination associated with the given platform and Xcode version"
value: ${{ steps.platform.outputs.destination }}
sdk:
description: "The SDK associated with the given platform"
value: ${{ steps.platform.outputs.sdk }}
runs:
using: "composite"
steps:
- id: platform
run: |
PLATFORM=${{ inputs.platform }}
case $PLATFORM in
iOS|tvOS|watchOS|macOS) ;;
*) echo "Unsupported platform: $PLATFORM"; exit 1 ;;
esac
XCODE_VERSION=${{ inputs.xcode_version }}
case $XCODE_VERSION in
14.3|15.0) ;;
*) echo "Unsupported Xcode version: $XCODE_VERSION"; exit 1 ;;
esac
DESTINATION_MAPPING='{
"14.3": {
"iOS": "platform=iOS Simulator,name=iPhone 14,OS=16.4",
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4",
"watchOS": "platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4",
"macOS": "platform=macOS,arch=x86_64"
},
"15.0": {
"iOS": "platform=iOS Simulator,name=iPhone 15,OS=latest",
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest",
"watchOS": "platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=latest",
"macOS": "platform=macOS,arch=x86_64"
}
}'
SDK_MAPPING='{
"iOS": "iphonesimulator",
"tvOS": "appletvsimulator",
"watchOS": "watchsimulator",
"macOS": "macosx"
}'
echo "destination=$(echo $DESTINATION_MAPPING | jq -r ."\"$XCODE_VERSION\"".$PLATFORM)" >> $GITHUB_OUTPUT
echo "sdk=$(echo $SDK_MAPPING | jq -r .$PLATFORM)" >> $GITHUB_OUTPUT
shell: bash

36 changes: 7 additions & 29 deletions .github/workflows/integ_test.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Integration Tests
on:
workflow_dispatch:
workflow_call:
inputs:
identifier:
required: true
type: string

push:
branches: [main]

Expand All @@ -19,53 +13,37 @@ concurrency:
cancel-in-progress: ${{ github.ref_name != 'main'}}

jobs:
prepare-for-test:
runs-on: macos-13
environment: IntegrationTest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false

- name: Verify copy resources
uses: ./.github/composite_actions/download_test_configuration
with:
resource_subfolder: NA
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws_region: ${{ secrets.AWS_REGION }}
aws_s3_bucket: ${{ secrets.AWS_S3_BUCKET_INTEG_V2 }}

analytics-test:
needs: prepare-for-test
name: Analytics Integration Tests
uses: ./.github/workflows/integ_test_analytics.yml
secrets: inherit

push-notifications-test:
needs: prepare-for-test
name: Push Notifications Integration Tests
uses: ./.github/workflows/integ_test_push_notifications.yml
secrets: inherit

predictions-test:
needs: prepare-for-test
name: Predictions Integration Tests
uses: ./.github/workflows/integ_test_predictions.yml
secrets: inherit

auth-test:
needs: prepare-for-test
name: Auth Integration Tests
uses: ./.github/workflows/integ_test_auth.yml
secrets: inherit

geo-test:
needs: prepare-for-test
name: Geo Integration Tests
uses: ./.github/workflows/integ_test_geo.yml
secrets: inherit

storage-test:
needs: prepare-for-test
name: Storage Integration Tests
uses: ./.github/workflows/integ_test_storage.yml
secrets: inherit

logging-test:
needs: prepare-for-test
name: Logging Integration Tests
uses: ./.github/workflows/integ_test_logging.yml
secrets: inherit
105 changes: 20 additions & 85 deletions .github/workflows/integ_test_analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,88 +24,23 @@ permissions:
contents: read

jobs:
analytics-integration-test-iOS:
if: ${{ github.event_name != 'workflow_dispatch' || inputs.ios }}
runs-on: macos-13
environment: IntegrationTest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false

- name: Make directory
run: mkdir -p ~/.aws-amplify/amplify-ios/testconfiguration/

- name: Copy integration test resouces
uses: ./.github/composite_actions/download_test_configuration
with:
resource_subfolder: analytics
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws_region: ${{ secrets.AWS_REGION }}
aws_s3_bucket: ${{ secrets.AWS_S3_BUCKET_INTEG_V2 }}

- name: Run Integration test
uses: ./.github/composite_actions/run_xcodebuild_test
with:
project_path: ./AmplifyPlugins/Analytics/Tests/AnalyticsHostApp
scheme: AWSPinpointAnalyticsPluginIntegrationTests
destination: 'platform=iOS Simulator,name=iPhone 14,OS=latest'
xcode_path: '/Applications/Xcode_14.3.app'

analytics-integration-test-tvOS:
if: ${{ github.event_name != 'workflow_dispatch' || inputs.tvos }}
runs-on: macos-13
environment: IntegrationTest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false

- name: Make directory
run: mkdir -p ~/.aws-amplify/amplify-ios/testconfiguration/

- name: Copy integration test resouces
uses: ./.github/composite_actions/download_test_configuration
with:
resource_subfolder: analytics
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws_region: ${{ secrets.AWS_REGION }}
aws_s3_bucket: ${{ secrets.AWS_S3_BUCKET_INTEG_V2 }}

- name: Run Integration test
uses: ./.github/composite_actions/run_xcodebuild_test
with:
project_path: ./AmplifyPlugins/Analytics/Tests/AnalyticsHostApp
scheme: AWSPinpointAnalyticsPluginIntegrationTests
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest
sdk: appletvsimulator
xcode_path: '/Applications/Xcode_14.3.app'

analytics-integration-test-watchOS:
if: ${{ github.event_name != 'workflow_dispatch' || inputs.watchos }}
runs-on: macos-13
environment: IntegrationTest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false

- name: Make directory
run: mkdir -p ~/.aws-amplify/amplify-ios/testconfiguration/

- name: Copy integration test resouces
uses: ./.github/composite_actions/download_test_configuration
with:
resource_subfolder: analytics
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws_region: ${{ secrets.AWS_REGION }}
aws_s3_bucket: ${{ secrets.AWS_S3_BUCKET_INTEG_V2 }}

- name: Run Integration test
uses: ./.github/composite_actions/run_xcodebuild_test
with:
project_path: ./AmplifyPlugins/Analytics/Tests/AnalyticsHostApp
scheme: AWSPinpointAnalyticsPluginIntegrationTestsWatch
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
sdk: watchsimulator
xcode_path: '/Applications/Xcode_14.3.app'
analytics-integration-tests:
name: Analytics Integration Tests
strategy:
fail-fast: false
matrix:
platform: [iOS, tvOS, watchOS]
exclude:
- platform: ${{ github.event.inputs.ios == 'false' && 'iOS' || 'Dummy' }}
- platform: ${{ github.event.inputs.tvos == 'false' && 'tvOS' || 'Dummy' }}
- platform: ${{ github.event.inputs.watchos == 'false' && 'watchOS' || 'Dummy' }}
uses: ./.github/workflows/run_integration_tests.yml
with:
scheme: ${{ matrix.platform == 'watchOS' && 'AWSPinpointAnalyticsPluginIntegrationTestsWatch' || 'AWSPinpointAnalyticsPluginIntegrationTests' }}
platform: ${{ matrix.platform }}
build_cache_key: AWSPinpointAnalyticsPlugin-${{ matrix.platform }}-latest-build-main
project_path: ./AmplifyPlugins/Analytics/Tests/AnalyticsHostApp
xcode_version: '14.3'
resource_subfolder: analytics
timeout-minutes: 30
secrets: inherit
34 changes: 9 additions & 25 deletions .github/workflows/integ_test_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,66 +10,50 @@ permissions:

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
cancel-in-progress: ${{ github.ref_name != 'main'}}

jobs:
prepare-for-test:
runs-on: macos-13
environment: IntegrationTest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false

- name: Verify copy resources
uses: ./.github/composite_actions/download_test_configuration
with:
resource_subfolder: NA
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws_region: ${{ secrets.AWS_REGION }}
aws_s3_bucket: ${{ secrets.AWS_S3_BUCKET_INTEG }}

functional-test:
needs: prepare-for-test
name: Functional Tests
uses: ./.github/workflows/integ_test_api_functional.yml
secrets: inherit

graphql-user-pool-test:
if: ${{ false }}
needs: prepare-for-test
name: GraphQL | User Pool Tests
uses: ./.github/workflows/integ_test_api_graphql_user_pool.yml
secrets: inherit

graphql-auth-directive-test:
if: ${{ false }}
needs: prepare-for-test
name: GraphQL | Auth Directive Tests
uses: ./.github/workflows/integ_test_api_graphql_auth_directive.yml
secrets: inherit

graphql-iam-test:
if: ${{ false }}
needs: prepare-for-test
name: GraphQL | IAM Tests
uses: ./.github/workflows/integ_test_api_graphql_iam.yml
secrets: inherit

graphql-lambda-auth-test:
needs: prepare-for-test
name: GraphQL | Lambda Tests
uses: ./.github/workflows/integ_test_api_graphql_lambda_auth.yml
secrets: inherit

graphql-lazy-load-test:
if: ${{ false }}
needs: prepare-for-test
name: GraphQL | Lazy Load Tests
uses: ./.github/workflows/integ_test_api_graphql_lazy_load.yml
secrets: inherit

rest-user-pool-test:
if: ${{ false }}
needs: prepare-for-test
name: REST | User Pool Tests
uses: ./.github/workflows/integ_test_api_rest_user_pool.yml
secrets: inherit

rest-iam-test:
needs: prepare-for-test
name: REST | IAM Tests
uses: ./.github/workflows/integ_test_api_rest_iam.yml
secrets: inherit
Loading

0 comments on commit 2604241

Please sign in to comment.