Skip to content

reorder dimension to align array order and move ValidateMixin to Base… #227

reorder dimension to align array order and move ValidateMixin to Base…

reorder dimension to align array order and move ValidateMixin to Base… #227

name: Check Examples APIs
on: [push, pull_request]
jobs:
examples-check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
os: [ubuntu-latest] #, macos-latest, windows-latest]
fail-fast: False
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install project
run: |
python -m pip install --upgrade pip
pip install -e .
pip install nbconvert # For converting Jupyter notebook to python script in the next step
- name: Run examples
# Run all examples and test that they finish successfully. Do not evaluate the results.
# Copy the examples to a new directory outside of the repo to ensure that there is no
# reliance on the repo directory structure.
run: |
mkdir -p temp1/temp2/temp3
cp -r examples/ temp1/temp2/temp3/.
cd temp1/temp2/temp3/examples/
error_found=0 # 0 is false
error_results="Error in example:"
# Run each Python script example
for i in *.py; do
# Skip these examples since they have additional dependencies
if [[ $i == *15* ]]; then
continue
fi
if [[ $i == *19* ]]; then
continue
fi
if ! python $i; then
error_results="${error_results}"$'\n'" - ${i}"
error_found=1
fi
done
if [[ $error_found ]]; then
echo "${error_results}"
fi
exit $error_found