Commit a248b88d authored by Kostas Chartsias's avatar Kostas Chartsias
Browse files

ci pipeline enhancement, based on issue 8 refactoring, #7

parent fe83b4a3
Loading
Loading
Loading
Loading
Loading
+66 −2
Original line number Diff line number Diff line
default:
  image: python:3.12-slim
  cache:
    paths:
      - .cache/pip
  before_script:
    - pip install -r "$CI_PROJECT_DIR/mcp_module/requirements.txt"
    - pip install -r "$CI_PROJECT_DIR/ai_agent/requirements.txt"
    - pip install mypy pytest ruff import-linter
    - export PYTHONPATH="$CI_PROJECT_DIR:$PYTHONPATH"

stages:
  - type
  - architecture
  - lint
  - format
  - test
  - build

variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
  SOURCE_DIRS: "mcp_module/ ai_agent/"
  TEST_DIRS: "tests/"

type:
  stage: type
  tags:
    - docker
  script:
    - mypy $SOURCE_DIRS

architecture:
  stage: architecture
  tags:
    - docker
  script:
    - |
      if [ -f "$CI_PROJECT_DIR/.importlinter" ] || \
         [ -f "$CI_PROJECT_DIR/.importlinter.ini" ] || \
         [ -f "$CI_PROJECT_DIR/pyproject.toml" ] || \
         [ -f "$CI_PROJECT_DIR/setup.cfg" ]; then
        lint-imports
      else
        echo "No import-linter config found; skipping architecture check."
      fi

lint:
  stage: lint
  tags:
    - docker
  script:
    - ruff check $SOURCE_DIRS $TEST_DIRS

format:
  stage: format
  tags:
    - docker
  script:
    - ruff format --check $SOURCE_DIRS $TEST_DIRS

test:
  stage: test
  tags:
    - docker
  script:
    - pytest

.variables-template:
  tags:
    - "shell"
    - shell
  before_script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
    - |