Add an action to upgrade all dependencies to the latest version, including new major version#10212
Open
ahoppen wants to merge 2 commits into
Open
Add an action to upgrade all dependencies to the latest version, including new major version#10212ahoppen wants to merge 2 commits into
ahoppen wants to merge 2 commits into
Conversation
bkhouri
requested changes
Jun 25, 2026
| } | ||
|
|
||
| _ = try await execute( | ||
| ["upgrade-dependencies"], |
Contributor
There was a problem hiding this comment.
Suggestion (blocking): Can we add additional automated tests that verify other scenarios? At a minimum, we should have a test that executes upgrade-dependencies:
- where the directory tree does not contains a
Package.swift. I believe this should fail withunknown package - where the
Package.swiftfile is not readable to the current user. I believe this should fail withcannot find package manifest in <path-to-Package.swift> - where 0 package depedencies have newer versions. We expect the
Package.swiftto be unchanged. - where 2 packages dependencies have newer versions
- where 3+ (multiple) packages dependencies have newer versions
- where
Package.swiftcontains package dependencies that use a package registry. Executes the same number of tests where we validate a package dependency on a git URL.
Member
Author
There was a problem hiding this comment.
Added the tests and also added support for resolving the latest version from a package registry. Thanks for that suggestion, I forgot about that.
- where 3+ (multiple) packages dependencies have newer versions
I skipped this because I don’t think there’s any significant difference between 2 and 3 updated package dependencies.
…uding new major version When maintaining a non-library package, like a service executable, you may sometimes want to update all your dependencies to the latest version, including new major versions. This is particularly common when depending on packages that have a `0.x` version. Without an explicit update of your dependency requirement, you may easily be stuck on an older version of the package and not pick up bug fixes that are, eg. included in `0.12.0` while you are still on `0.10.0`. Currently, this is a very manual process: For every package dependency, you need to eg. open the package in GitHub, check if the package has a new release and, if so, update the `from:` clause in the package manifest accordingly. This adds a new `swift package upgrade-dependencies` action, which updates the package manifest to reference all the lastest versions. If these new versions introduce API breakages, it is expected to be the user’s responsibilities to update their package accordingly.
8ab92f5 to
eac28da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I wanted to put this out here for some initial feedback. Let me know if this would require an evolution proposal.
Depends on swiftlang/swift-syntax#3366
When maintaining a non-library package, like a service executable, you may sometimes want to update all your dependencies to the latest version, including new major versions. This is particularly common when depending on packages that have a
0.xversion. Without an explicit update of your dependency requirement, you may easily be stuck on an older version of the package and not pick up bug fixes that are, eg. included in0.12.0while you are still on0.10.0.Currently, this is a very manual process: For every package dependency, you need to eg. open the package in GitHub, check if the package has a new release and, if so, update the
from:clause in the package manifest accordingly.This adds a new
swift package upgrade-dependenciesaction, which updates the package manifest to reference all the lastest versions. If these new versions introduce API breakages, it is expected to be the user’s responsibilities to update their package accordingly.