-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(ci): Run nargo test in ci on all packages #2197
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
79ec6c8
fix: add install backend step in noir rebuild
Maddiaa0 e401c11
fix: add to bootstrap
Maddiaa0 2245a1f
Merge branch 'master' into md/add-backend-stap
Maddiaa0 776c77e
fix: error message format change
Maddiaa0 61f6af9
fix: formatting
Maddiaa0 675afd9
feat(ci): perform all noir tests in ci
Maddiaa0 b25ab0c
Merge branch 'master' into md/noir-tests-in-ci
Maddiaa0 4665512
fix: alter contract name to project name
Maddiaa0 c2bd664
fix: review nits
Maddiaa0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
# Utility to get the names of all noir libaries located in ../noir-libs | ||
echo $(ls -d ../noir-libs/*/Nargo.toml | sed -r "s/..\\/noir-libs\\/(.+)\\/Nargo.toml/\\1/") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/bin/bash | ||
|
||
# Tests noir contracts, if multiple are provided, then they are testing in parallel, bubbling any testing errors | ||
# | ||
# Usage: | ||
# If testing a single contract: | ||
# ./scripts/test.sh CONTRACT <CONTRACT_NAME> | ||
# If testing multiple contracts: | ||
# ./scripts/test.sh CONTRACT <CONTRACT_NAME> <CONTRACT_NAME> <CONTRACT_NAME> <CONTRACT_NAME> ... | ||
# If testing a library: | ||
# ./scripts/test.sh LIB <LIBRARY_NAME> | ||
# If testing multiple libraries: | ||
# ./scripts/test.sh LIB <LIBRARY_NAME> <LIBRARY_NAME> <LIBRARY_NAME> <LIBRARY_NAME> ... | ||
|
||
ROOT=$(pwd) | ||
|
||
# Get the project type from the first argument | ||
PROJECT_TYPE=$1 | ||
shift | ||
|
||
# Error flag file | ||
error_file="/tmp/error.$$" | ||
# Array of child PIDs | ||
pids=() | ||
|
||
# Handler for SIGCHLD, cleanup if child exit with error | ||
handle_sigchld() { | ||
for pid in "${pids[@]}"; do | ||
# If process is no longer running | ||
if ! kill -0 "$pid" 2>/dev/null; then | ||
# Wait for the process and get exit status | ||
wait "$pid" | ||
status=$? | ||
|
||
# If exit status is error | ||
if [ $status -ne 0 ]; then | ||
# Create error file | ||
touch "$error_file" | ||
fi | ||
fi | ||
done | ||
} | ||
|
||
# Set SIGCHLD handler | ||
trap handle_sigchld SIGCHLD # Trap any ERR signal and call the custom error handler | ||
|
||
test() { | ||
PROJECT_NAME=$1 | ||
|
||
if [ "$PROJECT_TYPE" == "CONTRACT" ]; then | ||
CONTRACT_FOLDER="${PROJECT_NAME}_contract" | ||
echo "Testing contract $PROJECT_NAME..." | ||
cd src/contracts/$CONTRACT_FOLDER | ||
nargo test | ||
else | ||
cd ../noir-libs/$PROJECT_NAME | ||
nargo test | ||
fi | ||
} | ||
|
||
echo "Using $(nargo --version)" | ||
|
||
# Build contracts | ||
for PROJECT_NAME in "$@"; do | ||
test $PROJECT_NAME & | ||
pids+=($!) | ||
done | ||
|
||
# Wait for all background processes to finish | ||
wait | ||
|
||
# If error file exists, exit with error | ||
if [ -f "$error_file" ]; then | ||
rm "$error_file" | ||
echo "Error occurred in one or more child processes. Exiting..." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
#!/bin/bash | ||
|
||
# Runs tests scripts for all contracts, then for all libraries. | ||
|
||
./scripts/test.sh CONTRACT $(./scripts/get_all_contracts.sh) | ||
./scripts/test.sh LIB $(./scripts/get_all_libraries.sh) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we are not printing any
Testing library
similar to how we have for the contract?