Skip to content

Commit 2604241

Browse files
authored
chore: Adding caching and retries to Integration Tests workflows (#3339)
1 parent e122799 commit 2604241

File tree

46 files changed

+697
-2663
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+697
-2663
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: 'Get the build parameters for a given platform'
2+
inputs:
3+
platform:
4+
description: 'The name of the platform. Valid values are iOS, tvOS, watchOS and macOS'
5+
required: true
6+
type: string
7+
xcode_version:
8+
description: 'The version of Xcode. Valid values are 14.3 and 15.0'
9+
required: true
10+
type: string
11+
outputs:
12+
destination:
13+
description: "The destination associated with the given platform and Xcode version"
14+
value: ${{ steps.platform.outputs.destination }}
15+
sdk:
16+
description: "The SDK associated with the given platform"
17+
value: ${{ steps.platform.outputs.sdk }}
18+
runs:
19+
using: "composite"
20+
steps:
21+
- id: platform
22+
run: |
23+
PLATFORM=${{ inputs.platform }}
24+
case $PLATFORM in
25+
iOS|tvOS|watchOS|macOS) ;;
26+
*) echo "Unsupported platform: $PLATFORM"; exit 1 ;;
27+
esac
28+
29+
XCODE_VERSION=${{ inputs.xcode_version }}
30+
case $XCODE_VERSION in
31+
14.3|15.0) ;;
32+
*) echo "Unsupported Xcode version: $XCODE_VERSION"; exit 1 ;;
33+
esac
34+
35+
DESTINATION_MAPPING='{
36+
"14.3": {
37+
"iOS": "platform=iOS Simulator,name=iPhone 14,OS=16.4",
38+
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4",
39+
"watchOS": "platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4",
40+
"macOS": "platform=macOS,arch=x86_64"
41+
},
42+
"15.0": {
43+
"iOS": "platform=iOS Simulator,name=iPhone 15,OS=latest",
44+
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest",
45+
"watchOS": "platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=latest",
46+
"macOS": "platform=macOS,arch=x86_64"
47+
}
48+
}'
49+
50+
SDK_MAPPING='{
51+
"iOS": "iphonesimulator",
52+
"tvOS": "appletvsimulator",
53+
"watchOS": "watchsimulator",
54+
"macOS": "macosx"
55+
}'
56+
57+
echo "destination=$(echo $DESTINATION_MAPPING | jq -r ."\"$XCODE_VERSION\"".$PLATFORM)" >> $GITHUB_OUTPUT
58+
echo "sdk=$(echo $SDK_MAPPING | jq -r .$PLATFORM)" >> $GITHUB_OUTPUT
59+
shell: bash
60+

.github/workflows/integ_test.yml

+7-29
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
name: Integration Tests
22
on:
33
workflow_dispatch:
4-
workflow_call:
5-
inputs:
6-
identifier:
7-
required: true
8-
type: string
9-
104
push:
115
branches: [main]
126

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

2115
jobs:
22-
prepare-for-test:
23-
runs-on: macos-13
24-
environment: IntegrationTest
25-
steps:
26-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
27-
with:
28-
persist-credentials: false
29-
30-
- name: Verify copy resources
31-
uses: ./.github/composite_actions/download_test_configuration
32-
with:
33-
resource_subfolder: NA
34-
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
35-
aws_region: ${{ secrets.AWS_REGION }}
36-
aws_s3_bucket: ${{ secrets.AWS_S3_BUCKET_INTEG_V2 }}
37-
3816
analytics-test:
39-
needs: prepare-for-test
17+
name: Analytics Integration Tests
4018
uses: ./.github/workflows/integ_test_analytics.yml
4119
secrets: inherit
4220

4321
push-notifications-test:
44-
needs: prepare-for-test
22+
name: Push Notifications Integration Tests
4523
uses: ./.github/workflows/integ_test_push_notifications.yml
4624
secrets: inherit
4725

4826
predictions-test:
49-
needs: prepare-for-test
27+
name: Predictions Integration Tests
5028
uses: ./.github/workflows/integ_test_predictions.yml
5129
secrets: inherit
5230

5331
auth-test:
54-
needs: prepare-for-test
32+
name: Auth Integration Tests
5533
uses: ./.github/workflows/integ_test_auth.yml
5634
secrets: inherit
5735

5836
geo-test:
59-
needs: prepare-for-test
37+
name: Geo Integration Tests
6038
uses: ./.github/workflows/integ_test_geo.yml
6139
secrets: inherit
6240

6341
storage-test:
64-
needs: prepare-for-test
42+
name: Storage Integration Tests
6543
uses: ./.github/workflows/integ_test_storage.yml
6644
secrets: inherit
6745

6846
logging-test:
69-
needs: prepare-for-test
47+
name: Logging Integration Tests
7048
uses: ./.github/workflows/integ_test_logging.yml
7149
secrets: inherit

.github/workflows/integ_test_analytics.yml

+20-85
Original file line numberDiff line numberDiff line change
@@ -24,88 +24,23 @@ permissions:
2424
contents: read
2525

2626
jobs:
27-
analytics-integration-test-iOS:
28-
if: ${{ github.event_name != 'workflow_dispatch' || inputs.ios }}
29-
runs-on: macos-13
30-
environment: IntegrationTest
31-
steps:
32-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
33-
with:
34-
persist-credentials: false
35-
36-
- name: Make directory
37-
run: mkdir -p ~/.aws-amplify/amplify-ios/testconfiguration/
38-
39-
- name: Copy integration test resouces
40-
uses: ./.github/composite_actions/download_test_configuration
41-
with:
42-
resource_subfolder: analytics
43-
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
44-
aws_region: ${{ secrets.AWS_REGION }}
45-
aws_s3_bucket: ${{ secrets.AWS_S3_BUCKET_INTEG_V2 }}
46-
47-
- name: Run Integration test
48-
uses: ./.github/composite_actions/run_xcodebuild_test
49-
with:
50-
project_path: ./AmplifyPlugins/Analytics/Tests/AnalyticsHostApp
51-
scheme: AWSPinpointAnalyticsPluginIntegrationTests
52-
destination: 'platform=iOS Simulator,name=iPhone 14,OS=latest'
53-
xcode_path: '/Applications/Xcode_14.3.app'
54-
55-
analytics-integration-test-tvOS:
56-
if: ${{ github.event_name != 'workflow_dispatch' || inputs.tvos }}
57-
runs-on: macos-13
58-
environment: IntegrationTest
59-
steps:
60-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
61-
with:
62-
persist-credentials: false
63-
64-
- name: Make directory
65-
run: mkdir -p ~/.aws-amplify/amplify-ios/testconfiguration/
66-
67-
- name: Copy integration test resouces
68-
uses: ./.github/composite_actions/download_test_configuration
69-
with:
70-
resource_subfolder: analytics
71-
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
72-
aws_region: ${{ secrets.AWS_REGION }}
73-
aws_s3_bucket: ${{ secrets.AWS_S3_BUCKET_INTEG_V2 }}
74-
75-
- name: Run Integration test
76-
uses: ./.github/composite_actions/run_xcodebuild_test
77-
with:
78-
project_path: ./AmplifyPlugins/Analytics/Tests/AnalyticsHostApp
79-
scheme: AWSPinpointAnalyticsPluginIntegrationTests
80-
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest
81-
sdk: appletvsimulator
82-
xcode_path: '/Applications/Xcode_14.3.app'
83-
84-
analytics-integration-test-watchOS:
85-
if: ${{ github.event_name != 'workflow_dispatch' || inputs.watchos }}
86-
runs-on: macos-13
87-
environment: IntegrationTest
88-
steps:
89-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
90-
with:
91-
persist-credentials: false
92-
93-
- name: Make directory
94-
run: mkdir -p ~/.aws-amplify/amplify-ios/testconfiguration/
95-
96-
- name: Copy integration test resouces
97-
uses: ./.github/composite_actions/download_test_configuration
98-
with:
99-
resource_subfolder: analytics
100-
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
101-
aws_region: ${{ secrets.AWS_REGION }}
102-
aws_s3_bucket: ${{ secrets.AWS_S3_BUCKET_INTEG_V2 }}
103-
104-
- name: Run Integration test
105-
uses: ./.github/composite_actions/run_xcodebuild_test
106-
with:
107-
project_path: ./AmplifyPlugins/Analytics/Tests/AnalyticsHostApp
108-
scheme: AWSPinpointAnalyticsPluginIntegrationTestsWatch
109-
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
110-
sdk: watchsimulator
111-
xcode_path: '/Applications/Xcode_14.3.app'
27+
analytics-integration-tests:
28+
name: Analytics Integration Tests
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
platform: [iOS, tvOS, watchOS]
33+
exclude:
34+
- platform: ${{ github.event.inputs.ios == 'false' && 'iOS' || 'Dummy' }}
35+
- platform: ${{ github.event.inputs.tvos == 'false' && 'tvOS' || 'Dummy' }}
36+
- platform: ${{ github.event.inputs.watchos == 'false' && 'watchOS' || 'Dummy' }}
37+
uses: ./.github/workflows/run_integration_tests.yml
38+
with:
39+
scheme: ${{ matrix.platform == 'watchOS' && 'AWSPinpointAnalyticsPluginIntegrationTestsWatch' || 'AWSPinpointAnalyticsPluginIntegrationTests' }}
40+
platform: ${{ matrix.platform }}
41+
build_cache_key: AWSPinpointAnalyticsPlugin-${{ matrix.platform }}-latest-build-main
42+
project_path: ./AmplifyPlugins/Analytics/Tests/AnalyticsHostApp
43+
xcode_version: '14.3'
44+
resource_subfolder: analytics
45+
timeout-minutes: 30
46+
secrets: inherit

.github/workflows/integ_test_api.yml

+9-25
Original file line numberDiff line numberDiff line change
@@ -10,66 +10,50 @@ permissions:
1010

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

1515
jobs:
16-
prepare-for-test:
17-
runs-on: macos-13
18-
environment: IntegrationTest
19-
steps:
20-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
21-
with:
22-
persist-credentials: false
23-
24-
- name: Verify copy resources
25-
uses: ./.github/composite_actions/download_test_configuration
26-
with:
27-
resource_subfolder: NA
28-
aws_role_to_assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
29-
aws_region: ${{ secrets.AWS_REGION }}
30-
aws_s3_bucket: ${{ secrets.AWS_S3_BUCKET_INTEG }}
31-
3216
functional-test:
33-
needs: prepare-for-test
17+
name: Functional Tests
3418
uses: ./.github/workflows/integ_test_api_functional.yml
3519
secrets: inherit
3620

3721
graphql-user-pool-test:
3822
if: ${{ false }}
39-
needs: prepare-for-test
23+
name: GraphQL | User Pool Tests
4024
uses: ./.github/workflows/integ_test_api_graphql_user_pool.yml
4125
secrets: inherit
4226

4327
graphql-auth-directive-test:
4428
if: ${{ false }}
45-
needs: prepare-for-test
29+
name: GraphQL | Auth Directive Tests
4630
uses: ./.github/workflows/integ_test_api_graphql_auth_directive.yml
4731
secrets: inherit
4832

4933
graphql-iam-test:
5034
if: ${{ false }}
51-
needs: prepare-for-test
35+
name: GraphQL | IAM Tests
5236
uses: ./.github/workflows/integ_test_api_graphql_iam.yml
5337
secrets: inherit
5438

5539
graphql-lambda-auth-test:
56-
needs: prepare-for-test
40+
name: GraphQL | Lambda Tests
5741
uses: ./.github/workflows/integ_test_api_graphql_lambda_auth.yml
5842
secrets: inherit
5943

6044
graphql-lazy-load-test:
6145
if: ${{ false }}
62-
needs: prepare-for-test
46+
name: GraphQL | Lazy Load Tests
6347
uses: ./.github/workflows/integ_test_api_graphql_lazy_load.yml
6448
secrets: inherit
6549

6650
rest-user-pool-test:
6751
if: ${{ false }}
68-
needs: prepare-for-test
52+
name: REST | User Pool Tests
6953
uses: ./.github/workflows/integ_test_api_rest_user_pool.yml
7054
secrets: inherit
7155

7256
rest-iam-test:
73-
needs: prepare-for-test
57+
name: REST | IAM Tests
7458
uses: ./.github/workflows/integ_test_api_rest_iam.yml
7559
secrets: inherit

0 commit comments

Comments
 (0)