test: bbox zero volume check #37
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
name: "[test] test siibra-paper notebooks" | |
on: | |
push: | |
branches: ["main", "refactor_attr"] | |
pull_request: | |
branches: ["*"] | |
jobs: | |
test_tutorials: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -U . | |
pip install matplotlib jupyter | |
sudo apt-get install -y pandoc texlive-xetex | |
- name: Run notebooks with nbmake | |
run: | | |
error_flag=0 | |
for notebook in $(find ./paper_notebooks -type f) | |
do | |
echo "jupyter execute $notebook --allow-errors --inplace" | |
jupyter execute $notebook --allow-errors --inplace | |
echo "Trying to print tracebacks & set error flag where appropriate" | |
jq -c '.cells[]' $notebook | while IFS= read -r line | |
do | |
echo "-------------------------------" | |
outputs=$(echo $line | jq '.outputs') | |
# sometimes outputs is null (non code block?) | |
if [[ $outputs == "null" ]] | |
then | |
echo "Non code block. Skipping..." | |
continue | |
fi | |
error_length=$(echo $line | jq '[.outputs[] | select( .output_type == "error" )] | length') | |
# if outputs has no errors, then continue | |
if [[ $error_length -eq 0 ]] | |
then | |
echo "No Error. Skipping" | |
continue | |
fi | |
error_flag=1 | |
echo $line | jq -r '.outputs[] | select( .output_type == "error" ) | .traceback | join("")' | |
done | |
echo "jupyter nbconvert --to pdf $notebook" | |
jupyter nbconvert --to pdf $notebook | |
done | |
echo "End of evaluation $error_flag" | |
if [[ "$error_flag" != "0" ]] | |
then | |
echo "Trying to exit 1" | |
exit 1 | |
fi | |
- if: always() | |
name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Notebook PDFs | |
path: | | |
paper_notebooks/*.pdf | |
paper_notebooks/*.ipynb |