name: CI on: push: branches: [main] pull_request: branches: [main] env: PYTHON_VERSION: "3.12" jobs: lint: name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} - name: Install ruff run: pip install ruff - name: Ruff check run: ruff check src/ tests/ - name: Ruff format check run: ruff format --check src/ tests/ test: name: Test runs-on: ubuntu-latest needs: lint services: postgres: image: pgvector/pgvector:pg16 env: POSTGRES_USER: engram POSTGRES_PASSWORD: engram_test POSTGRES_DB: engram_test ports: - 5432:5432 options: >- --health-cmd "pg_isready -U engram" --health-interval 5s --health-timeout 5s --health-retries 10 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} - name: Install dependencies run: | pip install --upgrade pip pip install .[dev] - name: Run unit tests run: pytest tests/ -x -v --tb=short - name: Run unit tests with coverage run: | pip install pytest-cov pytest tests/ --cov=engram --cov-report=term-missing --cov-report=xml - name: Upload coverage if: always() uses: actions/upload-artifact@v4 with: name: coverage-report path: coverage.xml docker: name: Docker Build runs-on: ubuntu-latest needs: test if: github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v4 - name: Build Docker image run: docker build -t engram:ci . - name: Smoke test container run: | docker run -d --name engram-smoke \ -e ENGRAM_PG_HOST=host.docker.internal \ -e ENGRAM_EMBEDDINGS_ENABLED=0 \ engram:ci || true sleep 3 docker logs engram-smoke 2>&1 | head -20 docker rm -f engram-smoke || true