feat: Phase 5 — Storage Backend Abstraction Layer #118
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
| # PR Quality Assurance Gate | |
| # Runs on all pull requests to ensure code quality and test coverage | |
| # | |
| # Security: This workflow does not use any untrusted inputs in shell commands. | |
| # All dynamic values (runner.os, hashFiles) are safe GitHub context values. | |
| name: PR QA Gate | |
| on: | |
| pull_request: | |
| branches: [main, develop] | |
| push: | |
| branches: [main, develop] | |
| jobs: | |
| qa-gate: | |
| name: Quality Assurance Gate | |
| runs-on: ubuntu-latest | |
| environment: ci-testing | |
| steps: | |
| - name: Free up disk space | |
| run: | | |
| # Remove unnecessary tools to free up ~10GB | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| df -h | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Task | |
| uses: arduino/setup-task@v2 | |
| with: | |
| version: 3.43.3 | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: 1.7.1 | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Cache pip packages (PyTorch, CUDA, etc.) | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: pip-${{ runner.os }}-py3.11-${{ hashFiles('agent-brain-server/poetry.lock') }} | |
| restore-keys: | | |
| pip-${{ runner.os }}-py3.11- | |
| pip-${{ runner.os }}- | |
| - name: Cache HuggingFace models (sentence-transformers) | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/huggingface | |
| key: hf-${{ runner.os }}-sentence-transformers | |
| restore-keys: | | |
| hf-${{ runner.os }}- | |
| - name: Cache Poetry dependencies (server) | |
| uses: actions/cache@v4 | |
| with: | |
| path: agent-brain-server/.venv | |
| key: server-venv-${{ runner.os }}-${{ hashFiles('agent-brain-server/poetry.lock') }} | |
| restore-keys: | | |
| server-venv-${{ runner.os }}- | |
| - name: Cache Poetry dependencies (cli) | |
| uses: actions/cache@v4 | |
| with: | |
| path: agent-brain-cli/.venv | |
| key: cli-venv-${{ runner.os }}-${{ hashFiles('agent-brain-cli/poetry.lock') }} | |
| restore-keys: | | |
| cli-venv-${{ runner.os }}- | |
| - name: Build server package first (CLI depends on it) | |
| run: | | |
| cd agent-brain-server | |
| poetry build | |
| echo "Built server package:" | |
| ls -la dist/ | |
| - name: Install server from local build | |
| run: | | |
| cd agent-brain-server | |
| poetry install | |
| - name: Install CLI with local server dependency | |
| run: | | |
| cd agent-brain-cli | |
| # Install local server wheel so CLI can resolve dependency | |
| pip install ../agent-brain-server/dist/*.whl | |
| poetry install | |
| - name: Run linting | |
| run: task lint | |
| - name: Run type checking | |
| run: task typecheck | |
| - name: Check server/CLI version alignment | |
| run: | | |
| SERVER_VERSION=$(grep '^version = ' agent-brain-server/pyproject.toml | cut -d'"' -f2) | |
| CLI_VERSION=$(grep '^version = ' agent-brain-cli/pyproject.toml | cut -d'"' -f2) | |
| echo "Server version: $SERVER_VERSION" | |
| echo "CLI version: $CLI_VERSION" | |
| if [ "$SERVER_VERSION" != "$CLI_VERSION" ]; then | |
| echo "ERROR: Server and CLI versions must match" | |
| echo "Server: $SERVER_VERSION, CLI: $CLI_VERSION" | |
| exit 1 | |
| fi | |
| echo "✓ Versions aligned: $SERVER_VERSION" | |
| - name: Run tests with coverage (Server) | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} | |
| run: task server:pr-qa-gate | |
| - name: Run tests with coverage (CLI) | |
| run: task cli:pr-qa-gate | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v4 | |
| if: always() | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: agent-brain-server/coverage-server.xml,agent-brain-cli/coverage-cli.xml | |
| fail_ci_if_error: false | |
| verbose: true |