Skip to content

chore(zero-swift): fail CI on undeclared public API breaks - #37

Merged
tmm merged 1 commit into
mainfrom
swift-api-check
Oct 26, 2026
Merged

tmm merged 1 commit into
mainfrom
swift-api-check

Conversation

@tmm

@tmm tmm commented Oct 26, 2026

Copy link
Copy Markdown
Member

Adds swift/scripts/api-breaks.sh and 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: a minor while zero-swift is below 1.0, a major from 1.0. The version PR and main after it pass, because swift/VERSION then 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 the wevm/zero-swift mirror: the newest tag, with this checkout's swift/ committed on top. It dumps both sides' API, removes package declarations from both (the digester includes them, and 33 of the 38 breaks it reports from 0.1.0 were package), and compares the dumps with swift-api-digester. Stripping both sides is what catches a public declaration that became package.

Checked locally (Linux, under dash too):

  • Against 0.4.7: no breaks.
  • Against 0.1.0: the 11 public JSONObject breaks from 0.4.0, none of the package ones; allowed because swift/VERSION is a minor later.
  • A public func made package, a new ConnectionStatus case, and a new LogSink requirement: all three reported, exit 1. A patch changeset still fails; a minor one passes.
  • A changed package func 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.

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>
@tmm
tmm merged commit 26dfa88 into main Oct 26, 2026
9 checks passed
@tmm
tmm deleted the swift-api-check branch October 26, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants