Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
08946b0
add logic for handling noir-profiler in noirup
vezenovm Feb 19, 2025
53fc84a
Merge branch 'main' into mv/download-profiler
vezenovm Feb 19, 2025
2c2e79a
handle noir-profiler in CI and legacy naming in script
vezenovm Feb 19, 2025
60e8425
redirect stderr to /dev/null
vezenovm Feb 19, 2025
0c95394
check version
vezenovm Feb 19, 2025
9c3767a
check if binary exists before moving
vezenovm Feb 19, 2025
f7b750f
check noir-profiler exists in CI
vezenovm Feb 19, 2025
05c0334
empty
vezenovm Feb 19, 2025
d7e0755
check in bash whether file exists
vezenovm Feb 19, 2025
d37e906
force curl to follow redirects
vezenovm Feb 19, 2025
f8dfc2d
be verbose about last failing case
vezenovm Feb 19, 2025
c59d7b1
remove -v on curl
vezenovm Feb 19, 2025
189b116
Update noirup
vezenovm Feb 19, 2025
17231f9
empty
vezenovm Feb 19, 2025
760d611
Merge remote-tracking branch 'origin/mv/download-profiler' into mv/do…
vezenovm Feb 19, 2025
59a471b
Apply suggestions from code review
vezenovm Feb 19, 2025
eb0b350
switch to checking the version when checking noir-profiler in the CI job
vezenovm Feb 20, 2025
d79bf4a
print matrix.version
vezenovm Feb 20, 2025
47328c3
account for v prefix
vezenovm Feb 20, 2025
db89304
Update .github/workflows/ci.yml
vezenovm Feb 20, 2025
8a698f6
Update .github/workflows/ci.yml
vezenovm Feb 20, 2025
3236926
Apply suggestions from code review
vezenovm Feb 20, 2025
93fabc7
bring back some comments
vezenovm Feb 20, 2025
d176ae3
wtf why is macos stalling
vezenovm Feb 20, 2025
81d2e19
chore: install `noir-inspector`
TomAFrench Feb 20, 2025
01255e9
.
TomAFrench Feb 20, 2025
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
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,20 @@ jobs:
run: noirup ${{steps.parse.outputs.toolchain}}
- name: Check nargo installation
run: nargo --version
- name: Check noir-profiler installation
run: |
# Fetch the version from `nargo` as to also check the `stable` and `nightly` toolchains
Comment thread
vezenovm marked this conversation as resolved.
VERSION=$(nargo --version | awk -F' = ' '/nargo version/ {print $2}')
# Minimum version which began releasing binaries for the `noir-profiler`
Comment thread
vezenovm marked this conversation as resolved.
Outdated
MIN_VERSION="1.0.0-beta.3"

version_gte() {
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
}

if version_gte "$VERSION" "$MIN_VERSION"; then
noir-profiler --version
fi
Comment on lines +82 to +107

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This test is a little tuatological. We're running noir-profiler --version to check if it's there but only if it's there.

What I've done elsewhere in this workflow is to split the version number into major, minor, patch and we can then assert that after a certain version we expect the profiler to exist.


install-source:
name: Noir ${{matrix.version}} (from source) on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}}
Expand Down Expand Up @@ -116,6 +130,17 @@ jobs:
toolchain: -b tags/${{matrix.version}}
- name: Check nargo installation
run: nargo --version
- name: Check noir-profiler installation
run: |
MIN_VERSION="v1.0.0-beta.3"
Comment thread
vezenovm marked this conversation as resolved.

version_gte() {
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
}

if version_gte ${{matrix.version}} "$MIN_VERSION"; then
noir-profiler --version
fi

install-action:
name: Noir ${{matrix.toolchain}} (GH action) on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}}
Expand Down Expand Up @@ -151,3 +176,18 @@ jobs:
working-directory: ./project
- run: nargo test
working-directory: ./project
- name: Check noir-profiler installation
working-directory: ./project
run: |
VERSION=$(nargo --version | awk -F' = ' '/nargo version/ {print $2}')
# Minimum version which began releasing binaries for the `noir-profiler`.
Comment thread
vezenovm marked this conversation as resolved.
Outdated
MIN_VERSION="1.0.0-beta.3"

version_gte() {
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
}

if version_gte "$VERSION" "$MIN_VERSION"; then
noir-profiler --version
noir-profiler opcodes -a ./target/project.json -o ./target
fi
49 changes: 39 additions & 10 deletions noirup
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -e
NARGO_HOME=${NARGO_HOME-"$HOME/.nargo"}
NARGO_BIN_DIR="$NARGO_HOME/bin"

BINARIES=("nargo" "noir-profiler")

main() {
need_cmd git
need_cmd curl
Expand Down Expand Up @@ -62,10 +64,19 @@ main() {
RUSTFLAGS="-C target-cpu=native" ensure cargo build --release $FEATURES # need 4 speed

# Remove prior installations if they exist
rm -f "$NARGO_BIN_DIR/nargo"
for bin in "${BINARIES[@]}"; do
rm -f "$NARGO_BIN_DIR/$bin"
done

# Move the binary into the `nargo/bin` directory
ensure mv "$PWD/target/release/nargo" "$NARGO_BIN_DIR/nargo"
# Move binaries into the `.nargo/bin` directory
for bin in "${BINARIES[@]}"; do
# Move the binary only if it exists.
# This ensures compatibility with older versions of Noir,
# which may not include all binaries listed.
if [ -f "$PWD/target/release/$bin" ]; then
ensure mv "$PWD/target/release/$bin" "$NARGO_BIN_DIR/$bin"
fi
Comment thread
TomAFrench marked this conversation as resolved.
done

say "done"
exit 0
Expand Down Expand Up @@ -121,14 +132,22 @@ main() {
NOIRUP_TAG="${NOIRUP_VERSION}"
fi

say "installing nargo (version ${NOIRUP_VERSION} with tag ${NOIRUP_TAG})"
say "installing Noir binaries (version ${NOIRUP_VERSION} with tag ${NOIRUP_TAG})"

RELEASE_URL="https://github.com/${NOIRUP_REPO}/releases/download/${NOIRUP_TAG}"
fi
BIN_TARBALL_URL="${RELEASE_URL}/nargo-${ARCHITECTURE}-${PLATFORM}.tar.gz"
# Current name for the binary tarball created by Noir.
BIN_TARBALL_URL="${RELEASE_URL}/noir-${ARCHITECTURE}-${PLATFORM}.tar.gz"

# Legacy naming uses the `nargo-` for when noir-lang/noir used to only release a single nargo binary
# Use the legacy naming if `noir-` does not exist
# Force curl to follow redirects with `-L`
if ! curl -L --head --fail --silent "$BIN_TARBALL_URL" >/dev/null 2>&1; then
BIN_TARBALL_URL="${RELEASE_URL}/nargo-${ARCHITECTURE}-${PLATFORM}.tar.gz"
fi

# Download the binaries tarball and unpack it into the .nargo bin directory.
say "downloading latest nargo to '$NARGO_BIN_DIR'"
say "downloading latest Noir binaries to '$NARGO_BIN_DIR'"
ensure curl -# -L $BIN_TARBALL_URL | tar -xzC $NARGO_BIN_DIR

# Prior to v0.3.0, Nargo and the std lib were distributed separated.
Expand Down Expand Up @@ -163,12 +182,22 @@ main() {

RUSTFLAGS="-C target-cpu=native" ensure cargo build --release $FEATURES

# Remove prior installations if they exist
rm -f "$NARGO_BIN_DIR/nargo"

# Move the binary into the `nargo/bin` directory
ensure mv "$PWD/target/release/nargo" "$NARGO_BIN_DIR/nargo"
# Remove prior installations if they exist
for bin in "${BINARIES[@]}"; do
rm -f "$NARGO_BIN_DIR/$bin"
done

# Move binaries into the `.nargo/bin` directory
for bin in "${BINARIES[@]}"; do
# Move the binary only if it exists.
# This ensures compatibility with older versions of Noir,
# which may not include all binaries listed.
if [ -f "$PWD/target/release/$bin" ]; then
ensure mv "$PWD/target/release/$bin" "$NARGO_BIN_DIR/$bin"
fi
done

fi

if [[ $(which nargo) =~ "cargo" ]]; then
Expand Down