Commit 47072bb7 authored by George Papathanail's avatar George Papathanail
Browse files

update gitlabci

parent 280b61cc
Loading
Loading
Loading
Loading
Loading
+32 −30
Original line number Diff line number Diff line
default:
  tags:
    - docker
  image: python:3.12-slim
  cache:
    paths:
      - .cache/uv
  before_script:
    - cd "$CI_PROJECT_DIR/${BACKEND_DIR:-.}"
    - pip install uv
    - export UV_SYSTEM_CERTS=1
    - uv sync --locked --extra dev
    - . .venv/bin/activate

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

variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
  UV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/uv"

cache:
  paths:
    - .cache/pip
type:
  stage: type
  script:
    - mypy open_exposure_gateway/app/ open_exposure_gateway/test/

.python_job:
  image: python:3.12-slim
  before_script:
    - python --version
    - python -m pip install --upgrade pip
    - python -m pip install -e ".[dev,postgres]"
architecture:
  stage: architecture
  script:
    - lint-imports

lint:
  stage: lint
  extends: .python_job
  script:
    - ruff check open_exposure_gateway/

format:
  stage: format
  extends: .python_job
  script:
    - ruff format --check open_exposure_gateway/

type:
  stage: type
  extends: .python_job
  script:
    - mypy open_exposure_gateway/app/ open_exposure_gateway/test/

architecture:
  stage: architecture
  extends: .python_job
test:
  stage: test
  # TODO: add integration tests when we move this to ETSI gitlab
  # Scoped to test/unit explicitly (not just -m deselection): pytest must still
  # import every collected module to read its markers, and test/conformance's
  # module-level schemathesis schema loading is expensive — collecting it here
  # would cost minutes on every pipeline even though none of its tests run.
  script:
    - lint-imports
    - pytest open_exposure_gateway/test/unit || [ $? -eq 5 ] #bypass no tests found error.

test:
conformance:
  stage: test
  extends: .python_job
  allow_failure: true
  script:
    - pytest || [ $? -eq 5 ]
    - pytest open_exposure_gateway/test/conformance

build_test_image:
  stage: build