Skip to content

[ci] Clean up iOS simulators #3458

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 1 commit into from
Mar 16, 2023
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
8 changes: 5 additions & 3 deletions .ci/scripts/create_simulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

device=com.apple.CoreSimulator.SimDeviceType.iPhone-13
os=com.apple.CoreSimulator.SimRuntime.iOS-16-0
# The name here must match remove_simulator.sh
readonly DEVICE_NAME=Flutter-iPhone
readonly DEVICE=com.apple.CoreSimulator.SimDeviceType.iPhone-13
readonly OS=com.apple.CoreSimulator.SimRuntime.iOS-16-0

xcrun simctl list
xcrun simctl create Flutter-iPhone "$device" "$os" | xargs xcrun simctl boot
xcrun simctl create "$DEVICE_NAME" "$DEVICE" "$OS" | xargs xcrun simctl boot
11 changes: 11 additions & 0 deletions .ci/scripts/remove_simulator.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# The name here must match create_simulator.sh
readonly DEVICE_NAME=Flutter-iPhone

xcrun simctl shutdown "$DEVICE_NAME"
xcrun simctl delete "$DEVICE_NAME"
Comment on lines +9 to +10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can delete without shutting down?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xcrun simctl list
2 changes: 2 additions & 0 deletions .ci/targets/ios_platform_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ tasks:
# So we run `drive-examples` after `native-test`; changing the order will result ci failure.
script: script/tool_runner.sh
args: ["drive-examples", "--ios", "--exclude=script/configs/exclude_integration_ios.yaml"]
- name: remove simulator
script: .ci/scripts/remove_simulator.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be run in an always: block? https://cirrus-ci.org/guide/writing-tasks/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha never mind this is luci, is there a cleanup mechanism in this fancy yaml system that moved everything out of the recipe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a cleanup mechanism in this fancy yaml system that moved everything out of the recipe?

You may be overestimating the level of fanciness here :)

Now that you mention it, I don't actually know if currently it'll stop on the first failing step, or run everything. I should upload a build-breaking PR and see what runs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answer: no, there's no cleanup mechanism 😬

I filed flutter/flutter#122629. Should we land this as-is to at least slow the bleeding of simulators, and then adjust it later once we have a cleanup stage?

2 changes: 2 additions & 0 deletions .ci/targets/macos_custom_package_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ tasks:
script: .ci/scripts/create_simulator.sh
- name: custom package tests
script: .ci/scripts/custom_package_tests.sh
- name: remove simulator
script: .ci/scripts/remove_simulator.sh