-
Notifications
You must be signed in to change notification settings - Fork 6
151 lines (130 loc) · 6.13 KB
/
breaking-changes.yml
File metadata and controls
151 lines (130 loc) · 6.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
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