Skip to content

Commit 2dc5996

Browse files
authored
chore: Fixing the nightly unit tests workflow (#3172)
1 parent 90e7163 commit 2dc5996

File tree

2 files changed

+51
-38
lines changed

2 files changed

+51
-38
lines changed

.github/workflows/nightly_repeated_unittest.yml

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,30 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
jobs:
15-
unit_test_ios:
16-
runs-on: macos-12
15+
unit_tests:
16+
name: ${{ matrix.scheme }} Repeated Unit Tests
1717
strategy:
18+
fail-fast: false
1819
matrix:
19-
scheme: [Amplify, AWSPluginsCore, AWSPinpointAnalyticsPlugin, AWSAPIPlugin, AWSCognitoAuthPlugin, AWSDataStorePlugin, AWSLocationGeoPlugin, AWSS3StoragePlugin]
20-
steps:
21-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
22-
23-
- name: Run repeated unit test iOS
24-
uses: ./.github/composite_actions/run_xcodebuild_test
25-
with:
26-
project_path: .
27-
scheme: ${{ matrix.scheme }}
28-
other_flags: -test-iterations 100 -run-tests-until-failure
29-
30-
unit_test_macos:
31-
runs-on: macos-12
32-
strategy:
33-
matrix:
34-
scheme: [Amplify, AWSPluginsCore, AWSPinpointAnalyticsPlugin, AWSAPIPlugin, AWSCognitoAuthPlugin, AWSDataStorePlugin, AWSLocationGeoPlugin, AWSS3StoragePlugin]
35-
steps:
36-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
37-
38-
- name: Run repeated unit test macOS
39-
uses: ./.github/composite_actions/run_xcodebuild_test
40-
with:
41-
project_path: .
42-
scheme: ${{ matrix.scheme }}
43-
sdk: macosx
44-
destination: platform=macOS,arch=x86_64
45-
other_flags: -test-iterations 100 -run-tests-until-failure
46-
20+
scheme: [
21+
Amplify,
22+
AWSPluginsCore,
23+
AWSAPIPlugin,
24+
AWSCloudWatchLoggingPlugin,
25+
AWSCognitoAuthPlugin,
26+
AWSDataStorePlugin,
27+
AWSLocationGeoPlugin,
28+
AWSPredictionsPlugin,
29+
AWSPinpointAnalyticsPlugin,
30+
AWSPinpointPushNotificationsPlugin,
31+
AWSS3StoragePlugin,
32+
CoreMLPredictionsPlugin,
33+
InternalAWSPinpointUnitTests
34+
]
35+
uses: ./.github/workflows/run_xcodebuild_test_platforms.yml
36+
with:
37+
scheme: ${{ matrix.scheme }}
38+
timeout-minutes: 50
39+
generate_coverage_report: false
40+
retry_on_error: false
41+
other_flags: -test-iterations 100 -run-tests-until-failure

.github/workflows/run_xcodebuild_test_platforms.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,19 @@ on:
1616
required: false
1717
type: boolean
1818
default: false
19+
retry_on_error:
20+
description: 'Whether to automatically retry if the tests fail'
21+
required: false
22+
type: boolean
23+
default: true
24+
other_flags:
25+
required: false
26+
type: string
27+
default: ''
1928

2029
env:
2130
SCHEME: ${{ inputs.scheme }}
31+
RETRY_ON_ERROR: ${{ inputs.retry_on_error }}
2232

2333
permissions:
2434
contents: read
@@ -50,7 +60,7 @@ jobs:
5060
key: ${{ env.SCHEME }}-iOS-build-${{ github.sha }}
5161
- name: Run iOS Test Suite
5262
id: run-tests
53-
continue-on-error: true
63+
continue-on-error: ${{ env.RETRY_ON_ERROR == 'true' }}
5464
uses: ./.github/composite_actions/run_xcodebuild_test
5565
with:
5666
scheme: ${{ env.SCHEME }}
@@ -61,8 +71,9 @@ jobs:
6171
derived_data_path: ${{ github.workspace }}/Build
6272
disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }}
6373
test_without_building: ${{ steps.restore-build.outputs.cache-hit }}
74+
other_flags: ${{ inputs.other_flags }}
6475
- name: Retry iOS Test Suite if needed
65-
if: steps.run-tests.outcome=='failure'
76+
if: inputs.retry_on_error == 'true' && steps.run-tests.outcome=='failure'
6677
id: retry-tests
6778
uses: ./.github/composite_actions/run_xcodebuild_test
6879
with:
@@ -74,6 +85,7 @@ jobs:
7485
derived_data_path: ${{ github.workspace }}/Build
7586
disable_package_resolution: true
7687
test_without_building: true
88+
other_flags: ${{ inputs.other_flags }}
7789
- name: Save the build cache for re-runs
7890
if: failure() && steps.retry-tests.outcome=='failure'
7991
uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
@@ -116,7 +128,7 @@ jobs:
116128
key: ${{ env.SCHEME }}-macOS-build-${{ github.sha }}
117129
- name: Run macOS Test Suite
118130
id: run-tests
119-
continue-on-error: true
131+
continue-on-error: ${{ env.RETRY_ON_ERROR == 'true' }}
120132
uses: ./.github/composite_actions/run_xcodebuild_test
121133
with:
122134
scheme: ${{ env.SCHEME }}
@@ -127,8 +139,9 @@ jobs:
127139
derived_data_path: ${{ github.workspace }}/Build
128140
disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }}
129141
test_without_building: ${{ steps.restore-build.outputs.cache-hit }}
142+
other_flags: ${{ inputs.other_flags }}
130143
- name: Retry macOS Test Suite if needed
131-
if: steps.run-tests.outcome=='failure'
144+
if: inputs.retry_on_error == 'true' && steps.run-tests.outcome=='failure'
132145
id: retry-tests
133146
uses: ./.github/composite_actions/run_xcodebuild_test
134147
with:
@@ -140,6 +153,7 @@ jobs:
140153
derived_data_path: ${{ github.workspace }}/Build
141154
disable_package_resolution: true
142155
test_without_building: true
156+
other_flags: ${{ inputs.other_flags }}
143157
- name: Save the build cache for re-runs
144158
if: failure() && steps.retry-tests.outcome=='failure'
145159
uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
@@ -173,7 +187,7 @@ jobs:
173187
key: ${{ env.SCHEME }}-tvOS-build-${{ github.sha }}
174188
- name: Run tvOS Test Suite
175189
id: run-tests
176-
continue-on-error: true
190+
continue-on-error: ${{ env.RETRY_ON_ERROR == 'true' }}
177191
uses: ./.github/composite_actions/run_xcodebuild_test
178192
with:
179193
scheme: ${{ env.SCHEME }}
@@ -184,8 +198,9 @@ jobs:
184198
derived_data_path: ${{ github.workspace }}/Build
185199
disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }}
186200
test_without_building: ${{ steps.restore-build.outputs.cache-hit }}
201+
other_flags: ${{ inputs.other_flags }}
187202
- name: Retry tvOS Test Suite if needed
188-
if: steps.run-tests.outcome=='failure'
203+
if: inputs.retry_on_error == 'true' && steps.run-tests.outcome=='failure'
189204
id: retry-tests
190205
uses: ./.github/composite_actions/run_xcodebuild_test
191206
with:
@@ -197,6 +212,7 @@ jobs:
197212
derived_data_path: ${{ github.workspace }}/Build
198213
disable_package_resolution: true
199214
test_without_building: true
215+
other_flags: ${{ inputs.other_flags }}
200216
- name: Save the build cache for re-runs
201217
if: failure() && steps.retry-tests.outcome=='failure'
202218
uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
@@ -230,7 +246,7 @@ jobs:
230246
key: ${{ env.SCHEME }}-watchOS-build-${{ github.sha }}
231247
- name: Run watchOS Test Suite
232248
id: run-tests
233-
continue-on-error: true
249+
continue-on-error: ${{ env.RETRY_ON_ERROR == 'true' }}
234250
uses: ./.github/composite_actions/run_xcodebuild_test
235251
with:
236252
scheme: ${{ env.SCHEME }}
@@ -241,8 +257,9 @@ jobs:
241257
derived_data_path: ${{ github.workspace }}/Build
242258
disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }}
243259
test_without_building: ${{ steps.restore-build.outputs.cache-hit }}
260+
other_flags: ${{ inputs.other_flags }}
244261
- name: Retry watchOS Test Suite if needed
245-
if: steps.run-tests.outcome=='failure'
262+
if: inputs.retry_on_error == 'true' && steps.run-tests.outcome=='failure'
246263
id: retry-tests
247264
uses: ./.github/composite_actions/run_xcodebuild_test
248265
with:
@@ -254,6 +271,7 @@ jobs:
254271
derived_data_path: ${{ github.workspace }}/Build
255272
disable_package_resolution: true
256273
test_without_building: true
274+
other_flags: ${{ inputs.other_flags }}
257275
- name: Save the build cache for re-runs
258276
if: failure() && steps.retry-tests.outcome=='failure'
259277
uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1

0 commit comments

Comments
 (0)