Skip to content

Commit

Permalink
More summary
Browse files Browse the repository at this point in the history
  • Loading branch information
teutoburg committed Nov 19, 2023
1 parent 603066f commit 42289eb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions runnotebooks.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
#!/usr/bin/env bash

echo "# Running Notebooks Tests" >> $GITHUB_STEP_SUMMARY

if [[ "x${1}" == "x--clone-irdb" ]] ; then
# Cloning IRDB
if [[ ! -e irdb ]] ; then
echo "_Cloning IRDB_" >> $GITHUB_STEP_SUMMARY
git clone https://github.com/AstarVienna/irdb.git
fi

echo "## Symlinks" >> $GITHUB_STEP_SUMMARY
# https://github.com/koalaman/shellcheck/wiki/SC2044
find . -iname "*.ipynb" -printf '%h\0' | sort -z | uniq -z | while IFS= read -r -d '' dirnotebooks; do
echo "${dirnotebooks}"
echo "- ${dirnotebooks}" >> $GITHUB_STEP_SUMMARY
dirinstpkgs="${dirnotebooks}/inst_pkgs"
if [[ (! -e ./docs/source/examples/inst_pkgs) && (! -L ./docs/source/examples/inst_pkgs) ]] ; then
echo "Creating symlink to irdb: ${dirinstpkgs}"
echo "Creating symlink to irdb: ${dirinstpkgs}" >> $GITHUB_STEP_SUMMARY
ln -s irdb "${dirinstpkgs}"
else
echo "Directory exists, not creating symlink: ${dirinstpkgs}"
echo "Directory exists, not creating symlink: ${dirinstpkgs}" >> $GITHUB_STEP_SUMMARY
fi

# Comment out any download_package[s] in the notebooks.
Expand All @@ -30,14 +35,14 @@ echo "## Notebooks tested" >> $GITHUB_STEP_SUMMARY
find . -iname "*.ipynb" -print0 | while IFS= read -r -d '' fnnotebook
do
echo "Testing ${fnnotebook} ..."
echo "- ${fnnotebook}" >> $GITHUB_STEP_SUMMARY
fnpy="${fnnotebook%.ipynb}.py"

# Convert .ipynb file to .py.
jupytext --to py "${fnnotebook}"

# Run the python script and quit on first error.
python "${fnpy}" || exit 1
echo "- ${fnnotebook}" >> $GITHUB_STEP_SUMMARY

# Delete generated files if --delete is specified.
# By default do not delete any files.
Expand Down

0 comments on commit 42289eb

Please sign in to comment.