Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:
Comment thread
Harishankar14 marked this conversation as resolved.

jobs:
execute-notebooks:
name: Execute notebooks
runs-on: ubuntu-latest

defaults:
run:
shell: bash -el {0}

steps:
- name: Checkout repository
uses: actions/checkout@v4
Comment thread
Harishankar14 marked this conversation as resolved.

- name: Set up micromamba environment
uses: mamba-org/setup-micromamba@v2
Comment thread
Harishankar14 marked this conversation as resolved.
with:
environment-file: environment.yml
cache-environment: true
Comment thread
Harishankar14 marked this conversation as resolved.

- name: List available kernels
run: jupyter kernelspec list

- name: Execute notebooks
run: |
set +e # don't stop on first failure; we want to see all results
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any notebook fails to execute, we would want the ci to fail. Why run all the notebooks if the ci is going to fail anyway?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jeez, this was a typo, i thing i wrote the wrong piece of line here,lol.

mkdir -p executed
failed=0

# NOTE: openmp-demo.ipynb is skipped — example5() allocates ~8 GB
# which exceeds the ~7 GB RAM on standard GitHub-hosted runners.
# TODO: revisit (shrink N for CI, skip just example5 via cell metadata,
# or run on a larger runner).
Comment thread
Harishankar14 marked this conversation as resolved.
for nb in openmp/*.ipynb; do
if [ "$(basename "$nb")" = "openmp-demo.ipynb" ]; then
echo "::warning file=$nb::Skipping $nb (needs >7GB RAM)"
continue
fi

echo "=== Executing $nb ==="
LD_PRELOAD="$CONDA_PREFIX/lib/libomp.so" \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need this LD_PRELOAD. You need the clang resource directory in your environment. Its a known bug in CppInterOp.

jupyter nbconvert --to notebook --execute "$nb" \
--output "../executed/$(basename "$nb")" \
--ExecutePreprocessor.timeout=300
if [ $? -ne 0 ]; then
echo "::error file=$nb::Failed to execute $nb"
failed=$((failed + 1))
fi
done

echo ""
echo "=== Summary: $failed notebook(s) failed ==="
exit $failed

- name: Upload executed notebooks as artifact
if: always()
uses: actions/upload-artifact@v4
Comment thread
Harishankar14 marked this conversation as resolved.
with:
name: executed-notebooks
path: executed/
if-no-files-found: ignore
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surely if no files are found something went wrong with executing the notebooks. I do not understand why you would want to ignore them

Copy link
Copy Markdown
Author

@Harishankar14 Harishankar14 May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mcbarton Okay yeah i guess we can remove the upload step entirely. With pytest --nbval doing output validation, executed-notebook artifacts aren't needed and the test result is the validation. So both the version pin and the if-no-files-found settings are moot ??

9 changes: 9 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: livecpp-ci
Comment thread
Harishankar14 marked this conversation as resolved.
channels:
- conda-forge
dependencies:
- python>=3.11
Comment thread
Harishankar14 marked this conversation as resolved.
- xeus-cpp
- jupyter
- nbconvert
- llvm-openmp