Repository navigation
Check in CI that spm deinit takes the template app back to CocoaPods - #59783
Conversation
116499b to
7ffb988
Compare
cipolleschi
left a comment
There was a problem hiding this comment.
Thanks for adding this, it's the check I was asking for on #59742. 🙏
My main concern is where it runs. e2e-ios-templateapp.yml exists for the Maestro tests, and it's a bad place for a check that fails the same way every time:
- The
testjob hasneeds: build. If the deinit check fails in either flavor, the Maestro tests are skipped for both. A bug in the SwiftPM tooling would then hide the template E2E results. test-all.ymlreruns the whole workflow up to twice when it fails (test_e2e_ios_templateapp_retry_1/_retry_2). Those retries are for flaky Maestro runs. A deinit failure won't go away on retry, so we'd pay for three template builds onmacos-26-largebefore we see it.- The failure gets reported through
recordJobFailure/reportTestResultsas an E2E failure, which is misleading.
Could we move the check to test-ios-spm-newapp.yml, or to the end of the SwiftPM path in the test-ios-helloworld action? Both already run spm add --deintegrate, they don't retry, and they fail where people look for SwiftPM problems. It's also enough to run it in one flavor: deinit doesn't depend on the flavor.
Separately, and not something this PR has to do: the iOS template app still builds inside the retried E2E workflow, so every retry rebuilds it. #59135 (Maestro on remote simulators) doesn't change that: test-all.yml doesn't pass artifact-run-id, and test still needs build. #59646 also changes this file and keeps the build in the retry loop on purpose. Building the template in its own job, as RNTester and the Android template already do, would make it cleaner to add checks like this one to that job later.
One more question: going back to CocoaPods means spm deinit and then pod install. The CocoaPods jobs from #59742 only build apps that were never converted, so no job runs the full round trip. Could we add pod install plus a Debug workspace build after deinit, in one cell? A follow-up PR is fine too.
| # This source code is licensed under the MIT license found in the | ||
| # LICENSE file in the root directory of this source tree. | ||
|
|
||
| # Checks that `npx react-native spm deinit` left an iOS app with only its |
There was a problem hiding this comment.
nit: the script fails on any packageReferences / packageProductDependencies in the pbxproj, so it assumes the app had no Swift packages before spm add. That's true for the template, but the header says it checks "an iOS app". Can we say that in the comment, so nobody reuses the script on an app that already has Swift packages?
No CI job tested the CocoaPods opt-out: after the SwiftPM build, nothing ran `spm deinit` or looked at the files it leaves. The template app job now records the Podfile and ios/.gitignore checksums before `spm add`, runs `spm deinit` after the app upload, and checks that the Podfile and .gitignore are unchanged, the marker and ReactNativeSPM/ are gone, and the Xcode project and shared scheme have no SwiftPM references left. The check reads files only; `deinit` does not run `pod install`.
…th CocoaPods after it
f34512d to
bf87974
Compare
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D130158963. |
cortinico
left a comment
There was a problem hiding this comment.
Review automatically exported from Phabricator review in Meta.
|
This pull request was successfully merged by @chrfalch in 676c516 When will my fix make it into a release? | How to file a pick request? |
Summary
npx react-native spm deinittakes an app from SwiftPM back to CocoaPods. No CI job tests this today. The unit tests mockpodandxcodebuild, and no job runsdeinit. The CocoaPods jobs build apps that were never converted. A later change could break the way back without any failing check.This PR adds the full round trip to the SwiftPM new-app job (
test-ios-spm-newapp.yml), in the Debug cell only.deinitdoes not depend on the flavor, and the job does not retry, so a failure shows up once, where people look for SwiftPM problems.spm add, the job runsassert-spm-deinit.sh record. It saves the sha256 ofios/Podfileandios/.gitignore(orabsent), and fails at once if the Podfile is missing. The job also copiesios/.npx react-native spm deinit.diff -rbetween the copy andios/. This is for information only and never fails the job. It also prints when a later step fails.assert-spm-deinit.sh checkthen checks:.gitignoreis byte-identical, or gone if it was absent before;.spm-injected.jsonmarker andios/ReactNativeSPM/are gone;project.pbxprojhas no SwiftPM package references, product dependencies,ReactNativeSPMpaths, or SwiftPM build phases;pod installthe same way as the HelloWorld CocoaPods job, then builds the workspace in Debug for the simulator.The Debug cell takes longer now, because it runs
pod installand a second app build. The Release cell is unchanged.The check assumes the app had no Swift packages before
spm add. The script header says so.Changelog:
[INTERNAL] [ADDED] - CI check that
spm deinittakes an app back to CocoaPods and that the app then buildsTest Plan:
I ran the script locally on copies of
private/helloworld/ioswith a test Podfile:record: prints and writes both checksums; with no Podfile it fails with a clear error.checkafter a realdeinit: passes.checkwith nodeinit: fails with one error for each SwiftPM change still in place.bash -npasses on the script, and the workflow YAML parses.Not run locally: shellcheck (not installed), and the workflow itself. CI on this PR runs it.