Skip to content
Merged
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
128 changes: 128 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributing

The following is a set of guidelines for contributing to this project. Please take a moment to read through them before submitting your first PR.

This is a monorepo containing the iOS/Swift, Android, and (forthcoming) React Native implementations of the Shopify Checkout Kit. Each platform has its own conventions, tooling, and release process; the shared guidelines below apply to all of them.

## Code of Conduct

This project and everyone participating in it are governed by the [Code of Conduct](./CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [opensource@shopify.com](mailto:opensource@shopify.com).

## Welcomed contributions

- Reporting issues with existing features
- Bug fixes
- Performance improvements
- Documentation
- Usability improvements

## Things we won't merge

- Additional dependencies that limit SDK use (e.g. unnecessary Swift or Android dependencies)
- Any changes that break existing tests
- Any changes without sufficient tests

## Proposing features

When in doubt about whether we will be interested in including a new feature, please open an issue to propose the feature so we can confirm scope before it is implemented.

**NOTE**: Issues that have not been active for 30 days will be marked as stale, and subsequently closed after a further 7 days of inactivity.

## How to contribute (general flow)

1. Fork the repo and branch off of `main`.
2. Create a feature branch in your fork.
3. Make changes and add any relevant tests.
4. Run the platform-specific formatter / linter (see below).
5. Verify the changes locally (e.g. via the platform's sample app).
6. Commit your changes and push.
7. Ensure all checks (tests, lint) are passing in GitHub.
8. Open a pull request with a detailed description of what is changing and why.

---

## Swift (`swift/`)

### Prerequisites

This project uses [Mint](https://github.com/yonaskolb/Mint) to manage Swift linting tools (SwiftLint and SwiftFormat) at pinned versions via `swift/Mintfile`. This ensures consistent formatting across all contributors and CI.

**Shopify employees** (from `swift/`):

```bash
dev up
```

**External contributors**:

```bash
brew install mint
cd swift && mint bootstrap
```

### Formatting

```bash
cd swift && ./Scripts/lint fix
```

### Releasing a new Swift version

Open a pull request with the following changes:

1. Bump the package version in `swift/Sources/ShopifyCheckoutSheetKit/ShopifyCheckoutSheetKit.swift`.
2. Bump the podspec version in `swift/ShopifyCheckoutSheetKit.podspec`.
3. Add an entry to the top of `swift/CHANGELOG.md`.

Once merged, draft a release on GitHub:

1. Create a tag with the bare semver name (e.g. `3.8.1`) — Swift releases use bare semver so SwiftPM consumers can resolve them with `from:` constraints.
2. Use the same tag as the release name.
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 [Swift deploy workflow](../../actions/workflows/swift-deploy.yml) which publishes the new version to CocoaPods.

---

## Android (`android/`)

### Formatting

This project uses [detekt](https://detekt.dev/) for Kotlin linting and formatting. From `android/`:

```bash
./gradlew detekt --auto-correct
```

To check for lint issues without auto-correcting:

```bash
./gradlew detekt
```

### Public API surface

The library's public API is tracked via a committed baseline at `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.

If your change intentionally modifies the public API:

1. Run `dev api dump` (or `./gradlew :lib:apiDump`) from `android/` to regenerate the baseline.
2. Review the diff in `android/lib/api/lib.api` alongside your code changes.
3. Commit the updated `.api` file in the same PR.

If you did *not* intend to change public API and `apiCheck` is failing, the diff shows what your change inadvertently affected — treat it as a signal that something in your PR has consumer-visible impact.

### Releasing a new Android version

Open a pull request with the following changes:

1. Bump the `versionName` in `android/lib/build.gradle`.
2. Add an entry to the top of `android/CHANGELOG.md`.

Once merged, draft a release on GitHub:

1. Create a tag prefixed with `android/` (e.g. `android/3.0.1`) — Android releases use the `android/` prefix so the Maven publish workflow can distinguish them from Swift releases.
2. Use the same tag as the release name.
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 deploy workflow](../../actions/workflows/android-deploy.yml). **A manual approval by a maintainer is required before publication to Maven Central.**
19 changes: 13 additions & 6 deletions android/.github/dependabot.yml → .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ updates:
interval: weekly
cooldown:
default-days: 7

# Main library
- package-ecosystem: gradle

- package-ecosystem: swift
directory: "/"
schedule:
interval: daily
cooldown:
default-days: 7

# Android library
- package-ecosystem: gradle
directory: "/android"
schedule:
interval: daily
open-pull-requests-limit: 10
Expand All @@ -28,10 +35,10 @@ updates:
# Keep JUnit on 4.x (JUnit 5 incompatible with Robolectric)
- dependency-name: "junit:junit"
versions: [">=5.0.0"]
# MobileBuyIntegration sample

# Android sample app
- package-ecosystem: gradle
directory: "/samples/MobileBuyIntegration"
directory: "/android/samples/MobileBuyIntegration"
schedule:
interval: daily
open-pull-requests-limit: 5
Expand Down
42 changes: 42 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
### What changes are you making?

<!-- Please describe why you are making these changes -->

### How to test

<!-- Please outline the steps to test your changes -->

---

### Before you merge

> [!IMPORTANT]
>
> - [ ] I've added tests to support my implementation
> - [ ] I have read and agree with the [Contribution Guidelines](./CONTRIBUTING.md)
> - [ ] I have read and agree with the [Code of Conduct](./CODE_OF_CONDUCT.md)
> - [ ] I've updated the relevant platform README (`swift/README.md` and/or `android/README.md`)

---

<details>
<summary>Releasing a new Swift version?</summary>

- [ ] I have bumped the version in `swift/ShopifyCheckoutSheetKit.podspec`
- [ ] I have bumped the version in `swift/Sources/ShopifyCheckoutSheetKit/ShopifyCheckoutSheetKit.swift`
- [ ] I have updated `swift/CHANGELOG.md`
- [ ] I have updated the SwiftPM/CocoaPods version snippets in `swift/README.md` (major version only)

</details>

<details>
<summary>Releasing a new Android version?</summary>

- [ ] I have bumped the `versionName` in `android/lib/build.gradle`
- [ ] I have updated `android/CHANGELOG.md`
- [ ] I have updated the Gradle/Maven version snippets in `android/README.md`

</details>

> [!TIP]
> See the [Contributing documentation](./CONTRIBUTING.md) for the full release process per platform.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy to Maven Central
name: Android — Deploy to Maven Central

on:
release:
Expand All @@ -8,14 +8,21 @@ on:

jobs:
build:
# Only run for Android releases. Android releases are tagged `android/X.Y.Z`;
# Swift releases use bare semver (`X.Y.Z`).
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'android/') }}
environment:
name: Central Repository Deployment

runs-on: ubuntu-latest

env:
OSSRH_API_BASE_URL: https://ossrh-staging-api.central.sonatype.com

defaults:
run:
working-directory: android

steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
name: Check License Headers
name: Android — Check License Headers

on: pull_request
on:
pull_request:
paths:
- 'android/**'
- '.github/workflows/android-license-headers.yml'

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: android

steps:
- name: Checkout Repository
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
name: Lint, Build & Run Tests
name: Android — Lint, Build & Run Tests

on:
push:
branches:
- main
paths:
- 'android/**'
- '.github/workflows/android-test.yml'
pull_request:
paths:
- 'android/**'
- '.github/workflows/android-test.yml'
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: android

steps:
- name: Checkout Repository
Expand Down Expand Up @@ -48,14 +57,17 @@ jobs:

- name: Setup sample app environment
run: cp .env.example .env
working-directory: samples/MobileBuyIntegration
working-directory: android/samples/MobileBuyIntegration

- name: Build Sample App
run: ./gradlew assembleDebug
working-directory: samples/MobileBuyIntegration
working-directory: android/samples/MobileBuyIntegration

lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: android

steps:
- name: Checkout Repository
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
actions: write
pull-requests: write
if: |
(github.event.issue.pull_request
(github.event.issue.pull_request
&& !github.event.issue.pull_request.merged_at
&& contains(github.event.comment.body, 'signed')
)
)
|| (github.event.pull_request && !github.event.pull_request.merged)
steps:
- uses: Shopify/shopify-cla-action@v1
Expand Down
File renamed without changes.
26 changes: 26 additions & 0 deletions .github/workflows/swift-build-samples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Swift — Build Sample Apps

on:
push:
branches:
- main
paths:
- 'swift/**'
- 'Package.swift'
- 'Package.resolved'
- '.github/workflows/swift-build-samples.yml'
- '.github/workflows/swift-test-workflow.yml'
pull_request:
paths:
- 'swift/**'
- 'Package.swift'
- 'Package.resolved'
- '.github/workflows/swift-build-samples.yml'
- '.github/workflows/swift-test-workflow.yml'
workflow_dispatch:

jobs:
call-workflow-passing-data:
uses: ./.github/workflows/swift-test-workflow.yml
with:
test-path: ./Scripts/build_samples
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy
name: Swift — Deploy

on:
release:
Expand All @@ -8,14 +8,23 @@ on:

jobs:
cocoapods:
# Only run for Swift releases. Android releases are tagged `android/X.Y.Z`;
# Swift releases use bare semver (`X.Y.Z`).
if: ${{ github.event_name == 'workflow_dispatch' || !startsWith(github.event.release.tag_name, 'android/') }}
runs-on: ${{ vars.MACOS_RUNNER }}
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/swift/Gemfile
defaults:
run:
working-directory: swift

steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: ruby/setup-ruby@dffb23f65a78bba8db45d387d5ea1bbd6be3ef18 # v1.293.0
with:
bundler-cache: true
working-directory: swift

- name: Deploy to Cocoapods
run: |
Expand Down
Loading