Fix kernel discovery: use relative path in argv #16
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| # Allow only one concurrent deployment to GitHub Pages | |
| concurrency: | |
| group: pages-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ============================================================ | |
| # Native build (Linux x86_64) | |
| # ============================================================ | |
| native-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake build-essential nlohmann-json3-dev \ | |
| uuid-dev libssl-dev python3 python3-pip \ | |
| clang libc++-dev libc++abi-dev | |
| - name: Install Lean via elan | |
| run: | | |
| curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y | |
| echo "$HOME/.elan/bin" >> $GITHUB_PATH | |
| - name: Verify Lean installation | |
| run: lean --version && lake --version | |
| - name: Build C++ FFI library | |
| run: | | |
| # Use system clang++ with libc++ so cmake can find all system | |
| # libraries and headers (leanc's sysroot is too minimal for libzmq). | |
| # The -stdlib=libc++ ensures C++ ABI matches Lean's linker. | |
| cmake -S . -B build-cmake \ | |
| -DCMAKE_C_COMPILER=clang \ | |
| -DCMAKE_CXX_COMPILER=clang++ \ | |
| -DCMAKE_CXX_FLAGS="-stdlib=libc++" | |
| cmake --build build-cmake | |
| - name: Build glibc C23 compat shim | |
| run: | | |
| # System clang++ compiles against glibc 2.38+ which redirects | |
| # strtoull→__isoc23_strtoull (C23) when _GNU_SOURCE is defined. | |
| # leanc's bundled older glibc lacks these symbols, so we provide | |
| # a shim compiled with leanc that forwards C23→regular versions. | |
| leanc -c src/glibc_isoc23_compat.c -o build-cmake/glibc_isoc23_compat.o | |
| - name: Build Lean kernel | |
| run: lake build xlean | |
| - name: Verify build artifacts | |
| run: | | |
| ls -lh build-cmake/libxeus_ffi.a | |
| ls -lh .lake/build/bin/xlean | |
| file .lake/build/bin/xlean | |
| - name: Upload native binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: xlean-linux-x86_64 | |
| path: .lake/build/bin/xlean | |
| retention-days: 7 | |
| # ============================================================ | |
| # WASM build (emscripten Memory64 via pixi) | |
| # ============================================================ | |
| wasm-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install Lean via elan | |
| run: | | |
| curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y | |
| echo "$HOME/.elan/bin" >> $GITHUB_PATH | |
| - name: Install pixi | |
| uses: prefix-dev/setup-pixi@v0.8.1 | |
| with: | |
| pixi-version: v0.45.0 | |
| - name: Install pixi environments | |
| run: | | |
| pixi install -e wasm-build --no-lockfile-update || pixi install -e wasm-build | |
| pixi install -e wasm-host --no-lockfile-update || pixi install -e wasm-host | |
| - name: Fix emscripten symlinks | |
| run: pixi run -e wasm-build fix-emscripten-links || true | |
| - name: Build Lean REPL (lake) | |
| run: lake build REPL WasmRepl | |
| - name: Configure WASM build (emcmake) | |
| run: | | |
| pixi run -e wasm-build emcmake cmake -S . -B wasm-build \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON | |
| - name: Build WASM kernel (emmake) | |
| run: | | |
| pixi run -e wasm-build emmake make -C wasm-build -j$(nproc) xlean test_wasm_node | |
| echo "=== Checking if xlean binaries were built ===" | |
| ls -lh wasm-build/xlean* || echo "No xlean binaries found in wasm-build" | |
| - name: Install WASM kernel | |
| run: | | |
| PREFIX=$(pixi info -e wasm-host --json 2>/dev/null | python3 -c "import sys,json; print(json.load(sys.stdin)['environments_info'][0]['prefix'])" 2>/dev/null || echo ".pixi/envs/wasm-host") | |
| echo "Installing to PREFIX: $PREFIX" | |
| cmake --install wasm-build --prefix "$PREFIX" | |
| echo "Verifying kernel installation:" | |
| ls -lh "$PREFIX/bin/" | grep xlean || echo "No xlean files in bin/" | |
| ls -lh "$PREFIX/share/jupyter/kernels/" || echo "No kernels directory" | |
| if [ -d "$PREFIX/share/jupyter/kernels/xlean" ]; then | |
| echo "Contents of kernel directory:" | |
| ls -lha "$PREFIX/share/jupyter/kernels/xlean/" | |
| echo "kernel.json contents:" | |
| cat "$PREFIX/share/jupyter/kernels/xlean/kernel.json" | |
| fi | |
| - name: Setup Node.js 23+ for WASM Memory64 tests | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '23' | |
| - name: Run WASM tests (test_wasm_node) | |
| run: | | |
| node --experimental-wasm-memory64 wasm-build/test_wasm_node.js | |
| - name: Build JupyterLite site | |
| run: | | |
| mkdir -p notebooks | |
| PREFIX=$(pixi info -e wasm-host --json 2>/dev/null | python3 -c "import sys,json; print(json.load(sys.stdin)['environments_info'][0]['prefix'])" 2>/dev/null || echo ".pixi/envs/wasm-host") | |
| echo "=== PREFIX before JupyterLite build: $PREFIX ===" | |
| echo "=== Files in PREFIX/bin ===" | |
| ls -lh "$PREFIX/bin/" | grep xlean || echo "No xlean in bin" | |
| echo "=== Files in PREFIX/share/jupyter/kernels ===" | |
| find "$PREFIX/share/jupyter/kernels" -type f -ls 2>/dev/null || echo "No kernels found" | |
| pixi run -e wasm-build jupyter lite build \ | |
| --XeusAddon.prefix="$PREFIX" \ | |
| "--XeusAddon.default_channels=[https://conda.anaconda.org/conda-forge]" \ | |
| --contents notebooks \ | |
| --output-dir _output \ | |
| --force | |
| - name: Verify JupyterLite output | |
| run: | | |
| ls -lh _output/index.html | |
| echo "=== Searching for xlean files in _output ===" | |
| find _output -name "xlean*" -ls | head -20 | |
| echo "=== Searching for kernel.json files in _output ===" | |
| find _output -name "kernel.json" -ls | |
| echo "=== Checking for xeus kernels ===" | |
| find _output -type d -name "*xeus*" -o -name "*kernel*" | head -20 | |
| echo "=== Contents of _output/xeus ===" | |
| ls -laR _output/xeus/ | head -100 | |
| echo "=== Checking xeus/kernels.json ===" | |
| if [ -f _output/xeus/kernels.json ]; then | |
| cat _output/xeus/kernels.json | |
| fi | |
| echo "=== Checking jupyter-lite.json ===" | |
| if [ -f _output/jupyter-lite.json ]; then | |
| cat _output/jupyter-lite.json | python3 -m json.tool | head -100 | |
| fi | |
| - name: Upload JupyterLite site | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jupyterlite-site | |
| path: _output/ | |
| retention-days: 7 | |
| - name: Upload Pages artifact | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: _output/ | |
| # ============================================================ | |
| # Deploy to GitHub Pages (main branch only) | |
| # ============================================================ | |
| deploy-pages: | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| needs: wasm-build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| contents: read | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Configure GitHub Pages | |
| run: | | |
| echo "Deploying to GitHub Pages" | |
| echo "Repository: ${{ github.repository }}" | |
| echo "Ensure GitHub Pages is enabled at:" | |
| echo "https://github.com/${{ github.repository }}/settings/pages" | |
| echo "Source should be set to: GitHub Actions" | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| with: | |
| timeout: 600000 |