Skip to content

Commit b53bacf

Browse files
authored
chore: checking noir formatting in CI (AztecProtocol#3828)
Fixes AztecProtocol#3825
1 parent f8976ad commit b53bacf

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

yarn-project/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"prepare": "node ./yarn-project-base/scripts/update_package_jsons.mjs && yarn workspaces foreach run prepare && workspaces-to-typescript-project-references --tsconfigPath tsconfig.json && prettier -w */tsconfig.json",
77
"prepare:check": "node ./yarn-project-base/scripts/update_package_jsons.mjs --check && workspaces-to-typescript-project-references --check --tsconfigPath tsconfig.json",
88
"docs": "typedoc --out docs/dist && cd docs && yarn serve",
9-
"formatting": "FORCE_COLOR=true yarn workspaces foreach -p -j unlimited -v run formatting",
9+
"formatting": "./run_nargo_fmt.sh --check && FORCE_COLOR=true yarn workspaces foreach -p -j unlimited -v run formatting",
1010
"formatting:fix": "./run_nargo_fmt.sh && FORCE_COLOR=true yarn workspaces foreach -p -v run formatting:fix",
1111
"lint": "yarn eslint --cache --ignore-pattern l1-artifacts .",
1212
"format": "yarn prettier --cache -w .",

yarn-project/run_nargo_fmt.sh

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

3-
nargo_executable="$(git rev-parse --show-toplevel)/noir/target/release/nargo"
3+
# Note: This script formats the files multiple times when the given project is included in a workspace.
4+
# Tackling this became a time sink, so I decided to leave it as is for now.
5+
6+
set -eu
7+
8+
# We set the executable path as if we were in CI
9+
nargo_executable="/usr/src/noir/target/release/nargo"
10+
11+
# Check if nargo_executable exists and is executable
12+
if [ ! -x "$nargo_executable" ]; then
13+
# If not, we try to set a nargo path as if the script was run locally
14+
nargo_executable="$(git rev-parse --show-toplevel)/noir/target/release/nargo"
15+
16+
if [ ! -x "$nargo_executable" ]; then
17+
echo "Error: nargo executable not found"
18+
exit 1
19+
fi
20+
fi
421

522
# Find all Nargo.toml files and run 'nargo fmt'
623
find . -name "Nargo.toml" | while read -r file; do

0 commit comments

Comments
 (0)