Repository navigation
chore(zero-swift): fail CI on undeclared public API breaks - #37
Merged
Merged
Conversation
swift/scripts/api-breaks.sh dumps the public API of the last release (the mirror's newest tag) and of this checkout, with the digester, in a scratch repository shaped like the mirror, removes package declarations from both dumps, and compares them. It fails on a break unless a pending changeset or the version being released bumps zero-swift by a minor (below 1.0) or a major. Linux and macOS CI run it; macOS covers the Apple-only API. Amp-Thread-ID: https://ampcode.com/threads/T-c513a037-a257-45e0-b9a9-15c15edfe859 Co-authored-by: tmm <tmm@tmm.dev>
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.
Adds
swift/scripts/api-breaks.shand runs it in Swift (Linux) and Swift (macOS). It lists the public API breaks since the last release and fails unless a changeset declares them: aminorwhile zero-swift is below 1.0, amajorfrom 1.0. The version PR and main after it pass, becauseswift/VERSIONthen carries the bump.How: Apple's digester (
swift package diagnose-api-breaking-changes) needs the package at a git root, so the script builds a scratch repo shaped like thewevm/zero-swiftmirror: the newest tag, with this checkout'sswift/committed on top. It dumps both sides' API, removespackagedeclarations from both (the digester includes them, and 33 of the 38 breaks it reports from 0.1.0 werepackage), and compares the dumps withswift-api-digester. Stripping both sides is what catches apublicdeclaration that becamepackage.Checked locally (Linux, under dash too):
JSONObjectbreaks from 0.4.0, none of thepackageones; allowed becauseswift/VERSIONis a minor later.package, a newConnectionStatuscase, and a newLogSinkrequirement: all three reported, exit 1. Apatchchangeset still fails; aminorone passes.packagefunc signature: no breaks.The macOS step covers ZeroUI and the Apple-only parts of ZeroVirtual, which Linux doesn't build; this PR's CI is its first run there.
No changeset: the package doesn't change.