Skip to content

Commit

Permalink
Merge pull request #1958 from o1-labs/brian/bindings-diff
Browse files Browse the repository at this point in the history
add action to upload a patch when bindings differ
  • Loading branch information
Geometer1729 authored Dec 19, 2024
2 parents 795b060 + 19886d8 commit 1122d05
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/build-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
nix run o1js#update-bindings --max-jobs 4
#fail if this changes any files
cd src/bindings
echo If this check fails you can download a patch from the patch-upload job
echo "https://github.com/o1-labs/o1js/blob/main/README-dev.md#bindings-check-in-ci"
git diff --exit-code
- name: add build to gc-root if on main
if: github.ref == 'refs/heads/main'
Expand All @@ -39,3 +41,18 @@ jobs:
run: |
nix-store --gc --print-dead
nix-store --optimise
patch-upload:
needs: nix-build
if: ${{ failure() }}
runs-on: [sdk-self-hosted-linux-amd64-build-system]
steps:
- name: generate patch
run: |
cd src/bindings
git add .
git diff HEAD > ../../bindings.patch
- name: Upload patch
uses: actions/upload-artifact@v4
with:
name: bindings.patch
path: bindings.patch
14 changes: 14 additions & 0 deletions README-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,20 @@ In addition to building the OCaml and Rust code, the build script also generates

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

### Bindings check in ci

If the bindings check fails in CI it will upload a patch you can use to update the bindings without having to rebuild locally.
This can also be helpful when the bindings don't build identically, as unfortunately often happens.

To use this patch:
- Click details on the `Build o1js bindings / build-bindings-ubunutu` job
- Go to the `patch-upload` job and expand the logs for `Upload patch`
- Download the file linked in the last line of the logs ie.
`Artifact download URL: https://github.com/o1-labs/o1js/actions/runs/12401083741/artifacts/2339952965`
- unzip it
- navigate to `src/bindings`
- run `git apply path/to/bindings.patch`

## Development

### Branching Policy
Expand Down

0 comments on commit 1122d05

Please sign in to comment.