Skip to content

Commit c74dc47

Browse files
authored
Add test on iOS simulator (#349)
Workflow enable integration test on iOS simulator
1 parent 5f931bc commit c74dc47

File tree

18 files changed

+1303
-17
lines changed

18 files changed

+1303
-17
lines changed

.github/workflows/integration_tests.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ env:
5050
statusLabelFailed: "tests: failed"
5151
statusLabelSucceeded: "tests: succeeded"
5252
statusCommentIdentifier: "integration-test-status-comment"
53+
mobileTestOn: "device"
5354

5455
jobs:
5556
check_trigger:
@@ -336,12 +337,16 @@ jobs:
336337
additional_flags+=(--cmake_flag=-DFIREBASE_USE_BORINGSSL=ON)
337338
fi
338339
fi
339-
python scripts/gha/build_testapps.py --t ${{ needs.prepare_matrix.outputs.apis }} --p ${{ matrix.target_platform }} --output_directory "${{ github.workspace }}" --noadd_timestamp ${additional_flags[*]} --short_output_paths
340+
python scripts/gha/build_testapps.py --t ${{ needs.prepare_matrix.outputs.apis }} --p ${{ matrix.target_platform }} --output_directory "${{ github.workspace }}" --ios_sdk "${{ env.mobileTestOn }}" --noadd_timestamp ${additional_flags[*]} --short_output_paths
340341
341342
- name: Run desktop integration tests
342343
if: matrix.target_platform == 'Desktop' && !cancelled()
343344
run: |
344345
python scripts/gha/desktop_tester.py --testapp_dir ta
346+
- name: Run iOS integration tests on Simulator locally
347+
if: matrix.target_platform == 'iOS' && !cancelled()
348+
run: |
349+
python scripts/gha/test_simulator.py --testapp_dir ta
345350
# Workaround for https://github.com/GoogleCloudPlatform/github-actions/issues/100
346351
# Must be run after the Python setup action
347352
- name: Set CLOUDSDK_PYTHON (Windows)
@@ -355,7 +360,7 @@ jobs:
355360
if: matrix.target_platform == 'Desktop' && !cancelled()
356361
run: |
357362
python scripts/gha/gcs_uploader.py --testapp_dir ta --key_file scripts/gha-encrypted/gcs_key_file.json
358-
- name: Run mobile integration tests
363+
- name: Run mobile integration tests on Real Device via FTL
359364
if: matrix.target_platform != 'Desktop' && !cancelled()
360365
run: |
361366
python scripts/gha/test_lab.py --android_model ${{ needs.prepare_matrix.outputs.android_device }} --android_api ${{ needs.prepare_matrix.outputs.android_api }} --ios_model ${{ needs.prepare_matrix.outputs.ios_device }} --ios_version ${{ needs.prepare_matrix.outputs.ios_version }} --testapp_dir ta --code_platform cpp --key_file scripts/gha-encrypted/gcs_key_file.json

scripts/gha/build_testapps.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,7 @@
108108
# Values for iOS SDK flag (where the iOS app will run)
109109
_IOS_SDK_DEVICE = "device"
110110
_IOS_SDK_SIMULATOR = "simulator"
111-
_IOS_SDK_BOTH = "both"
112-
_SUPPORTED_IOS_SDK = (_IOS_SDK_DEVICE, _IOS_SDK_SIMULATOR, _IOS_SDK_BOTH)
111+
_SUPPORTED_IOS_SDK = (_IOS_SDK_DEVICE, _IOS_SDK_SIMULATOR)
113112

114113
FLAGS = flags.FLAGS
115114

@@ -140,8 +139,8 @@
140139
" Recommended when running locally, so each execution gets its own "
141140
" directory.")
142141

143-
flags.DEFINE_enum(
144-
"ios_sdk", _IOS_SDK_DEVICE, _SUPPORTED_IOS_SDK,
142+
flags.DEFINE_list(
143+
"ios_sdk", _IOS_SDK_DEVICE,
145144
"(iOS only) Build for device (ipa), simulator (app), or both."
146145
" Building for both will produce both an .app and an .ipa.")
147146

@@ -168,6 +167,12 @@
168167
message="Valid platforms: " + ",".join(_SUPPORTED_PLATFORMS),
169168
flag_values=FLAGS)
170169

170+
flags.register_validator(
171+
"ios_sdk",
172+
lambda s: all(ios_sdk in _SUPPORTED_IOS_SDK for ios_sdk in s),
173+
message="Valid platforms: " + ",".join(_SUPPORTED_IOS_SDK),
174+
flag_values=FLAGS)
175+
171176
flags.DEFINE_bool(
172177
"short_output_paths", False,
173178
"Use short directory names for output paths. Useful to avoid hitting file "
@@ -501,7 +506,7 @@ def _build_ios(
501506
_run(xcode_patcher_args)
502507

503508
xcode_path = os.path.join(project_dir, api_config.ios_target + ".xcworkspace")
504-
if ios_sdk in [_IOS_SDK_SIMULATOR, _IOS_SDK_BOTH]:
509+
if _IOS_SDK_SIMULATOR in ios_sdk:
505510
_run(
506511
xcodebuild.get_args_for_build(
507512
path=xcode_path,
@@ -510,7 +515,7 @@ def _build_ios(
510515
ios_sdk=_IOS_SDK_SIMULATOR,
511516
configuration="Debug"))
512517

513-
if ios_sdk in [_IOS_SDK_DEVICE, _IOS_SDK_BOTH]:
518+
if _IOS_SDK_DEVICE in ios_sdk:
514519
_run(
515520
xcodebuild.get_args_for_build(
516521
path=xcode_path,

0 commit comments

Comments
 (0)