Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
ci(tests): shard unit test gate (#466)
Call Whitec14691d6b429
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.ymlindex 5e55e8c68..d2f419635 100644--- a/.github/workflows/lint.yml+++ b/.github/workflows/lint.yml@@ -6,6 +6,10 @@ on:branches:- master+concurrency:+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}+jobs:ruff:runs-on: ubuntu-latest@@ -19,8 +23,14 @@ jobs:pip install pre-commitpre-commit run --all-files- unit-tests:+ unit-test-shards:+ name: unit-tests (${{ matrix.shard }}/${{ matrix.shard-total }})runs-on: ubuntu-latest+ strategy:+ fail-fast: false+ matrix:+ shard: [0, 1, 2, 3]+ shard-total: [4]steps:- uses: actions/checkout@v5@@ -45,8 +55,21 @@ jobs:- name: Install package and test depsrun: pip install -e . pytest- - name: Run unit tests (one file per process)- run: bash scripts/ci_unit_tests.sh+ - name: Run unit tests shard ${{ matrix.shard }}/${{ matrix.shard-total }}+ run: bash scripts/ci_unit_tests.sh "${{ matrix.shard }}" "${{ matrix.shard-total }}"++ unit-tests:+ runs-on: ubuntu-latest+ needs: unit-test-shards+ if: always()+ steps:+ - name: Verify unit test shards+ run: |+ if [ "${{ needs['unit-test-shards'].result }}" != "success" ]; then+ echo "Unit test shards finished with result: ${{ needs['unit-test-shards'].result }}"+ exit 1+ fi+ echo "All unit test shards passed."npm-wrapper:runs-on: ubuntu-latestdiff --git a/scripts/ci_unit_tests.sh b/scripts/ci_unit_tests.shindex 80207e6bc..91b7f859d 100755--- a/scripts/ci_unit_tests.sh+++ b/scripts/ci_unit_tests.sh@@ -10,19 +10,67 @@# pollution. Making the stubs fixture-scoped so a single ``pytest tests/`` works# is tracked separately; until then this is how the unit suite is CI-gated.#+# CI may pass a shard index and total shard count to split the file list across+# multiple runners while preserving the one-process-per-file isolation.+## Excludes ``tests/e2e`` (Docker) and the ``integration`` marker (Docker +# platform tokens) — those run in dedicated jobs. ``-p no:randomly`` keeps a# deterministic order if pytest-randomly happens to be installed (no-op when it# is not), and ``-o addopts=""`` ignores any ambient addopts.set -uo pipefail-PYTEST=(python -m pytest)+SHARD_INDEX="${1:-0}"+SHARD_TOTAL="${2:-1}"++case "$SHARD_INDEX" in+ ''|*[!0-9]*)+ echo "Shard index must be a non-negative integer, got: $SHARD_INDEX" >&2+ exit 2+ ;;+esac++case "$SHARD_TOTAL" in+ ''|*[!0-9]*)+ echo "Shard total must be a positive integer, got: $SHARD_TOTAL" >&2+ exit 2+ ;;+esac++if [ "$SHARD_TOTAL" -lt 1 ]; then+ echo "Shard total must be at least 1, got: $SHARD_TOTAL" >&2+ exit 2+fi++if [ "$SHARD_INDEX" -ge "$SHARD_TOTAL" ]; then+ echo "Shard index must be less than shard total, got: $SHARD_INDEX >= $SHARD_TOTAL" >&2+ exit 2+fi++PYTHON_BIN="${PYTHON:-}"+if [ -z "$PYTHON_BIN" ]; then+ if command -v python3 >/dev/null 2>&1; then+ PYTHON_BIN="python3"+ elif command -v python >/dev/null 2>&1; then+ PYTHON_BIN="python"+ else+ echo "Unable to find python3 or python on PATH." >&2+ exit 127+ fi+fi++PYTEST=("$PYTHON_BIN" -m pytest)failed=""empty=""-total=0+selected=0+ordinal=0while IFS= read -r f; do- total=$((total + 1))+ if [ $((ordinal % SHARD_TOTAL)) -ne "$SHARD_INDEX" ]; then+ ordinal=$((ordinal + 1))+ continue+ fi+ ordinal=$((ordinal + 1))+ selected=$((selected + 1))"${PYTEST[@]}" "$f" -m "not integration" -p no:randomly -o addopts="" -qrc=$?if [ "$rc" -eq 0 ]; then@@ -36,7 +84,8 @@ while IFS= read -r f; dodone < <(find tests -name 'test_*.py' -not -path 'tests/e2e/*' | sort)echo "========================================"-echo "Ran ${total} unit test file(s), one process each."+echo "Discovered ${ordinal} unit test file(s)."+echo "Ran ${selected} unit test file(s), one process each, for shard ${SHARD_INDEX}/${SHARD_TOTAL}."if [ -n "$empty" ]; thenecho "No unit tests collected (skipped):"for f in $empty; do echo " $f"; done