Skip to content

Commit ee9f988

Browse files
authored
Merge branch 'main' into me/list-versions
2 parents f69175d + 7dbe69c commit ee9f988

File tree

4 files changed

+173
-40
lines changed

4 files changed

+173
-40
lines changed

.github/workflows/ci.yml

+125-29
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,45 @@ permissions:
1313
env:
1414
REPO: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
1515
REF: ${{ github.head_ref || github.ref_name }}
16+
MINIMUM_NOIR_VERSION: v0.16.0
1617

1718
jobs:
19+
noir-version-list:
20+
name: Query supported Noir versions
21+
runs-on: ubuntu-latest
22+
outputs:
23+
noir_versions: ${{ steps.get_versions.outputs.versions }}
24+
25+
steps:
26+
- name: Checkout sources
27+
id: get_versions
28+
run: |
29+
# gh returns the Noir releases in reverse chronological order so we keep all releases published after the minimum supported version.
30+
VERSIONS=$(gh release list -R noir-lang/noir --exclude-pre-releases --json tagName -q 'map(.tagName) | index(env.MINIMUM_NOIR_VERSION) as $index | if $index then .[0:$index+1] else [env.MINIMUM_NOIR_VERSION] end')
31+
echo "versions=$VERSIONS"
32+
echo "versions=$VERSIONS" >> $GITHUB_OUTPUT
33+
env:
34+
GH_TOKEN: ${{ github.token }}
35+
36+
1837
install:
1938
name: Noir ${{matrix.toolchain}} (CLI) on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}}
39+
needs: [noir-version-list]
2040
runs-on: ${{matrix.os}}-latest
2141
strategy:
2242
fail-fast: false
2343
matrix:
2444
os: [ubuntu, macos]
25-
toolchain: [stable, nightly, 0.1.0, 0.1.1, 0.2.0, 0.3.0, 0.4.1]
45+
toolchain: ${{ fromJson( needs.noir-version-list.outputs.noir_versions )}}
46+
include:
47+
- os: ubuntu
48+
toolchain: nightly
49+
- os: ubuntu
50+
toolchain: stable
51+
- os: macos
52+
toolchain: nightly
53+
- os: macos
54+
toolchain: stable
2655
timeout-minutes: 45
2756
steps:
2857
- name: Parse toolchain
@@ -50,17 +79,44 @@ jobs:
5079
run: noirup ${{steps.parse.outputs.toolchain}}
5180
- name: Check nargo installation
5281
run: nargo --version
82+
- name: Check noir-inspector installation
83+
run: |
84+
# Fetch the version from `nargo` as to also check the `stable` and `nightly` toolchains
85+
VERSION=$(nargo --version | awk -F' = ' '/nargo version/ {print $2}')
86+
MIN_VERSION="1.0.0-beta.3"
87+
88+
version_gte() {
89+
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
90+
}
91+
92+
if version_gte "$VERSION" "$MIN_VERSION"; then
93+
noir-inspector --version
94+
fi
95+
- name: Check noir-profiler installation
96+
run: |
97+
# Fetch the version from `nargo` as to also check the `stable` and `nightly` toolchains
98+
VERSION=$(nargo --version | awk -F' = ' '/nargo version/ {print $2}')
99+
MIN_VERSION="1.0.0-beta.3"
100+
101+
version_gte() {
102+
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
103+
}
104+
105+
if version_gte "$VERSION" "$MIN_VERSION"; then
106+
noir-profiler --version
107+
fi
53108
54109
install-source:
55110
name: Noir ${{matrix.version}} (from source) on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}}
111+
needs: [noir-version-list]
56112
runs-on: ${{matrix.os}}-latest
57113
strategy:
58114
fail-fast: false
59115
matrix:
60-
os: [ubuntu, macos]
61116
# Installing from source can technically target any commit.
62117
# However, we only guarantee that noirup will build release commits.
63-
version: [0.1.0, 0.1.1, 0.2.0, 0.3.0, 0.4.1]
118+
os: [ubuntu, macos]
119+
version: ${{ fromJson( needs.noir-version-list.outputs.noir_versions )}}
64120
timeout-minutes: 45
65121
steps:
66122
- name: Install noirup
@@ -80,29 +136,57 @@ jobs:
80136
~/.cargo/git/db/
81137
key: ${{ runner.os }}-cargo-${{ matrix.version }}
82138

83-
- name: Install Barretenberg dependencies
84-
if: matrix.os == 'ubuntu'
85-
run: sudo apt update && sudo apt install clang lld cmake libomp-dev
86-
87-
- name: Install Barretenberg dependencies
88-
if: matrix.os == 'macos'
89-
run: brew install cmake llvm libomp
90-
91139
- name: Install nargo from source with noirup
92140
run: noirup $toolchain
93141
env:
94-
toolchain: -b tags/v${{matrix.version}}
142+
toolchain: -b tags/${{matrix.version}}
95143
- name: Check nargo installation
96144
run: nargo --version
145+
- name: Check noir-inspector installation
146+
run: |
147+
# Fetch the version from `nargo` as to also check the `stable` and `nightly` toolchains
148+
VERSION=$(nargo --version | awk -F' = ' '/nargo version/ {print $2}')
149+
MIN_VERSION="1.0.0-beta.3"
150+
151+
version_gte() {
152+
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
153+
}
154+
155+
if version_gte "$VERSION" "$MIN_VERSION"; then
156+
noir-inspector --version
157+
fi
158+
- name: Check noir-profiler installation
159+
run: |
160+
# Minimum version which began releasing binaries for the `noir-profiler`
161+
# Account for the extra `v` that prefixes "${{matrix.version}}"
162+
MIN_VERSION="v1.0.0-beta.3"
163+
164+
version_gte() {
165+
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
166+
}
167+
168+
if version_gte ${{matrix.version}} "$MIN_VERSION"; then
169+
noir-profiler --version
170+
fi
97171
98172
install-action:
99173
name: Noir ${{matrix.toolchain}} (GH action) on ${{matrix.os == 'ubuntu' && 'Linux' || matrix.os == 'macos' && 'macOS' || matrix.os == 'windows' && 'Windows' || '???'}}
174+
needs: [noir-version-list]
100175
runs-on: ${{matrix.os}}-latest
101176
strategy:
102177
fail-fast: false
103178
matrix:
104179
os: [ubuntu, macos]
105-
toolchain: [stable, nightly, 0.1.0, 0.1.1, 0.2.0, 0.3.0, 0.4.1]
180+
toolchain: ${{ fromJson( needs.noir-version-list.outputs.noir_versions )}}
181+
include:
182+
- os: ubuntu
183+
toolchain: nightly
184+
- os: ubuntu
185+
toolchain: stable
186+
- os: macos
187+
toolchain: nightly
188+
- os: macos
189+
toolchain: stable
106190
timeout-minutes: 45
107191
steps:
108192
- uses: actions/checkout@v3
@@ -115,22 +199,34 @@ jobs:
115199
- run: nargo new project
116200
- run: nargo check
117201
working-directory: ./project
118-
- run: |
119-
# Extract the minor version number from the version output
120-
version=$(nargo --version)
121-
version="${version#* }"
122-
version="${version%% (*}"
123-
minor=$(echo $version | cut -d '.' -f 2)
124-
125-
# The version in which the compile syntax changed
126-
if [ "$minor" -lt 10 ]; then
127-
nargo compile test-circuit
128-
else
129-
nargo compile
130-
fi
131-
name: nargo compile
202+
- run: nargo compile
132203
working-directory: ./project
133-
shell: bash
134204
- run: nargo test
135-
if: matrix.toolchain != '0.1.0'
136205
working-directory: ./project
206+
- name: Check noir-inspector installation
207+
run: |
208+
# Fetch the version from `nargo` as to also check the `stable` and `nightly` toolchains
209+
VERSION=$(nargo --version | awk -F' = ' '/nargo version/ {print $2}')
210+
MIN_VERSION="1.0.0-beta.3"
211+
212+
version_gte() {
213+
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
214+
}
215+
216+
if version_gte "$VERSION" "$MIN_VERSION"; then
217+
noir-inspector --version
218+
fi
219+
- name: Check noir-profiler installation
220+
working-directory: ./project
221+
run: |
222+
VERSION=$(nargo --version | awk -F' = ' '/nargo version/ {print $2}')
223+
MIN_VERSION="1.0.0-beta.3"
224+
225+
version_gte() {
226+
[ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]
227+
}
228+
229+
if version_gte "$VERSION" "$MIN_VERSION"; then
230+
noir-profiler --version
231+
noir-profiler opcodes -a ./target/project.json -o ./target
232+
fi

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [0.1.4](https://github.com/noir-lang/noirup/compare/v0.1.3...v0.1.4) (2025-02-20)
4+
5+
6+
### Features
7+
8+
* Install noir-profiler and noir-inspector ([#46](https://github.com/noir-lang/noirup/issues/46)) ([cf71599](https://github.com/noir-lang/noirup/commit/cf71599ddf5dc57486935d3bcba8f6ef07bb8850))
9+
310
## [0.1.3](https://github.com/noir-lang/noirup/compare/v0.1.2...v0.1.3) (2023-09-05)
411

512

noirup

+40-10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ set -e
44
NARGO_HOME=${NARGO_HOME-"$HOME/.nargo"}
55
NARGO_BIN_DIR="$NARGO_HOME/bin"
66

7+
BINARIES=("nargo" "noir-profiler" "noir-inspector")
8+
79
main() {
810
need_cmd git
911
need_cmd curl
@@ -66,10 +68,19 @@ main() {
6668
RUSTFLAGS="-C target-cpu=native" ensure cargo build --release $FEATURES # need 4 speed
6769

6870
# Remove prior installations if they exist
69-
rm -f "$NARGO_BIN_DIR/nargo"
71+
for bin in "${BINARIES[@]}"; do
72+
rm -f "$NARGO_BIN_DIR/$bin"
73+
done
7074

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

7485
say "done"
7586
exit 0
@@ -125,14 +136,22 @@ main() {
125136
NOIRUP_TAG="${NOIRUP_VERSION}"
126137
fi
127138

128-
say "installing nargo (version ${NOIRUP_VERSION} with tag ${NOIRUP_TAG})"
139+
say "installing Noir binaries (version ${NOIRUP_VERSION} with tag ${NOIRUP_TAG})"
129140

130141
RELEASE_URL="https://github.com/${NOIRUP_REPO}/releases/download/${NOIRUP_TAG}"
131142
fi
132-
BIN_TARBALL_URL="${RELEASE_URL}/nargo-${ARCHITECTURE}-${PLATFORM}.tar.gz"
143+
# Current name for the binary tarball created by Noir.
144+
BIN_TARBALL_URL="${RELEASE_URL}/noir-${ARCHITECTURE}-${PLATFORM}.tar.gz"
145+
146+
# Legacy naming uses the `nargo-` for when noir-lang/noir used to only release a single nargo binary
147+
# Use the legacy naming if `noir-` does not exist
148+
# Force curl to follow redirects with `-L`
149+
if ! curl -L --head --fail --silent "$BIN_TARBALL_URL" >/dev/null 2>&1; then
150+
BIN_TARBALL_URL="${RELEASE_URL}/nargo-${ARCHITECTURE}-${PLATFORM}.tar.gz"
151+
fi
133152

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

138157
# Prior to v0.3.0, Nargo and the std lib were distributed separated.
@@ -167,12 +186,22 @@ main() {
167186

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

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

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

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

178207
if [[ $(which nargo) =~ "cargo" ]]; then
@@ -190,6 +219,7 @@ USAGE:
190219
noirup <OPTIONS>
191220
OPTIONS:
192221
-h, --help Print help information
222+
-n, --nightly Install the nightly version
193223
-v, --version Install a specific version
194224
-b, --branch Install a specific branch
195225
-P, --pr Install a specific Pull Request

version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.3
1+
0.1.4

0 commit comments

Comments
 (0)