Skip to content

Run connect-mode integration tests against plain jupyter-server, jupyter-collaboration, and jupyter-server-documents #209

Run connect-mode integration tests against plain jupyter-server, jupyter-collaboration, and jupyter-server-documents

Run connect-mode integration tests against plain jupyter-server, jupyter-collaboration, and jupyter-server-documents #209

Workflow file for this run

name: Rust
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: cargo fmt
run: cargo fmt -- --check
- name: cargo clippy
run: cargo clippy -- -D warnings
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Cache Python test venv
uses: actions/cache@v4
with:
path: tests/.test-venv
key: ${{ runner.os }}-test-venv-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-test-venv-
- name: Setup test environment
run: ./tests/setup_test_env.sh
- name: Build
run: cargo build --verbose
- name: Run tests
run: |
echo "Running all tests..."
cargo test --test integration_local_mode --verbose
cargo test --test integration_execution --verbose
cargo test --bins --verbose
echo "✅ All tests passed!"
test-connect:
name: Test connect (${{ matrix.collab-config }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- collab-config: vanilla
packages: "jupyter_server"
- collab-config: jupyter-collaboration
packages: "jupyter-collaboration"
- collab-config: jupyter-server-documents
packages: "jupyter-server-documents"
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Cache Python test venv
uses: actions/cache@v4
with:
path: tests/.test-venv
key: ${{ runner.os }}-test-venv-connect-${{ matrix.collab-config }}
restore-keys: |
${{ runner.os }}-test-venv-connect-
- name: Create venv and install packages
run: uv venv tests/.test-venv && uv pip install --python tests/.test-venv ipykernel ${{ matrix.packages }}
- name: Log installed packages
run: uv pip list --python tests/.test-venv
- name: Build
run: cargo build --verbose
- name: Start Jupyter server
run: |
VENV="$(pwd)/tests/.test-venv"
SERVER_ROOT=$(mktemp -d)
PORT=$(python3 -c "import socket; s=socket.socket(); s.bind(('',0)); p=s.getsockname()[1]; s.close(); print(p)")
PATH="$VENV/bin:$PATH" VIRTUAL_ENV="$VENV" \
jupyter server \
--no-browser \
--ServerApp.token=nbtest123 \
--ServerApp.root_dir="$SERVER_ROOT" \
--port="$PORT" \
--ServerApp.open_browser=False \
> "$SERVER_ROOT/jupyter.log" 2>&1 &
echo "NB_TEST_SERVER_URL=http://127.0.0.1:$PORT" >> "$GITHUB_ENV"
echo "NB_TEST_SERVER_TOKEN=nbtest123" >> "$GITHUB_ENV"
echo "NB_TEST_SERVER_ROOT=$SERVER_ROOT" >> "$GITHUB_ENV"
SERVER_READY=false
for i in $(seq 1 150); do
curl -sf "http://127.0.0.1:$PORT/api?token=nbtest123" > /dev/null 2>&1 && SERVER_READY=true && break
sleep 0.2
done
if [ "$SERVER_READY" != "true" ]; then
echo "::error::Jupyter server failed to start on port $PORT"; exit 1
fi
echo "Jupyter server ready on port $PORT"
- name: Run connect-mode tests
run: cargo test --test integration_connect_mode -- --test-threads=1
- name: Show Jupyter server logs
if: failure()
run: cat "$NB_TEST_SERVER_ROOT/jupyter.log" || true
test-windows:
name: Test (Windows)
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install Rust target
run: rustup target add x86_64-pc-windows-msvc
- name: Build release binary
run: cargo build --release --target x86_64-pc-windows-msvc
- name: Run unit tests (kernel discovery)
# Integration tests require a Unix shell setup script; run unit tests only.
# This verifies Windows-specific #[cfg(target_os = "windows")] code paths compile
# and that kernel directory logic is correct on Windows.
run: cargo test --bins --verbose
- name: Upload Windows binary
uses: actions/upload-artifact@v4
with:
name: nb-windows-amd64
path: target/x86_64-pc-windows-msvc/release/nb.exe
retention-days: 30