From 4f1faea90ccaa7e5aa2dc48a7c3fa574261fbba7 Mon Sep 17 00:00:00 2001 From: Xubin Ren Date: Sat, 9 May 2026 08:27:46 +0000 Subject: [PATCH] ci: optimize Test Suite workflow (safe subset) Re-applies the safe portion of c01f8599 after the revert in 2e8e674e. Drops the uv cache which broke last time because uv.lock is gitignored in this repo, and keeps lint as a step inside the test job (matching the pre-c01f8599 layout). What's added (all metadata-only, no external dependencies): - concurrency: cancel superseded runs on the same ref - permissions: tighten GITHUB_TOKEN to contents: read - timeout-minutes: 20 to bound runaway jobs - fail-fast: false so all matrix combinations surface failures - matrix conditional: PRs run Linux x {3.11, 3.14} for fast feedback; push to main/nightly still runs the full 2-OS x 4-Python matrix What's intentionally NOT added (each removed for a reason): - uv cache: depends on uv.lock which is gitignored - separate lint job: kept inline as a step, matches original - workflow_dispatch / paths-ignore: scope creep, not needed now All jobs continue to run on standard GitHub-hosted runners (ubuntu-latest, windows-latest), keeping CI within the free tier. Co-authored-by: Cursor --- .github/workflows/ci.yml | 49 ++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 256328de7..b4b971d50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,38 +2,47 @@ name: Test Suite on: push: - branches: [ main, nightly ] + branches: [main, nightly] pull_request: - branches: [ main, nightly ] + branches: [main, nightly] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read jobs: test: runs-on: ${{ matrix.os }} + timeout-minutes: 20 strategy: + fail-fast: false matrix: - os: [ubuntu-latest, windows-latest] - python-version: ["3.11", "3.12", "3.13", "3.14"] + os: ${{ github.event_name == 'pull_request' && fromJSON('["ubuntu-latest"]') || fromJSON('["ubuntu-latest","windows-latest"]') }} + python-version: ${{ github.event_name == 'pull_request' && fromJSON('["3.11","3.14"]') || fromJSON('["3.11","3.12","3.13","3.14"]') }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} - - name: Install uv - uses: astral-sh/setup-uv@v4 + - name: Install uv + uses: astral-sh/setup-uv@v4 - - name: Install system dependencies (Linux) - if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y libolm-dev build-essential + - name: Install system dependencies (Linux) + if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install -y libolm-dev build-essential - - name: Install dependencies - run: uv sync --all-extras + - name: Install dependencies + run: uv sync --all-extras - - name: Lint with ruff - run: uv run ruff check nanobot --select F + - name: Lint with ruff + run: uv run ruff check nanobot --select F - - name: Run tests - run: uv run pytest tests/ + - name: Run tests + run: uv run pytest tests/