diff --git a/build-py-project-and-run-examples.sh b/build-py-project-and-run-examples.sh index a149e883ff969fe757a5c568aa72c14e5dc5adf4..18fe6124c7015b2a5d53cea380e1515c38fe3049 100644 --- a/build-py-project-and-run-examples.sh +++ b/build-py-project-and-run-examples.sh @@ -5,12 +5,33 @@ set -e curl -L -O -k https://gitlab.tiker.net/inducer/ci-support/raw/master/build-py-project.sh source build-py-project.sh -cd examples -for i in $(find . -name '*.py' -print ); do - echo "-----------------------------------------------------------------------" - echo "RUNNING $i" - echo "-----------------------------------------------------------------------" - dn=$(dirname "$i") - bn=$(basename "$i") - (cd $dn; ${PY_EXE} "$bn") -done +function run_examples() +{ + PATTERN=$1 + CMDLINE=$2 + for i in $(find examples -name "$PATTERN" -print ); do + echo "-----------------------------------------------------------------------" + echo "RUNNING $i" + echo "-----------------------------------------------------------------------" + dn=$(dirname "$i") + bn=$(basename "$i") + (cd $dn; $CMDLINE "$bn") + done +end + +function run_py_examples() +{ + run_examples "*.py" ${PY_EXE} +end +function run_ipynb_examples() +{ + run_examples "*.ipynb" "${PY_EXE} -m nbconvert --execute" +end +function run_floopy_examples() +{ + run_examples "*.floopy" "${PY_EXE} -m loopy" +end + +run_py_examples +run_ipynb_examples +run_floopy_examples