Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ cd platforms/swift && mint bootstrap
cd platforms/swift && ./Scripts/lint fix
```

### Public API surface

The library's public API is tracked via committed baselines under `platforms/swift/api/`, one JSON file per module (`ShopifyCheckoutProtocol.json`, `ShopifyCheckoutKit.json`, `ShopifyAcceleratedCheckouts.json`). They are produced by `xcrun swift-api-digester -dump-sdk` against the built `.swiftmodule` files. The unified `Breaking Changes` CI workflow runs `dev swift api check` on every PR that touches Swift sources and fails if the digester output for any module diverges from its committed baseline.

If your change intentionally modifies the public API:

1. Run `dev swift api dump` from the repo root to regenerate the baselines.
2. Review the diff in `platforms/swift/api/*.json` alongside your code changes.
3. Commit the updated JSON files in the same PR.

When `dev swift api check` fails, it prints both the unified diff and a `swift-api-digester -diagnose-sdk` summary categorizing the changes (removed, renamed, type/protocol/inheritance changes). Use the diagnose summary to decide whether the diff is intentional.

### Releasing a new Swift version

Open a pull request with the following changes:
Expand Down Expand Up @@ -102,7 +114,7 @@ To check for lint issues without auto-correcting:

### Public API surface

The library's public API is tracked via a committed baseline at `platforms/android/lib/api/lib.api`, managed by the [binary-compatibility-validator](https://github.com/Kotlin/binary-compatibility-validator) Gradle plugin. CI runs `./gradlew :lib:apiCheck` on every PR and fails if the compiled public API diverges from the baseline.
The library's public API is tracked via a committed baseline at `platforms/android/lib/api/lib.api`, managed by the [binary-compatibility-validator](https://github.com/Kotlin/binary-compatibility-validator) Gradle plugin. The unified `Breaking Changes` CI workflow runs `./gradlew :lib:apiCheck` on every PR that touches Android sources and fails if the compiled public API diverges from the baseline.

If your change intentionally modifies the public API:

Expand All @@ -126,3 +138,19 @@ Once merged, draft a release on GitHub:
3. Document the changes since the previous release in the description.
4. Check "Set as the latest release".
5. Click "Publish release". This kicks off the [Android publish workflow](../../actions/workflows/android-publish.yml). **A manual approval by a maintainer is required before publication to Maven Central.**

---

## React Native (`platforms/react-native/`)

### Public API surface

The library's public API is tracked via a committed report at `platforms/react-native/modules/@shopify/checkout-kit-react-native/api/checkout-kit-react-native.api.md`, generated by [@microsoft/api-extractor](https://api-extractor.com/) from the bob-produced `.d.ts` files. The unified `Breaking Changes` CI workflow runs `dev rn api check` on every PR that touches React Native sources and fails if the regenerated report diverges from the committed one.

If your change intentionally modifies the public API:

1. Run `dev rn api dump` from the repo root to regenerate the report.
2. Review the diff in `platforms/react-native/modules/@shopify/checkout-kit-react-native/api/checkout-kit-react-native.api.md` alongside your code changes.
3. Commit the updated `.api.md` file in the same PR.

If you did *not* intend to change public API and `api:check` is failing, the diff shows what your change inadvertently affected — treat it as a signal that something in your PR has consumer-visible impact.
3 changes: 0 additions & 3 deletions .github/workflows/android-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ jobs:
- name: Run Tests
run: ./gradlew clean test --console=plain

- name: Check API Surface
run: ./gradlew :lib:apiCheck --console=plain

build:
runs-on: ubuntu-latest

Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/breaking-changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Breaking Changes

on:
workflow_call:
inputs:
swift:
type: string
required: true
android:
type: string
required: true
react-native:
type: string
required: true
workflow_dispatch:
inputs:
swift:
type: string
required: false
default: 'true'
android:
type: string
required: false
default: 'true'
react-native:
type: string
required: false
default: 'true'

permissions:
contents: read

jobs:
swift:
name: Swift
if: inputs.swift == 'true'
runs-on: ${{ vars.MACOS_RUNNER }}
defaults:
run:
working-directory: platforms/swift
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Switch to Xcode 26.2
run: sudo xcode-select --switch /Applications/Xcode_26.2.app

- name: Check public Swift API baseline
run: ./Scripts/api check

android:
name: Android
if: inputs.android == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: platforms/android
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true

- name: Install JDK 1.17
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
with:
distribution: zulu
java-version: 17
cache: 'gradle'

- name: Check public Android API baseline
run: ./gradlew :lib:apiCheck --console=plain

react-native:
name: React Native
if: inputs.react-native == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: platforms/react-native
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- name: Setup Node.js, pnpm, and install dependencies
uses: ./.github/actions/setup
with:
node-version-file: platforms/react-native/package.json
cache-dependency-path: platforms/react-native/pnpm-lock.yaml
package-json-file: platforms/react-native/package.json
working-directory: platforms/react-native

- name: Check public React Native API baseline
run: pnpm module api:check
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
- 'platforms/android/**'
- '.github/workflows/android-test.yml'
- '.github/workflows/android-license-headers.yml'
- '.github/workflows/breaking-changes.yml'
- '.github/workflows/ci.yml'
swift:
- 'platforms/swift/**'
Expand All @@ -48,6 +49,7 @@ jobs:
- '.github/workflows/swift-build-samples.yml'
- '.github/workflows/swift-test-workflow.yml'
- '.github/workflows/swift-lint.yml'
- '.github/workflows/breaking-changes.yml'
- '.github/workflows/ci.yml'
reactNative:
- 'platforms/react-native/**'
Expand All @@ -57,6 +59,7 @@ jobs:
- '.github/workflows/rn-license-headers.yml'
- '.github/workflows/rn-check-packed-files.yml'
- '.github/workflows/rn-lint.yml'
- '.github/workflows/breaking-changes.yml'
- '.github/workflows/ci.yml'
web:
- 'platforms/web/**'
Expand Down Expand Up @@ -149,6 +152,19 @@ jobs:
if: needs.changes.outputs.web == 'true'
uses: ./.github/workflows/web-license-headers.yml

breaking-changes:
name: Breaking Changes
needs: changes
if: |
needs.changes.outputs.swift == 'true' ||
needs.changes.outputs.android == 'true' ||
needs.changes.outputs.reactNative == 'true'
uses: ./.github/workflows/breaking-changes.yml
with:
swift: ${{ needs.changes.outputs.swift }}
android: ${{ needs.changes.outputs.android }}
react-native: ${{ needs.changes.outputs.reactNative }}

# Single required status check for branch protection.
# Passes when every relevant platform job either succeeded or was skipped
# because no files in that platform's tree changed.
Expand All @@ -170,6 +186,7 @@ jobs:
- rn-lint
- web
- web-license-headers
- breaking-changes
runs-on: ubuntu-latest
steps:
- name: Verify all upstream jobs succeeded or were skipped
Expand Down
28 changes: 28 additions & 0 deletions dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,20 @@ commands:
`dev swift test <test_class_name>` - Run only the specified test class.
syntax: "[test_class_name]"
run: cd platforms/swift && ./Scripts/xcode_run test ShopifyCheckoutKit-Package "$1"
api:
desc: Validate or update the public Swift API baseline (platforms/swift/api/*.json)
run: |
echo "Usage: dev swift api {check|dump}"
echo ""
echo " check Verify public Swift API matches the committed baselines"
echo " dump Regenerate the Swift API baselines after intentional public API changes"
subcommands:
check:
desc: Verify public Swift API matches the committed baselines
run: cd platforms/swift && ./Scripts/api check
dump:
desc: Regenerate the Swift API baselines after intentional public API changes
run: cd platforms/swift && ./Scripts/api dump

# React Native
react-native:
Expand Down Expand Up @@ -263,3 +277,17 @@ commands:
desc: Auto-fix Swift lint and format issues
aliases: [fix]
run: cd platforms/react-native && ./scripts/lint_swift fix
api:
desc: Validate or update the public React Native API baseline (api/checkout-kit-react-native.api.md)
run: |
echo "Usage: dev rn api {check|dump}"
echo ""
echo " check Verify public RN API matches the committed report"
echo " dump Regenerate the RN API report after intentional public API changes"
subcommands:
check:
desc: Verify public RN API matches the committed report
run: cd platforms/react-native && pnpm module api:check
dump:
desc: Regenerate the RN API report after intentional public API changes
run: cd platforms/react-native && pnpm module api:dump
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
temp/
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"projectFolder": ".",
"mainEntryPointFilePath": "<projectFolder>/lib/typescript/src/index.d.ts",
"compiler": {
"tsconfigFilePath": "<projectFolder>/tsconfig.build.json"
},
"apiReport": {
"enabled": true,
"reportFolder": "<projectFolder>/api/",
"reportFileName": "checkout-kit-react-native.api.md"
},
"docModel": {
"enabled": false
},
"dtsRollup": {
"enabled": false
},
"tsdocMetadata": {
"enabled": false
},
"messages": {
"compilerMessageReporting": {
"default": {
"logLevel": "warning"
}
},
"extractorMessageReporting": {
"default": {
"logLevel": "warning"
},
"ae-missing-release-tag": {
"logLevel": "none"
},
"ae-forgotten-export": {
"logLevel": "none"
}
},
"tsdocMessageReporting": {
"default": {
"logLevel": "none"
}
}
}
}
Loading
Loading