diff --git a/.github/workflows/ninja_pr_checks.yml b/.github/workflows/ninja_pr_checks.yml index b4bc032a70..de20ffd067 100644 --- a/.github/workflows/ninja_pr_checks.yml +++ b/.github/workflows/ninja_pr_checks.yml @@ -175,10 +175,13 @@ jobs: working-directory: ${{ matrix.example.path }} run: | dfx start --background - dfx deploy - if [ -f "Makefile" ]; then + if [ -f "test.sh" ]; then + echo "test.sh found, running bash test.sh" + bash test.sh + elif [ -f "Makefile" ]; then echo "Makefile found, running make test" make test else - echo "No Makefile found, skipping make test" + echo "No test.sh or Makefile found, running dfx deploy" + dfx deploy fi diff --git a/rust/canister-info/Makefile b/rust/canister-info/Makefile deleted file mode 100644 index d8ef0e076f..0000000000 --- a/rust/canister-info/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -.PHONY: all -all: deploy - -.PHONY: build -.SILENT: build -deploy: - dfx deploy - -.PHONY: test -.SILENT: test -test: deploy - dfx canister call canister-info info "(principal\"`dfx canister id test`\")" --output idl | grep -x "(record.*controllers.*module_hash.*recent_changes.*creation.*code_deployment.*total_num_changes = 2.*)" - dfx canister call canister-info canister_controllers "(principal\"`dfx canister id test`\",variant {at_timestamp=`perl -MTime::HiRes=time -e 'printf "%d\n", 1e9*time'`})" --output idl | grep -x "(opt record.*vec.*`dfx identity get-principal`.*opt.*)" - dfx canister call canister-info canister_controllers "(principal\"`dfx canister id test`\",variant {at_version=2})" --output idl | grep -x "(opt record.*vec.*`dfx identity get-principal`.*null.*)" - dfx canister call canister-info canister_module_hash "(principal\"`dfx canister id test`\",variant {at_timestamp=`perl -MTime::HiRes=time -e 'printf "%d\n", 1e9*time'`})" --output idl | grep -x "(opt record.*opt.*blob.*opt.*)" - dfx canister call canister-info canister_module_hash "(principal\"`dfx canister id test`\",variant {at_version=2})" --output idl | grep -x "(opt record.*opt.*blob.*null.*)" - dfx canister call canister-info canister_deployment_chain "(principal\"`dfx canister id test`\",variant {at_timestamp=`perl -MTime::HiRes=time -e 'printf "%d\n", 1e9*time'`})" --output idl | grep -x "(record.*vec.*record.*code_deployment.*max_clock_skew.*opt.*)" - dfx canister call canister-info canister_deployment_chain "(principal\"`dfx canister id test`\",variant {at_version=2})" --output idl | grep -x "(record.*vec.*record.*code_deployment.*max_clock_skew.*null.*)" - dfx canister call canister-info reflexive_transitive_controllers "(principal\"`dfx canister id test`\")" --output idl | grep -x "(vec.*`dfx identity get-principal`.*)" - -.PHONY: clean -.SILENT: clean -clean: - rm -fr .dfx diff --git a/rust/canister-info/test.sh b/rust/canister-info/test.sh new file mode 100755 index 0000000000..91337629a5 --- /dev/null +++ b/rust/canister-info/test.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -e + +dfx deploy +dfx canister call canister-info info "(principal \"`dfx canister id test`\")" --output idl | grep -x "(record.*controllers.*module_hash.*recent_changes.*creation.*code_deployment.*total_num_changes = 2.*)" +dfx canister call canister-info canister_controllers "(principal \"`dfx canister id test`\",variant {at_timestamp=`perl -MTime::HiRes=time -e 'printf "%d\n", 1e9*time'`})" --output idl | grep -x "(opt record.*vec.*`dfx identity get-principal`.*opt.*)" +dfx canister call canister-info canister_controllers "(principal \"`dfx canister id test`\",variant {at_version=2})" --output idl | grep -x "(opt record.*vec.*`dfx identity get-principal`.*null.*)" +dfx canister call canister-info canister_module_hash "(principal \"`dfx canister id test`\",variant {at_timestamp=`perl -MTime::HiRes=time -e 'printf "%d\n", 1e9*time'`})" --output idl | grep -x "(opt record.*opt.*blob.*opt.*)" +dfx canister call canister-info canister_module_hash "(principal \"`dfx canister id test`\",variant {at_version=2})" --output idl | grep -x "(opt record.*opt.*blob.*null.*)" +dfx canister call canister-info canister_deployment_chain "(principal \"`dfx canister id test`\",variant {at_timestamp=`perl -MTime::HiRes=time -e 'printf "%d\n", 1e9*time'`})" --output idl | grep -x "(record.*vec.*record.*code_deployment.*max_clock_skew.*opt.*)" +dfx canister call canister-info canister_deployment_chain "(principal \"`dfx canister id test`\",variant {at_version=2})" --output idl | grep -x "(record.*vec.*record.*code_deployment.*max_clock_skew.*null.*)" +dfx canister call canister-info reflexive_transitive_controllers "(principal \"`dfx canister id test`\")" --output idl | grep -x "(vec.*`dfx identity get-principal`.*)"