Files
NexusOS/.gitea/workflows/package.yml
T
Athena KaminskyandClaude Opus 5 9104c724c4 feat(packaging): move the CLI into nexusos_cli and make the wheel self-sufficient
The CLI shipped from `management/`, which also holds desktop-only pieces (the
Tk control panel, the XFCE panel wiring, the shell wrappers). Packaging that
directory meant the wheel either dragged in tkinter or shipped a broken import.
Split it: `nexusos_cli/` is what the wheel ships and what `nexus`/`ncp`/
`nexusos` dispatch to, `management/` keeps the desktop half.

Alongside the move:

* hatch_build.py decides the interface/web/dist include at build time. dist/
  is gitignored, so a static force-include aborts `pip install -e .` on a
  fresh clone - before the reader reaches the `npm run build` step. Editable
  installs now skip a missing dist; wheels and sdists hard-error naming the
  command to run.
* synapse/proc_util.py gives frontend_manager and ncp process inspection and
  termination without psutil, which became an optional extra when the wheel
  landed. It routes around Windows having no signals, where os.kill(pid, 15)
  is an unblockable TerminateProcess rather than a polite request.
* nexusos_cli/monitor.py adds `ncp monitor`, an ASCII dashboard with no curses
  or rich dependency so it works in Termux, plain SSH and Windows Terminal.
  Collector and renderer are separate so tests feed fixtures, no stack needed.
* tests/test_packaging_deps.py fails the gate when synapse or nexusos_cli
  import a distribution pyproject does not declare, and when an optional
  dependency is imported at module scope instead of lazily.
* bin/check.sh now builds the wheel, twine-checks it, and asserts the compiled
  UI and seed playbooks are actually inside it. A wheel that builds but ships
  no dist/ serves a blank page, which only shows up after release.

tests/test_nexus_api.py moves to tests/ with the module it covers.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-26 08:11:39 -05:00

75 lines
2.2 KiB
YAML

name: package
on:
push:
branches: [main, code-preview]
tags: ["v*"]
pull_request:
jobs:
wheel:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: interface/web/package-lock.json
- name: Build and test web UI
working-directory: interface/web
run: |
npm ci
npm run lint
npm test
npm run build
- uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: pip
- name: Test Python runtime
run: |
python -m pip install -e ".[dev]"
python -m pytest -q tests management
for f in scripts/install-termux.sh bin/check.sh management/nexus-cli.sh; do bash -n "$f"; done
- name: Build wheel and sdist
run: |
python -m build
python -m twine check dist/*
- name: Verify clean wheel install
run: |
python -m venv "$RUNNER_TEMP/nexus-wheel"
"$RUNNER_TEMP/nexus-wheel/bin/python" -m pip install dist/*.whl
cd "$RUNNER_TEMP"
export NEXUS_HOME="$RUNNER_TEMP/nexus-home"
export NEXUS_CONFIG_DIR="$RUNNER_TEMP/nexus-config"
"$RUNNER_TEMP/nexus-wheel/bin/nexus" init --json
"$RUNNER_TEMP/nexus-wheel/bin/nexus" doctor --json
"$RUNNER_TEMP/nexus-wheel/bin/python" -c "from synapse.main import sio_app; assert sio_app"
# The wheel must carry the compiled UI, not just import cleanly.
"$RUNNER_TEMP/nexus-wheel/bin/python" - <<'PY'
from synapse.nexus_config import settings
index = settings.web_dist_dir / "index.html"
assert index.is_file(), f"wheel shipped no web UI at {index}"
PY
- uses: actions/upload-artifact@v4
with:
name: nexusos-python-dist
path: dist/*
- name: Publish tagged release to PyPI
if: startsWith(gitea.ref, 'refs/tags/v')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: python -m twine upload --non-interactive dist/*