Skip to content

Commit 81a8221

Browse files
authored
Merge bc8d963 into 6a91f15
2 parents 6a91f15 + bc8d963 commit 81a8221

File tree

113 files changed

+475495
-80
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+475495
-80
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Don't lint generated files
2+
src/bindings/compiled/
3+
src/bindings/mina-transaction/gen/

.github/workflows/build-bindings.yml

Lines changed: 41 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# community can change them without being scared of breaking things, or
33
# needing to do the complicated (without nix) build setup.
44

5-
name: Build o1js bindings
5+
name: Build precompiled bindings
66

77
on:
88
pull_request:
@@ -12,8 +12,8 @@ concurrency:
1212
cancel-in-progress: true
1313

1414
jobs:
15-
check-npm-deps:
16-
name: check-npm-deps
15+
nix-builds:
16+
name: build-bindings-ubuntu
1717
runs-on: [sdk-self-hosted-linux-amd64-build-system]
1818
steps:
1919
- name: Set up Nix
@@ -23,66 +23,53 @@ jobs:
2323
- uses: actions/checkout@v4
2424
with:
2525
submodules: recursive
26-
- name: Try to build
26+
- name: Build npm-deps
27+
id: build-npm-deps
2728
run: |
2829
set -Eeu
2930
./pin.sh
30-
nix build o1js#npm-deps
31-
update-npm-deps:
32-
needs: check-npm-deps
33-
if: ${{ failure() }}
34-
runs-on: [sdk-self-hosted-linux-amd64-build-system]
35-
steps:
36-
- name: Set up Nix
37-
run: echo "PATH=$PATH:/nix/var/nix/profiles/default/bin" >> $GITHUB_ENV
38-
- name: update-hash
39-
run: nix run o1js#update-npm-deps
40-
- uses: parkerbxyz/suggest-changes@v1
41-
with:
42-
comment: 'please update the npm-deps-hash'
43-
event: 'REQUEST_CHANGES'
44-
45-
nix-build:
46-
name: build-bindings-ubuntu
47-
runs-on: [sdk-self-hosted-linux-amd64-build-system]
48-
steps:
49-
- name: Set up Nix
50-
run: echo "PATH=$PATH:/nix/var/nix/profiles/default/bin" >> $GITHUB_ENV
51-
- name: Disable smudging
52-
run: echo "GIT_LFS_SKIP_SMUDGE=1" >> $GITHUB_ENV
53-
- uses: actions/checkout@v4
31+
if ! nix build o1js#npm-deps
32+
then
33+
echo npmDepsHash out of date
34+
echo a fix will be pushed to ${{ github.head_ref }}-ci-fix
35+
echo please run ./use-ci-fix.sh
36+
exit 1
37+
fi
38+
- name: fix npmDepsHash
39+
if: failure() && steps.build-npm-deps.outcome == 'failure'
40+
run: |
41+
set -Eeu
42+
./pin.sh
43+
nix run o1js#update-npm-deps
44+
- name: Commit changes
45+
if: failure() && steps.build-npm-deps.outcome == 'failure'
46+
uses: stefanzweifel/git-auto-commit-action@v5
5447
with:
55-
submodules: recursive
48+
commit_message: "update npmDepsHash"
49+
file_pattern: 'npmDepsHash'
50+
branch: ${{ github.head_ref}}-ci-fix
51+
create_branch: true
5652
- name: Build the o1js bindings
53+
id: bindings-build
5754
run: |
5855
set -Eeu
59-
./pin.sh
6056
nix run o1js#update-bindings --max-jobs 4
61-
#fail if this changes any files
62-
cd src/bindings
63-
echo If this check fails you can download a patch from the patch-upload job
64-
echo "https://github.com/o1-labs/o1js/blob/main/README-dev.md#bindings-check-in-ci"
65-
git diff --exit-code
57+
if ! git diff --name-only --exit-code src/bindings
58+
then
59+
echo bindings need to be rebuilt
60+
echo a fix will be pushed to ${{ github.head_ref }}-ci-fix
61+
echo please run ./use-ci-fix.sh
62+
exit 1
63+
fi
64+
- name: Commit new bindings
65+
if: failure() && steps.bindings-build.outcome == 'failure'
66+
uses: stefanzweifel/git-auto-commit-action@v5
67+
with:
68+
commit_message: "recompile bindings"
69+
file_pattern: 'src/bindings/*'
70+
branch: ${{ github.head_ref}}-ci-fix
71+
create_branch: true
6672
- name: add build to gc-root if on main
6773
if: github.ref == 'refs/heads/main'
6874
run: |
6975
nix build o1js#o1js-bindings --out-link /home/app/actions-runner/nix-cache/main-bindings-gcroot
70-
- name: Cleanup the Nix store
71-
run: |
72-
nix-store --gc --print-dead
73-
nix-store --optimise
74-
patch-upload:
75-
needs: nix-build
76-
if: ${{ failure() }}
77-
runs-on: [sdk-self-hosted-linux-amd64-build-system]
78-
steps:
79-
- name: generate patch
80-
run: |
81-
cd src/bindings
82-
git add .
83-
git diff HEAD --textconv --text > ../../bindings.patch
84-
- name: Upload patch
85-
uses: actions/upload-artifact@v4
86-
with:
87-
name: bindings.patch
88-
path: bindings.patch

.github/workflows/lint.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ jobs:
2828
id: get_changed_files
2929
run: |
3030
git fetch origin main --depth=1
31-
CHANGED_FILES=$(git diff --name-only origin/main | grep -E '\.(ts|js)$' || true)
32-
31+
# TODO ideally lint the non-generated files in src/bindings/
32+
CHANGED_FILES=$(git diff --name-only origin/main | grep -E '\.(ts|js)$' | grep -v 'src/bindings/*' || true)
33+
3334
if [ -n "$CHANGED_FILES" ]; then
3435
echo "Files changed:"
3536
echo "$CHANGED_FILES"

.github/workflows/nix-clean.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This is the slowest part of the CI now so I think it's better to just do it daily
2+
# instead of every commit
3+
name: Clean nix store
4+
5+
on:
6+
schedule:
7+
- cron: '0 0 * * *' # once per day at midnight
8+
workflow_dispatch: # can be run with gh workflow run 'Clean nix store'
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
nix-cleanup:
16+
- name: Set up Nix
17+
run: echo "PATH=$PATH:/nix/var/nix/profiles/default/bin" >> $GITHUB_ENV
18+
- name: Cleanup the Nix store
19+
if: always()
20+
run: |
21+
nix-store --gc --print-dead
22+
nix-store --optimise
23+

.github/workflows/nix.yml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
name: nix
2-
on:
3-
workflow_dispatch:
4-
inputs:
5-
name:
6-
description: 'Commit nix fixes'
7-
default: 'World'
8-
required: true
1+
name: nix # Change to Update mina after testing
92

10-
concurrency:
11-
group: ${{ github.workflow }}-${{ github.ref }}
12-
cancel-in-progress: true
3+
on:
4+
#schedule:
5+
# - cron: '0 0 * * 0' # Runs every sunday
6+
workflow_dispatch: # Empty workflow_dispatch trigger
137

148
jobs:
15-
nix-fixes:
16-
runs-on: [sdk-self-hosted-linux-amd64-build-system]
9+
update-and-create-pr:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
pull-requests: write
1713
steps:
1814
- name: Set up Nix
1915
run: echo "PATH=$PATH:/nix/var/nix/profiles/default/bin" >> $GITHUB_ENV
@@ -22,3 +18,23 @@ jobs:
2218
- uses: actions/checkout@v4
2319
with:
2420
submodules: recursive
21+
- name: Build the o1js bindings
22+
run: |
23+
pushd src/mina
24+
git switch compatible
25+
git pull
26+
popd
27+
git add src/mina
28+
nix run o1js#update-bindings --max-jobs 4
29+
30+
- name: Create Pull Request
31+
uses: peter-evans/create-pull-request@v5
32+
with:
33+
token: ${{ secrets.GITHUB_TOKEN }}
34+
commit-message: Update mina
35+
title: '[Automated] Update mina'
36+
body: |
37+
This PR is automatically generated to update inputs.
38+
Please review the changes and merge if appropriate.
39+
branch: automated-input-update
40+
base: main

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[submodule "src/o1js-bindings"]
2-
path = src/bindings
3-
url = https://github.com/o1-labs/o1js-bindings.git
41
[submodule "src/mina"]
52
path = src/mina
63
url = https://github.com/MinaProtocol/mina.git

CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55
# We are relying on good faith to wait for admin approval on these PRs
66
# Dangerous PRs that could release a new version, new consensus rules, or anything like that will necessarily touch more than `/src/lib`, so this is minimally risky
77
/src/lib @o1-labs/o1js-admins @o1-labs/exploration-team @o1-labs/future-zkapps
8+
9+
# Taken from o1js0-bindings
10+
/CODEOWNERS @bkase @mitschabaude @mrmr1993
11+
/src/bindings @o1-labs/eng

flake.lock

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description = "o1js - TypeScript framework for zk-SNARKs and zkApps";
33
inputs = {
44
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11-small";
5-
mina.url = "path:src/mina";
5+
mina.url = "git+file:src/mina?submodules=1";
66
nixpkgs-mozilla.url = "github:mozilla/nixpkgs-mozilla";
77
nixpkgs-mozilla.flake = false;
88
describe-dune.url = "github:o1-labs/describe-dune";
@@ -119,7 +119,7 @@
119119
[
120120
nodejs
121121
nodePackages.npm
122-
#nodePackages.prettier
122+
nodePackages.prettier
123123
typescript
124124
nodePackages.typescript-language-server
125125
rustup

src/bindings

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)