fix: data.memory.swapUsed.toFixed crash + full nested null-safety in β¦ #227
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: Kimari CI | |
| on: | |
| push: | |
| branches: [main, develop] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lint-python: | |
| name: Lint Python | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install ruff | |
| run: pip install "ruff>=0.5.0" | |
| - name: Run ruff check | |
| run: ruff check kimari/ tests/ | |
| - name: Run ruff format check | |
| run: ruff format --check kimari/ tests/ | |
| lint-scripts: | |
| name: Lint Shell Scripts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check bash scripts | |
| run: | | |
| for f in scripts/linux/*.sh; do | |
| bash -n "$f" || exit 1 | |
| done | |
| echo "All shell scripts OK" | |
| validate-config: | |
| name: Validate Config | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: pip install "jsonschema>=4.0.0" | |
| - name: Validate profiles config | |
| run: | | |
| python -c " | |
| import json, jsonschema | |
| config = json.load(open('config/kimari.profiles.json')) | |
| schema = json.load(open('config/kimari.profiles.schema.json')) | |
| jsonschema.validate(config, schema) | |
| default = config.get('default_profile', '') | |
| assert default in config.get('profiles', {}), f'default_profile \"{default}\" not found' | |
| print(f'Config valid. default_profile={default}') | |
| " | |
| - name: Validate models registry | |
| run: | | |
| python -c " | |
| import json | |
| registry = json.load(open('config/kimari.models.json')) | |
| for m in registry.get('models', []): | |
| for field in ['id', 'display_name', 'url', 'filename', 'target_path', 'size_gb', 'recommended_profile', 'status', 'license']: | |
| assert field in m, f'Model {m.get(\"id\", \"?\")} missing field: {field}' | |
| assert m['url'].startswith('https://'), f'Model {m.get(\"id\", \"?\")} URL must use HTTPS: {m[\"url\"]}' | |
| print(f'Models registry valid. {len(registry[\"models\"])} models, all URLs use HTTPS.') | |
| " | |
| validate-makefile: | |
| name: Validate Makefile | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check Makefile targets | |
| run: | | |
| make -n dry-run | |
| make -n bench | |
| make -n bench-1060 | |
| make -n bench-1080 | |
| make -n ci-local | |
| echo "Makefile OK" | |
| pytest: | |
| name: Pytest (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: pip install -r requirements-dev.txt | |
| - name: Compile check | |
| run: | | |
| python -m py_compile kimari/__init__.py | |
| python -m py_compile kimari/cli/main.py | |
| python -m py_compile kimari/core/constants.py | |
| python -m py_compile kimari/core/state.py | |
| python -m py_compile kimari/core/errors.py | |
| python -m py_compile kimari/core/detection.py | |
| python -m py_compile kimari/config/loader.py | |
| python -m py_compile kimari/models/registry.py | |
| python -m py_compile kimari/profiles/manager.py | |
| python -m py_compile kimari/benchmarks/kimarifit.py | |
| python -m py_compile kimari/benchmarks/bench.py | |
| python -m py_compile kimari/gateway/dashboard_manager.py | |
| python -m py_compile kimari/cli/console_cmd.py | |
| - name: Run active release tests | |
| run: | | |
| python -m pytest \ | |
| tests/test_release_v0187.py \ | |
| tests/test_install_scripts.py \ | |
| tests/test_console_cli.py \ | |
| tests/test_gateway_setup_cli.py \ | |
| tests/test_gateway_cli.py \ | |
| -q | |
| cli-smoke: | |
| name: CLI Smoke Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: pip install -r requirements-dev.txt | |
| - name: Version check (python -m) | |
| run: python -m kimari.cli.main --version | |
| - name: Doctor | |
| run: python -m kimari.cli.main doctor || true | |
| - name: Info | |
| run: python -m kimari.cli.main info | |
| - name: Profiles | |
| run: python -m kimari.cli.main profiles | |
| - name: Pull list | |
| run: python -m kimari.cli.main pull --list | |
| - name: Start dry-run (explicit profile) | |
| run: python -m kimari.cli.main start --profile test --dry-run | |
| - name: Start dry-run (default profile) | |
| run: python -m kimari.cli.main start --dry-run | |
| - name: Config validate | |
| run: python -m kimari.cli.main config validate | |
| - name: Config path | |
| run: python -m kimari.cli.main config path | |
| - name: Gateway dashboard dry-run | |
| run: python -m kimari gateway start --dry-run --json | |
| - name: Gateway dashboard status | |
| run: python -m kimari gateway status --json | |
| - name: Console JSON | |
| run: python -m kimari console --json | |
| installed-cli-smoke: | |
| name: Installed CLI Smoke Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install kimari package | |
| run: pip install -e . | |
| - name: Installed CLI β version | |
| run: kimari --version | |
| - name: Installed CLI β info | |
| run: kimari info | |
| - name: Installed CLI β start dry-run (default profile) | |
| run: kimari start --dry-run | |
| - name: Installed CLI β config validate | |
| run: kimari config validate | |
| build-package: | |
| name: Build Package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install build tools | |
| run: pip install build twine | |
| - name: Build package | |
| run: python -m build | |
| - name: Check package with twine | |
| run: twine check dist/* | |
| - name: Verify py.typed in package | |
| run: | | |
| python -c " | |
| import zipfile, glob | |
| wheels = glob.glob('dist/*.whl') | |
| assert wheels, 'No wheel found in dist/' | |
| with zipfile.ZipFile(wheels[0]) as z: | |
| names = z.namelist() | |
| assert any('py.typed' in n for n in names), f'py.typed not found in {wheels[0]}' | |
| print(f'py.typed found in {wheels[0]}') | |
| " | |
| - name: Verify no unwanted files in package | |
| run: | | |
| python -c " | |
| import zipfile, glob | |
| wheels = glob.glob('dist/*.whl') | |
| assert wheels, 'No wheel found in dist/' | |
| with zipfile.ZipFile(wheels[0]) as z: | |
| names = z.namelist() | |
| forbidden = [n for n in names if any( | |
| n.startswith(p) or p in n | |
| for p in ['.kimari/', 'kimari-server.log', '.kimari-server.pid'] | |
| )] | |
| assert not forbidden, f'Unwanted files in wheel: {forbidden}' | |
| print('Package contents OK β no unwanted files') | |
| " | |
| check-docs: | |
| name: Check Documentation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check key docs exist | |
| run: | | |
| for f in README.md GETTING_STARTED.md ROADMAP.md CHANGELOG.md SECURITY.md PRIVACY.md docs/COMPARISON.md docs/WEB_UI_PLAN.md; do | |
| test -f "$f" && echo "$f: OK" || { echo "$f: MISSING"; exit 1; } | |
| done | |
| wheel-install-smoke: | |
| name: Wheel Install Smoke Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install build tools | |
| run: pip install build | |
| - name: Build wheel | |
| run: python -m build | |
| - name: Create test venv | |
| run: python -m venv /tmp/kimari-wheel-test | |
| - name: Install from wheel | |
| run: | | |
| source /tmp/kimari-wheel-test/bin/activate | |
| pip install dist/*.whl | |
| - name: Test kimari --version | |
| run: | | |
| source /tmp/kimari-wheel-test/bin/activate | |
| kimari --version | |
| - name: Test kimari config path | |
| run: | | |
| source /tmp/kimari-wheel-test/bin/activate | |
| kimari config path | |
| - name: Test kimari setup --json | |
| run: | | |
| source /tmp/kimari-wheel-test/bin/activate | |
| kimari setup --json | |
| - name: Test kimari start --dry-run | |
| run: | | |
| source /tmp/kimari-wheel-test/bin/activate | |
| kimari start --dry-run | |
| - name: Test kimari token create/show/delete | |
| run: | | |
| source /tmp/kimari-wheel-test/bin/activate | |
| kimari token create | |
| kimari token show | |
| kimari token delete | |
| - name: Verify defaults in wheel | |
| run: | | |
| source /tmp/kimari-wheel-test/bin/activate | |
| python -c " | |
| import zipfile, glob | |
| wheels = glob.glob('dist/*.whl') | |
| assert wheels, 'No wheel found' | |
| with zipfile.ZipFile(wheels[0]) as z: | |
| names = z.namelist() | |
| for f in ['kimari/defaults/kimari.profiles.json', 'kimari/defaults/kimari.profiles.schema.json', 'kimari/defaults/kimari.models.json']: | |
| assert f in names, f'{f} missing from wheel' | |
| print('All defaults JSON files present in wheel') | |
| " | |
| release-check: | |
| name: Release Validation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install release validation dependencies | |
| run: pip install -r requirements-dev.txt | |
| - name: Run release validation script | |
| run: python scripts/release/check-release.py |