Add Swift and React Native public API baselines#130
Draft
kieran-osgood-shopify wants to merge 1 commit into
Draft
Add Swift and React Native public API baselines#130kieran-osgood-shopify wants to merge 1 commit into
kieran-osgood-shopify wants to merge 1 commit into
Conversation
8cedc11 to
e8b77cc
Compare
## Summary
Brings Swift and React Native to parity with Android's existing
`binary-compatibility-validator` baselining, gated by a new unified
`Breaking Changes` CI workflow.
- **Swift** — `platforms/swift/Scripts/api {check,dump}` wraps
`xcrun swift-api-digester` and produces a JSON baseline per module
(`ShopifyCheckoutProtocol`, `ShopifyCheckoutKit`, `ShopifyAcceleratedCheckouts`).
Check failures print both a `diff -u` and a `-diagnose-sdk` summary.
- **React Native** — `@microsoft/api-extractor` produces
`api/checkout-kit-react-native.api.md` from the bob-built `.d.ts` files.
A small `scripts/prepare-api-extract.mjs` preprocess works around the
source's hand-written ambient `*.d.ts` files (see Notes).
- **CI** — new reusable `.github/workflows/breaking-changes.yml` with
Swift / Android / React Native jobs, wired into `ci.yml` via
`dorny/paths-filter` and added to the `ci-required` aggregate. Android's
legacy `Check API Surface` step in `android-test.yml` moves into the new
workflow.
- **dev.yml** — `dev swift api {check,dump}` and `dev rn api {check,dump}`.
- **Docs** — `.github/CONTRIBUTING.md` generalised; new Swift + RN
"Public API surface" sections.
## Test plan
- [ ] `Breaking Changes` workflow runs green on this PR's first push.
- [ ] Locally, `dev swift api check` exits 0 against committed baselines.
- [ ] Locally, `pnpm module api:check` exits 0 against committed report.
- [ ] Confirm a transient breaking change (add/remove a public symbol on a
throwaway commit) flips both checks to failure with readable output,
then revert.
## Notes for reviewers
- The RN `prepare-api-extract.mjs` deviation is necessary because the
source uses `index.ts` alongside a hand-written ambient `index.d.ts`;
after bob compiles, the emitted `lib/typescript/src/index.d.ts` re-imports
`./index.d` which TS resolves back to itself and blows api-extractor's
stack. The preprocess relocates the source `.d.ts` files to
`lib/typescript/src/_types/` and rewrites the imports. Happy to switch to
renaming the source `.d.ts` files if reviewers prefer that path.
- `temp/` (api-extractor scratch) is gitignored in this PR.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
e8b77cc to
e1b64e5
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.

What changes are you making?
Android currently has an API dump and API check command that helps us snapshot and determine any public API drift.
this change brings the same dump and check snapshotting ability to React Native and Swift. and wires them in as blocking CI steps when we detect a public change in order to get the CIO passing, you'll need to regenerate the snapshot so that there's no drift detected on CI.
How to test
Example failing CI run for a branch that hadn't rebased to include mains changes of removing ec_color_scheme
https://github.com/Shopify/checkout-kit/actions/runs/25923211711/job/76197466792?pr=130
Before you merge
Important
platforms/swift/README.mdand/orplatforms/android/README.md)Releasing a new Swift version?
ShopifyCheckoutKit.podspecplatforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swiftplatforms/swift/CHANGELOG.mdplatforms/swift/README.md(major version only)Releasing a new Android version?
versionNameinplatforms/android/lib/build.gradleplatforms/android/CHANGELOG.mdplatforms/android/README.mdTip
See the Contributing documentation for the full release process per platform.