name: API Surface Diff
on:
pull_request:
branches: [main]
permissions:
contents: read
concurrency:
group: api-surface-diff-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
api-surface-diff:
name: Public API diff (report-only)
runs-on: ubuntu-latest
continue-on-error: true
timeout-minutes: 45
env:
TOOLCHAIN: nightly-2026-10-29
steps:
- name: Checkout PR head
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
path: pr
persist-credentials: false
- name: Checkout PR base
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 with:
ref: ${{ github.event.pull_request.base.sha }}
path: base
persist-credentials: false
- name: Setup Rust toolchain (nightly-2026-10-29)
working-directory: pr
run: bash scripts/setup_rust.sh "$TOOLCHAIN"
shell: bash
- name: Install protoc (sdforge build dep)
uses: taiki-e/install-action@b80e2bb2635f28eb98b9fce1e2f0887e1535c6b2 with:
tool: protoc
- name: Generate base public API
working-directory: base
run: |
cargo "+${TOOLCHAIN}" rustdoc --features full --lib -- \
-Zunstable-options --output-format json
python3 ../pr/scripts/api_surface.py target/doc/garrison.json \
> /tmp/api-surface.baseline.txt
- name: Generate PR public API and diff
working-directory: pr
run: bash scripts/api_surface.sh --diff /tmp/api-surface.baseline.txt
- name: Upload API diff artifacts
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 with:
name: api-surface-diff
path: |
pr/logs/api-surface.txt
pr/logs/api-surface-diff.json
if-no-files-found: warn
retention-days: 30