Skip to content

fix(tests): close four suite-hygiene loose ends, and say why CI was green on the failing one #2482

fix(tests): close four suite-hygiene loose ends, and say why CI was green on the failing one

fix(tests): close four suite-hygiene loose ends, and say why CI was green on the failing one #2482

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
changes:
runs-on: ubuntu-latest
outputs:
brain_bar: ${{ steps.filter.outputs.brain_bar }}
launchd: ${{ steps.filter.outputs.launchd }}
steps:
- uses: actions/checkout@v4
- id: filter
uses: dorny/paths-filter@v3
with:
filters: |
brain_bar:
- 'brain-bar/**'
launchd:
- 'scripts/launchd/**'
- 'src/brainlayer/pause.py'
- 'tests/test_fleet_watchdog.py'
- '.github/workflows/ci.yml'
swift:
name: swift (macos-15)
needs: changes
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- name: Select Xcode (Swift 6)
if: needs.changes.outputs.brain_bar == 'true'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Swift version
run: swift --version
- name: Cache SwiftPM
if: needs.changes.outputs.brain_bar == 'true'
uses: actions/cache@v4
with:
path: |
~/.swiftpm
brain-bar/.build
key: ${{ runner.os }}-swiftpm-${{ hashFiles('brain-bar/Package.resolved') }}
restore-keys: ${{ runner.os }}-swiftpm-
- name: Build BrainBar
if: needs.changes.outputs.brain_bar == 'true'
run: cd brain-bar && swift build -c release
- name: Test BrainBar
if: needs.changes.outputs.brain_bar == 'true'
run: cd brain-bar && swift test
- name: Skip BrainBar Swift build
if: needs.changes.outputs.brain_bar != 'true'
run: echo "no brain-bar changes — swift build/test skipped"
launchd:
# fleet-watchdog.sh reads the pause sentinel with plutil and BSD `date -j`, so those drills
# skip themselves on the ubuntu matrix. This is the runner that actually executes them;
# tests/test_fleet_watchdog.py asserts this job exists and runs that file.
name: launchd (macos-15)
needs: changes
if: needs.changes.outputs.launchd == 'true'
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
# The drills need pytest, pyyaml and stdlib-only brainlayer.pause off PYTHONPATH -- not
# the full dev extra, which would pull torch onto a macOS runner for no benefit.
- name: Install test deps
run: pip install pytest pyyaml
- name: Fleet-watchdog and pause-sentinel drills
env:
PYTHONPATH: src
run: pytest tests/test_fleet_watchdog.py -v --tb=short
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Free runner disk
run: |
df -h
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /opt/hostedtoolcache/CodeQL || true
df -h
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: ${{ runner.os }}-pip-${{ matrix.python-version }}-
- name: Cache Hugging Face models
uses: actions/cache@v4
with:
path: ~/.cache/huggingface
key: ${{ runner.os }}-hf-bge-large-en-v1.5-bge-m3
- name: Install
run: pip install -e ".[dev]"
- name: Warm Hugging Face model cache
run: |
python - <<'PY'
import time
from huggingface_hub import snapshot_download
model_ids = ["BAAI/bge-large-en-v1.5", "BAAI/bge-m3"]
delays = [5, 15, 30]
for model_id in model_ids:
for attempt in range(1, len(delays) + 2):
try:
snapshot_download(repo_id=model_id)
print(f"Warmed Hugging Face cache for {model_id}")
break
except Exception as exc:
if attempt == len(delays) + 1:
print(f"::warning::Unable to warm Hugging Face cache for {model_id}: {exc!r}")
break
delay = delays[attempt - 1]
print(f"Unable to warm Hugging Face cache for {model_id} on attempt {attempt}; retrying in {delay}s: {exc!r}")
time.sleep(delay)
PY
- name: Unit tests
env:
HF_HUB_OFFLINE: "1"
TRANSFORMERS_OFFLINE: "1"
run: >
pytest tests/ -v --tb=short -m "not integration and not live" -x
--ignore=tests/test_eval_framework.py
--ignore=tests/test_follow_up_rewrite.py
--ignore=tests/test_prompt_classification.py
- name: Doctor fixture gate
env:
HF_HUB_OFFLINE: "1"
TRANSFORMERS_OFFLINE: "1"
run: pytest tests/test_doctor.py -v --tb=short
- name: Isolated eval and hook routing tests
env:
HF_HUB_OFFLINE: "1"
TRANSFORMERS_OFFLINE: "1"
run: >
pytest
tests/test_eval_framework.py
tests/test_follow_up_rewrite.py
tests/test_prompt_classification.py
-v --tb=short -x
- name: MCP tool registration
env:
HF_HUB_OFFLINE: "1"
TRANSFORMERS_OFFLINE: "1"
run: pytest tests/test_think_recall_integration.py::TestMCPToolCount -v --tb=short
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Reject tracked docs.local files
shell: bash
run: |
tracked_docs_local="$(git ls-files docs.local)"
if [[ -n "$tracked_docs_local" ]]; then
echo "::error::docs.local is ignored but contains tracked files:"
printf '%s\n' "$tracked_docs_local"
exit 1
fi
echo "No tracked files under docs.local/."
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-lint-${{ hashFiles('pyproject.toml') }}
- run: pip install ruff
- run: ruff check src/ tests/
- run: ruff format --check src/ tests/