Make backend an MCP client #960
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: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
description: "Run the build with tmate debugging enabled" | |
required: false | |
jobs: | |
linting: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: backend | |
steps: | |
- name: Cancel previous workflows that are still running | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout latest commit | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # fetch all history with version tags | |
- name: Set up python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.11" | |
- name: Set up pip cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} | |
- name: Set up environment | |
run: | | |
pip install --upgrade pip wheel setuptools | |
pip install bandit[toml]==1.7.4 ruff==0.6.7 | |
- name: Linting check | |
run: | | |
bandit -qr -c pyproject.toml src/ | |
ruff check src/ tests/ | |
ruff format --check src/ tests/ | |
unit-tests: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
working-directory: backend | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: test | |
POSTGRES_PASSWORD: password | |
options: >- | |
--health-cmd "pg_isready -d postgres://test:password@localhost:5432" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 10 | |
ports: | |
- 5432:5432 | |
env: | |
PIP_CACHE_DIR: .cache/pip | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.11"] | |
steps: | |
- name: Cancel previous workflows that are still running | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout latest commit | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # fetch all history with version tags | |
- name: Set up python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up pip cache | |
uses: actions/cache@v3 | |
with: | |
path: .cache/pip | |
key: ${{ matrix.tox-env }}-${{ matrix.os }} | |
- name: Set up environment | |
run: | | |
pip install --upgrade pip | |
pip install mypy==1.8.0 | |
pip install ".[dev]" | |
- name: Run alembic | |
run: | | |
export PYTHONPATH=$(pwd)/src:$PYTHONPATH | |
alembic -x url=postgresql://test:password@localhost:5432 upgrade head | |
- name: Running mypy and tests | |
run: | | |
mypy src/ | |
# Include src/ directory in Python path to prioritize local files in pytest | |
export PYTHONPATH=$(pwd)/src:$PYTHONPATH | |
pytest --color=yes tests/ |