diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 0000000000..26402d8347 --- /dev/null +++ b/.github/workflows/macos.yml @@ -0,0 +1,119 @@ +name: macos + +on: + push: + branches: + - main + - dev + paths-ignore: + - '**.md' + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths-ignore: + - '**.md' + - 'docker/**' + - '.github/workflows/docker.yml' + - '.github/workflows/_docker-build-template.yml' + +permissions: + contents: read + +jobs: + check-changes: + if: github.event_name != 'pull_request' || github.event.pull_request.draft == false + runs-on: ubuntu-latest + outputs: + should-run: ${{ steps.filter.outputs.python }} + steps: + - uses: actions/checkout@v4 + - id: filter + uses: dorny/paths-filter@v3 + with: + filters: | + python: + - 'dimos/**' + - 'pyproject.toml' + - 'uv.lock' + - '.github/workflows/macos.yml' + + macos-tests: + needs: [check-changes] + if: needs.check-changes.outputs.should-run == 'true' + runs-on: macos-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + with: + lfs: false + + - name: Install uv + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + + - name: Set up Python + run: uv python install 3.12 + + - name: Install system dependencies + run: brew install gnu-sed gcc portaudio git-lfs libjpeg-turbo + + - name: Install dependencies + run: | + uv sync --all-extras --no-extra dds --no-extra cuda --frozen + + - name: Check disk usage + run: | + df -h . + du -sh .venv/ || true + + - name: Configure LCM networking + run: | + # Same as dimos autoconf for macOS (skipped when CI=1) + sudo route add -net 224.0.0.0/4 -interface lo0 || true + sudo sysctl -w kern.ipc.maxsockbuf=6291456 + sudo sysctl -w net.inet.udp.recvspace=2097152 + sudo sysctl -w net.inet.udp.maxdgram=65535 + + - name: Run tests + env: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} + ALIBABA_API_KEY: ${{ secrets.ALIBABA_API_KEY }} + LCM_DEFAULT_URL: "udpm://127.0.0.1:7667?ttl=0" + CI: "1" + run: | + source .venv/bin/activate + python -m pytest --durations=10 -m 'not (tool or slow or mujoco)' --timeout=120 -k 'not (test_transports or test_classmethods or test_process_crash or test_foxglove_bridge or test_moment_seek or test_lcmspy or test_graph_lcmspy)' dimos/core/ dimos/utils/ + + - name: Check disk usage (post-test) + if: always() + run: df -h . + + macos-mypy: + needs: [check-changes] + if: needs.check-changes.outputs.should-run == 'true' + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + with: + lfs: false + + - name: Install uv + uses: astral-sh/setup-uv@v6 + with: + enable-cache: true + + - name: Set up Python + run: uv python install 3.12 + + - name: Install system dependencies + run: brew install gnu-sed gcc portaudio git-lfs libjpeg-turbo + + - name: Install dependencies + run: | + uv sync --all-extras --no-extra dds --no-extra cuda --frozen + + - name: Run mypy + run: | + source .venv/bin/activate + mypy dimos diff --git a/dimos/core/resource_monitor/stats.py b/dimos/core/resource_monitor/stats.py index c020c853e0..485132db46 100644 --- a/dimos/core/resource_monitor/stats.py +++ b/dimos/core/resource_monitor/stats.py @@ -90,7 +90,7 @@ class IoStats(TypedDict): def _collect_io(proc: psutil.Process) -> IoStats: """Collect IO counters in bytes. Call inside oneshot().""" try: - io = proc.io_counters() + io = proc.io_counters() # type: ignore[attr-defined] # not available on macOS return IoStats(io_read_bytes=io.read_bytes, io_write_bytes=io.write_bytes) except (psutil.AccessDenied, AttributeError): return IoStats(io_read_bytes=0, io_write_bytes=0)