Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/ci3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function handle_release_pr {
git tag "${tag_name}"
git push origin "${tag_name}"
echo "Created and pushed tag: ${tag_name}"
gh pr edit $PR_NUMBER --remove-label ci-release-pr || true
}

function main {
Expand Down
2 changes: 1 addition & 1 deletion aztec-up/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.terraform
.terraform*
.DS_Store
bin/versions
bin/0.0.1/versions
verdaccio-storage
aztec-release-test-image
152 changes: 152 additions & 0 deletions aztec-up/bin/0.0.1/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#!/usr/bin/env bash
# Per-version installer script
# This script is called by aztec-up to install a specific version of the Aztec toolchain.
# It expects VERSION and INSTALL_URI to be set.
set -euo pipefail
shopt -s inherit_errexit
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: At first guess I would say 0.0.1/install is not the current source


# Colors
g="\033[32m" # Green
y="\033[33m" # Yellow
b="\033[34m" # Blue
r="\033[0m" # Reset

# Required environment variables
VERSION="${VERSION:?VERSION must be set}"
AZTEC_HOME="${AZTEC_HOME:-$HOME/.aztec}"
INSTALL_URI="${INSTALL_URI:-https://install.aztec.network}"

# Version-specific paths
version_path="$AZTEC_HOME/versions/$VERSION"
version_bin_path="$version_path/bin"

function echo_green {
echo -e "${g}$1${r}"
}

function echo_yellow {
echo -e "${y}$1${r}"
}

function dump_fail {
output=$(mktemp)

set +e
($1) &>$output
status=$?
set -e

# 0 or SIGTERM considered a success.
if [ "$status" -ne 0 ] && [ "$status" -ne 143 ]; then
{
echo
echo -e "${y}command failed${r}: $1 (exit: $status)"
echo -e "${b}--- output ---${r}"
cat $output
} >&2
fi

rm $output

return $status
}

function check_toolchains {
# Check Node.js version.
local node_min_version=$(cat "$version_path/versions" | grep node | cut -d' ' -f2)
local node_installed_version=$(node --version 2>/dev/null | cut -d 'v' -f 2 || echo "none")
if [[ "$(printf '%s\n' "$node_min_version" "$node_installed_version" | sort -V | head -n1)" != "$node_min_version" ]]; then
echo "Minimum Node.js version $node_min_version not found (got $node_installed_version)."
echo "Installation: nvm install --lts && nvm alias default lts/*"
exit 1
fi
}

function install_versions_file {
# Determine the correct URI for fetching the versions file
local versions_uri="$INSTALL_URI"
curl -fsSL "$versions_uri/$VERSION/versions" -o "$version_path/versions"
}

function install_noir {
local noir_version=$(cat "$version_path/versions" | grep noir | cut -d' ' -f2)

# Create a temp directory for noirup to install to
local temp_nargo_home=$(mktemp -d)
mkdir -p "$temp_nargo_home/bin"

# Install noirup if not already present
if [ ! -f "$HOME/.nargo/bin/noirup" ]; then
curl -Ls https://raw.githubusercontent.com/noir-lang/noirup/refs/heads/main/install | bash
fi

# Install noir to temp location and move to version directory
NARGO_HOME="$temp_nargo_home" "$HOME/.nargo/bin/noirup" -v "$noir_version"

# Move the nargo binary to our version bin directory
mv "$temp_nargo_home/bin/nargo" "$version_bin_path/nargo"

# Cleanup temp directory
rm -rf "$temp_nargo_home"
}

function install_foundry {
local foundry_version=$(cat "$version_path/versions" | grep foundry | cut -d' ' -f2)

# Create a temp directory for foundryup to install to
local temp_foundry_dir=$(mktemp -d)
mkdir -p "$temp_foundry_dir/bin"

# Install foundryup if not already present
if [ ! -f "$HOME/.foundry/bin/foundryup" ]; then
curl -L https://foundry.paradigm.xyz | bash
fi

# Install foundry to temp location and move to version directory
FOUNDRY_DIR="$temp_foundry_dir" "$HOME/.foundry/bin/foundryup" -i "$foundry_version"

# Move the foundry binaries to our version bin directory
for binary in forge cast anvil chisel; do
if [ -f "$temp_foundry_dir/bin/$binary" ]; then
mv "$temp_foundry_dir/bin/$binary" "$version_bin_path/$binary"
fi
done

# Cleanup temp directory
rm -rf "$temp_foundry_dir"
}

function install_aztec_packages {
# Install npm packages to the version directory using --prefix
npm install @aztec/aztec@$VERSION @aztec/cli-wallet@$VERSION @aztec/bb.js@$VERSION --prefix "$version_path"
}

function main {
# Create version directory
mkdir -p "$version_bin_path"

# Download versions manifest
echo -n "Installing version manifest... "
dump_fail install_versions_file
echo_green "done."

# Check Node.js version
check_toolchains

# Install noir
echo -n "Installing nargo... "
dump_fail install_noir
echo_green "done."

# Install foundry
echo -n "Installing foundry... "
dump_fail install_foundry
echo_green "done."

# Install aztec npm packages
echo -n "Installing aztec packages... "
dump_fail install_aztec_packages
echo_green "done."
}

main "$@"
2 changes: 2 additions & 0 deletions aztec-up/bin/aliases/index
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
latest
nightly
1 change: 1 addition & 0 deletions aztec-up/bin/aliases/latest
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1
1 change: 1 addition & 0 deletions aztec-up/bin/aliases/nightly
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1
Loading
Loading