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-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)
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