Skip to content
Open
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
39 changes: 39 additions & 0 deletions .github/workflows/abi-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: ABI Snapshot

on:
pull_request:
paths:
- "contract/**"
- ".github/workflows/abi-snapshot.yml"
workflow_dispatch:

permissions:
contents: read

jobs:
contracts-abi:
name: ABI Snapshot Check (optional)
runs-on: ubuntu-latest
continue-on-error: true
defaults:
run:
working-directory: contract
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: contract

- name: Install Stellar CLI
run: cargo install --locked stellar-cli

- name: Check ABI snapshots
run: ./scripts/snapshot-abi.sh --check
23 changes: 21 additions & 2 deletions contract/abi-snapshots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,23 @@ can detect accidental breaking changes.

## How CI uses these

The `contracts-abi` job in CI runs:
The optional `ABI Snapshot Check` GitHub Actions job runs:

```bash
./scripts/snapshot-abi.sh --check
```

It rebuilds every contract WASM, re-generates the ABI, and diffs it against the
committed snapshot. If anything changed the job fails and the PR is blocked.
committed snapshot. If anything changed, the job reports the diff, but it is
configured as non-blocking so maintainers can decide whether to refresh the
snapshots in a follow-up commit or PR.

You can also run the same verification manually before opening a PR:

```bash
cd contract
./scripts/snapshot-abi.sh --check
```

## Intentionally updating a snapshot

Expand All @@ -29,3 +38,13 @@ committed snapshot. If anything changed the job fails and the PR is blocked.
abi-update: add pagination params to content-likes list function
```
4. Open a PR — reviewers will see the exact ABI diff in the changed files.

## Regenerating snapshots manually

If you intentionally changed a contract interface and want to refresh the
committed snapshots:

```bash
cd contract
./scripts/snapshot-abi.sh
```
Loading