Skip to content

CI enable integration test on iOS Simulator #349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ env:
statusLabelFailed: "tests: failed"
statusLabelSucceeded: "tests: succeeded"
statusCommentIdentifier: "integration-test-status-comment"
mobileTestOn: "device"

jobs:
check_trigger:
Expand Down Expand Up @@ -336,12 +337,16 @@ jobs:
additional_flags+=(--cmake_flag=-DFIREBASE_USE_BORINGSSL=ON)
fi
fi
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
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

- name: Run desktop integration tests
if: matrix.target_platform == 'Desktop' && !cancelled()
run: |
python scripts/gha/desktop_tester.py --testapp_dir ta
- name: Run iOS integration tests on Simulator locally
if: matrix.target_platform == 'iOS' && !cancelled()
run: |
python scripts/gha/test_simulator.py --testapp_dir ta
# Workaround for https://github.com/GoogleCloudPlatform/github-actions/issues/100
# Must be run after the Python setup action
- name: Set CLOUDSDK_PYTHON (Windows)
Expand All @@ -355,7 +360,7 @@ jobs:
if: matrix.target_platform == 'Desktop' && !cancelled()
run: |
python scripts/gha/gcs_uploader.py --testapp_dir ta --key_file scripts/gha-encrypted/gcs_key_file.json
- name: Run mobile integration tests
- name: Run mobile integration tests on Real Device via FTL
if: matrix.target_platform != 'Desktop' && !cancelled()
run: |
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
Expand Down
17 changes: 11 additions & 6 deletions scripts/gha/build_testapps.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@
# Values for iOS SDK flag (where the iOS app will run)
_IOS_SDK_DEVICE = "device"
_IOS_SDK_SIMULATOR = "simulator"
_IOS_SDK_BOTH = "both"
_SUPPORTED_IOS_SDK = (_IOS_SDK_DEVICE, _IOS_SDK_SIMULATOR, _IOS_SDK_BOTH)
_SUPPORTED_IOS_SDK = (_IOS_SDK_DEVICE, _IOS_SDK_SIMULATOR)

FLAGS = flags.FLAGS

Expand Down Expand Up @@ -140,8 +139,8 @@
" Recommended when running locally, so each execution gets its own "
" directory.")

flags.DEFINE_enum(
"ios_sdk", _IOS_SDK_DEVICE, _SUPPORTED_IOS_SDK,
flags.DEFINE_list(
"ios_sdk", _IOS_SDK_DEVICE,
"(iOS only) Build for device (ipa), simulator (app), or both."
" Building for both will produce both an .app and an .ipa.")

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

flags.register_validator(
"ios_sdk",
lambda s: all(ios_sdk in _SUPPORTED_IOS_SDK for ios_sdk in s),
message="Valid platforms: " + ",".join(_SUPPORTED_IOS_SDK),
flag_values=FLAGS)

flags.DEFINE_bool(
"short_output_paths", False,
"Use short directory names for output paths. Useful to avoid hitting file "
Expand Down Expand Up @@ -501,7 +506,7 @@ def _build_ios(
_run(xcode_patcher_args)

xcode_path = os.path.join(project_dir, api_config.ios_target + ".xcworkspace")
if ios_sdk in [_IOS_SDK_SIMULATOR, _IOS_SDK_BOTH]:
if _IOS_SDK_SIMULATOR in ios_sdk:
_run(
xcodebuild.get_args_for_build(
path=xcode_path,
Expand All @@ -510,7 +515,7 @@ def _build_ios(
ios_sdk=_IOS_SDK_SIMULATOR,
configuration="Debug"))

if ios_sdk in [_IOS_SDK_DEVICE, _IOS_SDK_BOTH]:
if _IOS_SDK_DEVICE in ios_sdk:
_run(
xcodebuild.get_args_for_build(
path=xcode_path,
Expand Down
Loading