From dad10b25f1e96d8531ee00525f650f0be27580e7 Mon Sep 17 00:00:00 2001 From: Harishankar Date: Tue, 12 May 2026 02:35:07 +0530 Subject: [PATCH 1/3] Adding GitHub Actions CI to execute notebooks So this adds a workflow that creates a conda-forge environment with xeus-cpp and executes the OpenMP tutorial notebooks on every push and pull request targeting master. Executed notebooks are uploaded as an artifact for review. Notes: - An environment.yml file is added at the repo root so contributors can reproduce the CI environment locally with: micromamba create -f environment.yml - The kernel requires libomp.so to be preloaded at runtime via LD_PRELOAD; without it, the JIT fails to resolve OpenMP symbols (omp_get_thread_num, __kmpc_fork_call, etc.). - openmp-demo.ipynb is skipped: example5() allocates ~8 GB which exceeds the ~7 GB RAM available on standard GitHub-hosted runners. --- .github/workflows/ci.yml | 69 ++++++++++++++++++++++++++++++++++++++++ environment.yml | 9 ++++++ 2 files changed, 78 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 environment.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..909cd9a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,69 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + branches: [master] + workflow_dispatch: + +jobs: + execute-notebooks: + name: Execute notebooks + runs-on: ubuntu-latest + + defaults: + run: + shell: bash -el {0} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up micromamba environment + uses: mamba-org/setup-micromamba@v2 + with: + environment-file: environment.yml + cache-environment: true + + - 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 + 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). + 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" \ + 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 + with: + name: executed-notebooks + path: executed/ + if-no-files-found: ignore \ No newline at end of file diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..8b76ec8 --- /dev/null +++ b/environment.yml @@ -0,0 +1,9 @@ +name: livecpp-ci +channels: + - conda-forge +dependencies: + - python>=3.11 + - xeus-cpp + - jupyter + - nbconvert + - llvm-openmp \ No newline at end of file From 558a02a31a6dca58685f10c7c6e1e8ef6392ba0d Mon Sep 17 00:00:00 2001 From: Harishankar Date: Tue, 12 May 2026 03:11:44 +0530 Subject: [PATCH 2/3] Trigger CI on all branches and PRs (bootstrap) --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 909cd9a..0f83947 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,6 @@ on: push: branches: [master] pull_request: - branches: [master] workflow_dispatch: jobs: From aa6d2d9dc9231d7d9df8f9e7204d1773c6166f12 Mon Sep 17 00:00:00 2001 From: Harishankar Date: Tue, 12 May 2026 03:19:27 +0530 Subject: [PATCH 3/3] Remove branch filter from push trigger to bootstrap CI --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f83947..e6fd289 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,6 @@ name: CI on: push: - branches: [master] pull_request: workflow_dispatch: