add sb-heist submodule #13
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: Jupyter Notebook CI | |
on: | |
push: | |
branches: [ main, master ] | |
pull_request: | |
branches: [ main, master ] | |
jobs: | |
validate-notebooks: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive # This is important for submodules | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install Poetry | |
run: | | |
curl -sSL https://install.python-poetry.org | python3 - | |
echo "$HOME/.local/bin" >> $GITHUB_PATH # Ensure Poetry is in PATH | |
- name: Configure Poetry | |
run: | | |
poetry config virtualenvs.in-project true # Create venv inside the project | |
- name: Install dependencies | |
run: | | |
poetry install --no-interaction --no-root # Install dependencies from pyproject.toml | |
- name: Check installed dependencies | |
run: poetry show | |
- name: Validate Jupyter notebooks | |
run: | | |
# Check that notebooks are valid JSON | |
python -c "import glob, json; all(json.load(open(notebook)) for notebook in glob.glob('**/*.ipynb', recursive=True))" | |
- name: Execute notebooks | |
run: | | |
# Convert notebooks to Python and validate they can run | |
# You can adjust this based on your specific needs | |
for notebook in $(find . -name "*.ipynb" -not -path "*/\.*"); do | |
echo "Testing $notebook" | |
poetry run pytest --nbval-lax "$notebook" # Run pytest inside Poetry's virtual environment | |
done | |