Skip to content

Commit 1122d05

Browse files
authored
Merge pull request #1958 from o1-labs/brian/bindings-diff
add action to upload a patch when bindings differ
2 parents 795b060 + 19886d8 commit 1122d05

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

.github/workflows/build-bindings.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030
nix run o1js#update-bindings --max-jobs 4
3131
#fail if this changes any files
3232
cd src/bindings
33+
echo If this check fails you can download a patch from the patch-upload job
34+
echo "https://github.com/o1-labs/o1js/blob/main/README-dev.md#bindings-check-in-ci"
3335
git diff --exit-code
3436
- name: add build to gc-root if on main
3537
if: github.ref == 'refs/heads/main'
@@ -39,3 +41,18 @@ jobs:
3941
run: |
4042
nix-store --gc --print-dead
4143
nix-store --optimise
44+
patch-upload:
45+
needs: nix-build
46+
if: ${{ failure() }}
47+
runs-on: [sdk-self-hosted-linux-amd64-build-system]
48+
steps:
49+
- name: generate patch
50+
run: |
51+
cd src/bindings
52+
git add .
53+
git diff HEAD > ../../bindings.patch
54+
- name: Upload patch
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: bindings.patch
58+
path: bindings.patch

README-dev.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,20 @@ In addition to building the OCaml and Rust code, the build script also generates
8686

8787
o1js uses these types to ensure that the constants used in the protocol are consistent with the OCaml source files.
8888

89+
### Bindings check in ci
90+
91+
If the bindings check fails in CI it will upload a patch you can use to update the bindings without having to rebuild locally.
92+
This can also be helpful when the bindings don't build identically, as unfortunately often happens.
93+
94+
To use this patch:
95+
- Click details on the `Build o1js bindings / build-bindings-ubunutu` job
96+
- Go to the `patch-upload` job and expand the logs for `Upload patch`
97+
- Download the file linked in the last line of the logs ie.
98+
`Artifact download URL: https://github.com/o1-labs/o1js/actions/runs/12401083741/artifacts/2339952965`
99+
- unzip it
100+
- navigate to `src/bindings`
101+
- run `git apply path/to/bindings.patch`
102+
89103
## Development
90104

91105
### Branching Policy

0 commit comments

Comments
 (0)