From 449e41c1ffbded4b64bf9cde7a97fd8670d7647c Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 17 Jun 2024 17:53:58 +0100 Subject: [PATCH] chore: automate necessary changes to outward sync into noir-lang/noir (#7049) This PR automates syncs out to noir-lang/noir similarly to how it was done for inward syncs. The main difference is that we need to save the version of `bb` which noir-lang/noir is using so we can restore it on any outward sync. We then save the version of bb.js last seen on every inbound sync into the `bb-version` file and reapply it on outbound syncs. --- .github/workflows/mirror-noir-subrepo.yml | 6 ++++++ .github/workflows/pull-noir.yml | 4 ++-- noir/bb-version | 1 + .../{sync-fixup.sh => sync-in-fixup.sh} | 2 ++ noir/scripts/sync-out-fixup.sh | 18 ++++++++++++++++++ 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 noir/bb-version rename noir/scripts/{sync-fixup.sh => sync-in-fixup.sh} (89%) create mode 100755 noir/scripts/sync-out-fixup.sh diff --git a/.github/workflows/mirror-noir-subrepo.yml b/.github/workflows/mirror-noir-subrepo.yml index abcae31ac0a..9ca0d61d2ca 100644 --- a/.github/workflows/mirror-noir-subrepo.yml +++ b/.github/workflows/mirror-noir-subrepo.yml @@ -96,6 +96,12 @@ jobs: git config --file="$SUBREPO_PATH/.gitrepo" subrepo.commit "$BASE_NOIR_COMMIT" # make a new commit with our previous message git commit -am "$COMMIT_MESSAGE" + + # There's various changes which we need to make to account for CI differences so we run this script to apply them. + git checkout origin/master -- noir/scripts/sync-out-fixup.sh + noir/scripts/sync-out-fixup.sh + git commit -am "chore: apply sync fixes" + # Now push to it with subrepo with computed commit messages if ./scripts/git-subrepo/lib/git-subrepo push $SUBREPO_PATH --squash --branch=$STAGING_BRANCH; then # We don't push a commit to aztec anymore so that we can maintain the 'commit' as our last pull branch diff --git a/.github/workflows/pull-noir.yml b/.github/workflows/pull-noir.yml index fdd990816c2..b1ca0cc7bbf 100644 --- a/.github/workflows/pull-noir.yml +++ b/.github/workflows/pull-noir.yml @@ -101,8 +101,8 @@ jobs: git commit -am "[$LINES changes] $COMMIT_MESSAGE" # There's various changes which we need to make to account for CI differences so we run this script to apply them. - git checkout origin/master -- noir/scripts/sync-fixup.sh - noir/scripts/sync-fixup.sh + git checkout origin/master -- noir/scripts/sync-in-fixup.sh + noir/scripts/sync-in-fixup.sh git commit -am "chore: apply sync fixes" git push origin $STAGING_BRANCH --force diff --git a/noir/bb-version b/noir/bb-version new file mode 100644 index 00000000000..72a8a6313bb --- /dev/null +++ b/noir/bb-version @@ -0,0 +1 @@ +0.41.0 diff --git a/noir/scripts/sync-fixup.sh b/noir/scripts/sync-in-fixup.sh similarity index 89% rename from noir/scripts/sync-fixup.sh rename to noir/scripts/sync-in-fixup.sh index 1f1152d1cee..ba3c591eac4 100755 --- a/noir/scripts/sync-fixup.sh +++ b/noir/scripts/sync-in-fixup.sh @@ -5,6 +5,8 @@ cd $(dirname $0)/../noir-repo tmp=$(mktemp) BACKEND_BARRETENBERG_PACKAGE_JSON=./tooling/noir_js_backend_barretenberg/package.json + +jq -r '.dependencies."@aztec/bb.js"' $BACKEND_BARRETENBERG_PACKAGE_JSON > ../bb-version jq '.dependencies."@aztec/bb.js" = "portal:../../../../barretenberg/ts"' $BACKEND_BARRETENBERG_PACKAGE_JSON > $tmp && mv $tmp $BACKEND_BARRETENBERG_PACKAGE_JSON # This script runs in CI which enforces immutable installs by default, diff --git a/noir/scripts/sync-out-fixup.sh b/noir/scripts/sync-out-fixup.sh new file mode 100755 index 00000000000..79976883d0b --- /dev/null +++ b/noir/scripts/sync-out-fixup.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -eu + +cd $(dirname $0)/../noir-repo + +BB_VERSION=$(cat ../bb-version) + +tmp=$(mktemp) +BACKEND_BARRETENBERG_PACKAGE_JSON=./tooling/noir_js_backend_barretenberg/package.json +jq --arg v $BB_VERSION '.dependencies."@aztec/bb.js" = $v' $BACKEND_BARRETENBERG_PACKAGE_JSON > $tmp && mv $tmp $BACKEND_BARRETENBERG_PACKAGE_JSON + +# This script runs in CI which enforces immutable installs by default, +# we then must turn this off in order to update yarn.lock. +YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install + +# Add requirement for `wasm-opt` to be installed +sed -i "s/^#require_command wasm-opt/require_command wasm-opt/" ./tooling/noirc_abi_wasm/build.sh +sed -i "s/^#require_command wasm-opt/require_command wasm-opt/" ./acvm-repo/acvm_js/build.sh