-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add CI steps to test iOS and macOS plugins with both CocoaPods and Swift Package Manager #6557
Add CI steps to test iOS and macOS plugins with both CocoaPods and Swift Package Manager #6557
Conversation
.ci/targets/ios_platform_tests.yaml
Outdated
@@ -9,9 +9,12 @@ tasks: | |||
script: .ci/scripts/tool_runner.sh | |||
args: ["fetch-deps", "--ios", "--supporting-target-platforms-only"] | |||
infra_step: true | |||
- name: build examples | |||
- name: build examples with CocoaPods integration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need to build-all twice; there's already some redundancy in the build-all app vs individual example builds. We use that redundancy to get x64/arm64 coverage already, and I would vote for doing the same thing here.
To do that we would remove this step, and only build-all with SPM. That gives us SPM build coverage of all plugin in this step, and CocoaPods coverage in all the example app builds. Then when the flag is removed or reversed, we switch build-all to force SPM off and reverse the coverage roles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if I understand correctly, you're suggesting we update build-all (https:/flutter/packages/blob/main/.ci/targets/ios_build_all_packages.yaml / https:/flutter/packages/blob/main/.ci/scripts/build_all_packages_app.sh) to have SPM enabled so it builds all with SPM.
And then in platform tests (this file), only build with CocoaPods?
Just a reminder, native tests will need to be run with SPM enabled because CocoaPod testing dependencies will have been removed (see "Updating unit tests in plugin example app"), which will make native tests not be able to be run without SPM. But we can still do what you're suggesting and just add a new step to the yaml that enables SPM
packages/.ci/targets/ios_platform_tests.yaml
Lines 25 to 28 in ea572aa
- name: native test | |
script: .ci/scripts/tool_runner.sh | |
# Simulator name and version must match name and version in create_simulator.sh | |
args: ["native-test", "--ios", "--ios-destination", "platform=iOS Simulator,name=Flutter-iPhone,OS=17.0"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And then in platform tests (this file), only build with CocoaPods?
Whoops, I was skimming and thought this was the build-all step. But yes, thanks for figuring out what I meant despite the confusing description.
Just a reminder, native tests will need to be run with SPM enabled because CocoaPod testing dependencies will have been removed
Right, I forgot about that.
I guess we could flip it around from the start, and do the SPM testing in-package, and the CocoaPod testing only in build-all (and, until the flag reaches stable, in stable post-submit). The reason I was thinking we should start the other way is that we could potentially break the example app for people who don't have the flag enabled without noticing if we only tested SPM in-package, but the impact of that if it happens is extremely small, so probably not worth worrying about unless it actually starts happening in practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason I was thinking we should start the other way is that we could potentially break the example app for people who don't have the flag enabled without noticing if we only tested SPM in-package
So the way I currently have set up, it builds the example app with the flag disabled, then it builds with the flag enabled, then it runs tests (still with the flag enabled).
So the example app builds with both the flag disabled (aka CocoaPods only) and enabled. I'm inclined to keep it this way so we can be sure the example app works both ways.
As for build-all, we could also do it twice - once with it disabled and once with it enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the example app builds with both the flag disabled (aka CocoaPods only) and enabled. I'm inclined to keep it this way so we can be sure the example app works both ways.
The problem is that adds about 5 minutes to each shard (a roughly 25-33% increase). If the only thing we get from that is coverage of an example app that almost nobody but us runs most of the time, and doesn't affect production clients, I don't think that's a good tradeoff of CI resources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, then yeah I think we keep build-all using CocoaPods and do platform tests with SPM (because the example app has to be built with SPM so native tests use SPM).
@stuartmorgan friendly ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one change.
await processRunner.runAndStream( | ||
flutterCommand, | ||
<String>['config', '--enable-swift-package-manager'], | ||
exitOnError: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will explode on our stable
tests (which you aren't seeing in presubmit because we only run native stable
tests on post-submit to reduce CI utilization). You'll need to gate either the whole call, or just exiting on failure, on a Platform.environment['CHANNEL'] != 'stable'
check for now, with a TODO to enable it for stable once the flag is available there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh good catch, done and validated: https://chromium-swarm.appspot.com/task?id=6929f2858af7f110
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
…s and Swift Package Manager (flutter/packages#6557)
flutter/packages@cf6d280...fde908d 2024-04-25 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 4.1.3 to 4.1.4 (flutter/packages#6609) 2024-04-24 [email protected] [go_router] Add `GoRouterState state` parameter to `GoRouterData.onExit` (flutter/packages#6495) 2024-04-24 [email protected] Add CI steps to test iOS and macOS plugins with both CocoaPods and Swift Package Manager (flutter/packages#6557) 2024-04-24 [email protected] Roll Flutter from 77043ba to dba4f77 (30 revisions) (flutter/packages#6607) 2024-04-24 [email protected] [camera] Finish converting iOS to Pigeon (flutter/packages#6601) 2024-04-24 [email protected] [go_router] Fixes an issue where route future does not complete when � (flutter/packages#6596) 2024-04-24 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Bump legacy all_packages project AGP version to 7.0.0, Gradle version to 7.0.2 (#6591)" (flutter/packages#6605) 2024-04-23 [email protected] [in_app_purchase_android] Readme update for Alternative billing (flutter/packages#6578) 2024-04-23 [email protected] Bump legacy all_packages project AGP version to 7.0.0, Gradle version to 7.0.2 (flutter/packages#6591) 2024-04-23 [email protected] Roll Flutter from 140edb9 to 77043ba (21 revisions) (flutter/packages#6599) 2024-04-23 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.25.1 to 3.25.2 (flutter/packages#6597) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https:/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…ift Package Manager (flutter#6557) Tests new Swift Package Manager feature added in flutter/flutter#146256. Fixes flutter/flutter#146901.
…ift Package Manager (flutter#6557) Tests new Swift Package Manager feature added in flutter/flutter#146256. Fixes flutter/flutter#146901.
Tests new Swift Package Manager feature added in flutter/flutter#146256.
Fixes flutter/flutter#146901.
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.