diff --git a/aztec-up/bootstrap.sh b/aztec-up/bootstrap.sh index 27ecf742257b..50da97b1121d 100755 --- a/aztec-up/bootstrap.sh +++ b/aztec-up/bootstrap.sh @@ -95,7 +95,7 @@ EOF } function test_cmds { - for test in amm_flow bridge_and_claim basic_install counter_contract; do + for test in amm_flow bridge_and_claim basic_install counter_contract default_scaffold; do echo "$hash:TIMEOUT=15m aztec-up/scripts/run_test.sh $test" done } diff --git a/aztec-up/test/default_scaffold.sh b/aztec-up/test/default_scaffold.sh new file mode 100755 index 000000000000..d652bdbf8326 --- /dev/null +++ b/aztec-up/test/default_scaffold.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Tests that the default scaffold generated by `aztec new` compiles and passes its tests without any modifications. +# This catches regressions in the template files produced by setup_workspace.sh (e.g. syntax errors, stale imports, +# or API changes in aztec-nr) that would otherwise go unnoticed until a user runs `aztec new` themselves. + +export LOG_LEVEL=silent + +aztec new my_contract + +# Verify workspace structure. +if [ ! -f my_contract/Nargo.toml ]; then + echo "Failed to create workspace Nargo.toml." + exit 1 +fi +if [ ! -f my_contract/contract/Nargo.toml ] || [ ! -f my_contract/contract/src/main.nr ]; then + echo "Failed to create contract crate." + exit 1 +fi +if [ ! -f my_contract/test/Nargo.toml ] || [ ! -f my_contract/test/src/lib.nr ]; then + echo "Failed to create test crate." + exit 1 +fi + +cd my_contract + +# This is unfortunate as it makes the test worse but in CI setting the aztec version is 0.0.1 which doesn't exist as +# a remote git tag, so we need to rewrite dependencies to use local aztec-nr. +sed -i 's|aztec = .*git.*AztecProtocol/aztec-nr.*|aztec = { path="/home/ubuntu/aztec-packages/noir-projects/aztec-nr/aztec" }|' contract/Nargo.toml test/Nargo.toml + +# Compile the default scaffold contract. +aztec compile + +# Run the default scaffold tests. +aztec test