Added a breaking interface test #4
Workflow file for this run
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
| name: Breaking changes | |
| permissions: | |
| contents: read | |
| on: | |
| pull_request: | |
| branches: [main] | |
| # Re-run when override labels are added or removed | |
| types: [opened, synchronize, reopened, labeled, unlabeled] | |
| jobs: | |
| proto-breaking: | |
| runs-on: ubuntu-latest | |
| env: | |
| SKIP: ${{ contains(github.event.pull_request.labels.*.name, 'breaking-change:proto') || contains(github.event.pull_request.labels.*.name, 'breaking-change:approved') }} | |
| steps: | |
| - name: Skipped — intentional breaking change (label override) | |
| if: env.SKIP == 'true' | |
| run: | | |
| echo "::notice title=Proto breaking check skipped::This PR has label breaking-change:proto or breaking-change:approved. A maintainer acknowledged an intentional proto break. Remove the label to re-enable buf breaking." | |
| - name: Checkout code | |
| if: env.SKIP != 'true' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Bun | |
| if: env.SKIP != 'true' | |
| uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 | |
| with: | |
| bun-version: 1.3.12 | |
| - name: Install dependencies | |
| if: env.SKIP != 'true' | |
| run: bun install --frozen-lockfile | |
| # cre-sdk's buf.yaml points at ../../submodules/chainlink-protos/cre, which buf rejects when | |
| # --against uses subdir=packages/cre-sdk (module path escapes the context). Run breaking on | |
| # the chainlink-protos workspace instead, comparing HEAD to the submodule commit pinned on main. | |
| - name: Buf breaking (proto) | |
| if: env.SKIP != 'true' | |
| run: | | |
| set -euo pipefail | |
| REPO="${{ github.workspace }}" | |
| SUBMODULE="${REPO}/submodules/chainlink-protos" | |
| BASE_COMMIT=$(git -C "$REPO" rev-parse origin/main:submodules/chainlink-protos) | |
| BASE_DIR="${RUNNER_TEMP}/chainlink-protos-baseline" | |
| if ! git -C "$SUBMODULE" cat-file -e "${BASE_COMMIT}^{commit}" 2>/dev/null; then | |
| git -C "$SUBMODULE" fetch --no-tags origin "${BASE_COMMIT}" | |
| fi | |
| git -C "$SUBMODULE" worktree add "${BASE_DIR}" "${BASE_COMMIT}" --detach | |
| cleanup() { | |
| git -C "$SUBMODULE" worktree remove "${BASE_DIR}" --force || true | |
| } | |
| trap cleanup EXIT | |
| (cd "$SUBMODULE" && bun x @bufbuild/buf breaking cre --against "${BASE_DIR}/cre" --error-format github-actions) | |
| ts-api-surface: | |
| runs-on: ubuntu-latest | |
| env: | |
| SKIP: ${{ contains(github.event.pull_request.labels.*.name, 'breaking-change:typescript-api') || contains(github.event.pull_request.labels.*.name, 'breaking-change:approved') }} | |
| steps: | |
| - name: Skipped — intentional breaking change (label override) | |
| if: env.SKIP == 'true' | |
| run: | | |
| echo "::notice title=TypeScript API check skipped::This PR has label breaking-change:typescript-api or breaking-change:approved. Commit an updated api-baseline.d.ts when appropriate; this label only bypasses CI." | |
| - name: Checkout code | |
| if: env.SKIP != 'true' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Bun | |
| if: env.SKIP != 'true' | |
| uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 | |
| with: | |
| bun-version: 1.3.12 | |
| - name: Install dependencies | |
| if: env.SKIP != 'true' | |
| run: bun install --frozen-lockfile | |
| - name: Compile declaration emit | |
| if: env.SKIP != 'true' | |
| working-directory: packages/cre-sdk | |
| run: bun run compile:build | |
| - name: Diff TypeScript public API vs baseline | |
| if: env.SKIP != 'true' | |
| working-directory: packages/cre-sdk | |
| run: | | |
| cat dist/index.d.ts dist/pb.d.ts \ | |
| dist/sdk/index.d.ts dist/sdk/runtime.d.ts \ | |
| dist/sdk/workflow.d.ts dist/sdk/errors.d.ts \ | |
| dist/sdk/report.d.ts > /tmp/api-current.d.ts | |
| if ! diff api-baseline.d.ts /tmp/api-current.d.ts; then | |
| echo "::error::TypeScript public API surface changed. Run 'bun run update-api-baseline' locally and commit the updated api-baseline.d.ts." | |
| exit 1 | |
| fi | |
| host-bindings: | |
| runs-on: ubuntu-latest | |
| env: | |
| SKIP: ${{ contains(github.event.pull_request.labels.*.name, 'breaking-change:host-bindings') || contains(github.event.pull_request.labels.*.name, 'breaking-change:approved') }} | |
| steps: | |
| - name: Skipped — intentional breaking change (label override) | |
| if: env.SKIP == 'true' | |
| run: | | |
| echo "::notice title=Host bindings check skipped::This PR has label breaking-change:host-bindings or breaking-change:approved. Update snapshots and host-imports-baseline.txt when appropriate; this label only bypasses CI." | |
| - name: Checkout code | |
| if: env.SKIP != 'true' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: recursive | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Bun | |
| if: env.SKIP != 'true' | |
| uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 | |
| with: | |
| bun-version: 1.3.12 | |
| - name: Install dependencies | |
| if: env.SKIP != 'true' | |
| run: bun install --frozen-lockfile | |
| - name: JS host bindings snapshot test | |
| if: env.SKIP != 'true' | |
| working-directory: packages/cre-sdk | |
| run: bun test src/sdk/wasm/host-bindings-contract.test.ts | |
| - name: Diff Rust host imports vs baseline | |
| if: env.SKIP != 'true' | |
| run: | | |
| sed -n '/unsafe extern "C"/,/^}/p' \ | |
| packages/cre-sdk-javy-plugin/src/javy_chainlink_sdk/src/lib.rs \ | |
| > /tmp/current-imports.txt | |
| if ! diff packages/cre-sdk-javy-plugin/src/javy_chainlink_sdk/host-imports-baseline.txt \ | |
| /tmp/current-imports.txt; then | |
| echo "::error::Rust host import signatures changed. Update host-imports-baseline.txt if intentional." | |
| exit 1 | |
| fi |