Skip to content

Commit

Permalink
feat: aztec-packages (#3626)
Browse files Browse the repository at this point in the history
* feat: Aztec CI files in Noir (#3430)

This is a dual-list commit in both Noir and aztec repo. In this PR,
Aztec gets the code to make a mirror, and the mirror action pushes to
our `aztec` branch in Noir. The `aztec` branch features this as the
first commit, to then be pushed one by one from master as Noir changes
come in.

---------

Co-authored-by: ludamad <adam@aztecprotocol.com>

* feat: Pull latest noir for brillig optimizations (#3464)

---------

Co-authored-by: ludamad <adam.domurad@gmail.com>
Co-authored-by: ludamad <adam@aztecprotocol.com>
Co-authored-by: kevaundray <kevtheappdev@gmail.com>
Co-authored-by: sirasistant <sirasistant@gmail.com>
  • Loading branch information
5 people authored Nov 29, 2023
1 parent 552bab1 commit e0a96ea
Showing 1 changed file with 60 additions and 44 deletions.
104 changes: 60 additions & 44 deletions test_programs/rebuild.sh
Original file line number Diff line number Diff line change
@@ -1,56 +1,72 @@
#!/bin/bash
set -e

excluded_dirs=("workspace" "workspace_default_member")
process_dir() {
local dir=$1
local current_dir=$2
local dir_name=$(basename "$dir")

if [[ ! -d "$current_dir/acir_artifacts/$dir_name" ]]; then
mkdir -p $current_dir/acir_artifacts/$dir_name
fi

cd $dir
if [ -d ./target/ ]; then
rm -r ./target/
fi
nargo compile && nargo execute witness

if [ -f ./target/witness.tr ]; then
mv ./target/witness.tr ./target/witness.gz
fi

if [ -f ./target/${dir_name}.json ]; then
jq -r '.bytecode' ./target/${dir_name}.json | base64 -d > ./target/acir.gz
fi

rm ./target/${dir_name}.json

if [ -d "$current_dir/acir_artifacts/$dir_name/target" ]; then
rm -r "$current_dir/acir_artifacts/$dir_name/target"
fi
mkdir $current_dir/acir_artifacts/$dir_name/target

mv ./target/*.gz $current_dir/acir_artifacts/$dir_name/target/

cd $current_dir
}

export -f process_dir

excluded_dirs=("workspace" "workspace_default_member")
current_dir=$(pwd)
base_path="$current_dir/execution_success"

# Clear the acir_artifacts directory of any existing artifacts
rm -rf $current_dir/acir_artifacts
mkdir -p $current_dir/acir_artifacts

# Loop over every directory
# Gather directories to process.
dirs_to_process=()
for dir in $base_path/*; do
if [[ ! -d $dir ]]; then
continue
fi

dir_name=$(basename "$dir")

if [[ ! " ${excluded_dirs[@]} " =~ " ${dir_name} " ]]; then
if [[ ! -d "$current_dir/acir_artifacts/$dir_name" ]]; then
mkdir -p $current_dir/acir_artifacts/$dir_name
fi

cd $dir
if [ -d ./target/ ]; then
rm -r ./target/
fi
nargo compile && nargo execute witness

# Rename witness.tr to witness.gz
if [ -f ./target/witness.tr ]; then
mv ./target/witness.tr ./target/witness.gz
fi

# Extract bytecode field from JSON, base64 decode it, and save it to the target directory
if [ -f ./target/${dir_name}.json ]; then
jq -r '.bytecode' ./target/${dir_name}.json | base64 -d > ./target/acir.gz
fi

# Delete the JSON file after extracting bytecode field
rm ./target/${dir_name}.json

# Clear the target directory in acir_artifacts
if [ -d "$current_dir/acir_artifacts/$dir_name/target" ]; then
rm -r "$current_dir/acir_artifacts/$dir_name/target"
fi
mkdir $current_dir/acir_artifacts/$dir_name/target

# Move the artifacts from the target directory to the corresponding directory in acir_artifacts
mv ./target/*.gz $current_dir/acir_artifacts/$dir_name/target/

cd $base_path
fi
if [[ ! -d $dir ]] || [[ " ${excluded_dirs[@]} " =~ " $(basename "$dir") " ]]; then
continue
fi
dirs_to_process+=("$dir")
done

# Process each directory in parallel
pids=()
for dir in "${dirs_to_process[@]}"; do
process_dir "$dir" "$current_dir" &
pids+=($!)
done

# Check the exit status of each background job.
for pid in "${pids[@]}"; do
wait $pid || exit_status=$?
done

# Exit with a failure status if any job failed.
if [ ! -z "$exit_status" ]; then
exit $exit_status
fi

0 comments on commit e0a96ea

Please sign in to comment.