feat: migrate cocoindex from v0.3.x to v1.0 #139
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| PYTHON_VERSION: "3.13" | |
| jobs: | |
| changes: | |
| name: Detect Changes | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: read | |
| outputs: | |
| python: ${{ steps.filter.outputs.python }} | |
| versions: ${{ steps.filter.outputs.versions }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: dorny/paths-filter@v4 | |
| id: filter | |
| with: | |
| filters: | | |
| python: | |
| - 'src/**' | |
| - 'tests/**' | |
| - 'pyproject.toml' | |
| - 'uv.lock' | |
| versions: | |
| - 'pyproject.toml' | |
| - 'src/cocosearch/__init__.py' | |
| - '.claude-plugin/**' | |
| skills-sync: | |
| name: Skills Sync Check | |
| needs: changes | |
| if: needs.changes.outputs.python == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Check skills are in sync | |
| run: | | |
| diff -r skills/ src/cocosearch/skills/ \ | |
| --exclude=README.md --exclude=__init__.py --exclude=__pycache__ \ | |
| && echo "Skills are in sync" \ | |
| || { echo "::error::Skills out of sync. Run ./scripts/sync_skills.sh"; exit 1; } | |
| lint: | |
| name: Lint | |
| needs: changes | |
| if: needs.changes.outputs.python == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Ruff check | |
| run: uvx ruff check src/ tests/ | |
| - name: Ruff format check | |
| run: uvx ruff format --check src/ tests/ | |
| validate-versions: | |
| name: Validate Versions | |
| needs: changes | |
| if: needs.changes.outputs.versions == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Validate JSON files | |
| run: | | |
| jq empty .claude-plugin/plugin.json | |
| jq empty .claude-plugin/marketplace.json | |
| - name: Check version consistency | |
| run: | | |
| PYPROJECT_VERSION=$(grep -m1 '^version' pyproject.toml | sed 's/version = "\(.*\)"/\1/') | |
| INIT_VERSION=$(grep '__version__' src/cocosearch/__init__.py | sed 's/__version__ = "\(.*\)"/\1/') | |
| PLUGIN_VERSION=$(jq -r '.version' .claude-plugin/plugin.json) | |
| MARKETPLACE_META=$(jq -r '.metadata.version' .claude-plugin/marketplace.json) | |
| MARKETPLACE_PLUGIN=$(jq -r '.plugins[0].version' .claude-plugin/marketplace.json) | |
| ERRORS=0 | |
| for pair in "INIT_VERSION:__init__.py" "PLUGIN_VERSION:plugin.json" "MARKETPLACE_META:marketplace.json metadata" "MARKETPLACE_PLUGIN:marketplace.json plugins[0]"; do | |
| VAR="${pair%%:*}"; LABEL="${pair#*:}" | |
| if [ "${!VAR}" != "$PYPROJECT_VERSION" ]; then | |
| echo "::error::${LABEL} version (${!VAR}) != pyproject.toml (${PYPROJECT_VERSION})" | |
| ERRORS=$((ERRORS + 1)) | |
| fi | |
| done | |
| [ $ERRORS -eq 0 ] && echo "All versions consistent: ${PYPROJECT_VERSION}" || exit 1 | |
| unit-tests: | |
| name: Unit Tests | |
| needs: changes | |
| if: needs.changes.outputs.python == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Restore cached virtual environment | |
| uses: actions/cache@v5 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-python-${{ env.PYTHON_VERSION }}-${{ hashFiles('uv.lock') }} | |
| - name: Install dependencies | |
| run: uv sync --frozen | |
| - name: Run unit tests | |
| run: uv run pytest |