Commit 3f791929 authored by George Papathanail's avatar George Papathanail
Browse files

update: gitlab-ci.yml

parent 566fab3c
Loading
Loading
Loading
Loading
Loading
+12 −31
Original line number Diff line number Diff line
default:
  tags:
    - docker
  image: python:3.12-slim
  cache:
    paths:
@@ -23,7 +21,6 @@ stages:

variables:
  UV_CACHE_DIR: "$CI_PROJECT_DIR/.cache/uv"
  GIT_STRATEGY: clone

type:
  stage: type
@@ -47,52 +44,36 @@ format:

test:
  stage: test
  # Integration tests (tests/integration) need a Docker daemon for testcontainers.
  # A docker:dind service provides it; DOCKER_HOST/DOCKER_TLS_CERTDIR point the
  # docker-py client (used by testcontainers) at it without requiring TLS certs
  # to be shared into this job's (non-docker) image.
  # test/conformance stays out of this job's scope: it's collected/run separately
  # (see the `conformance` job) since its module-level schemathesis schema
  # loading is expensive and would cost minutes on every pipeline otherwise.
  variables:
    DOCKER_HOST: tcp://docker:2375
    DOCKER_TLS_CERTDIR: ""
  services:
    - docker:dind
  script:
    - pytest tests/unit tests/integration --cov=src/open_exposure_gateway --cov-branch --cov-report=term-missing || [ $? -eq 5 ] #bypass no tests found error.
    - pytest tests/unit tests/integration tests/api --cov=src/srm --cov-branch --cov-report=term-missing || [ $? -eq 5 ] #bypass no tests found error.
  coverage: '/TOTAL.+ ([0-9]{1,3}(?:\.[0-9]+)?%)/'


conformance:
  stage: test
  allow_failure: true
  script:
    - pytest tests/conformance

build:
  stage: build
  tags:
    - shell
  before_script:
    - docker info
  script:
    - export TEST_IMAGE_TAG="ci-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}"
    - docker build --network=host -t "$CI_REGISTRY_IMAGE:$TEST_IMAGE_TAG" .
  rules:
    - if: '$CI_COMMIT_BRANCH'

push:
  stage: push
  tags:
    - shell
  needs:
    - build
build-and-push:
  stage: build-and-push
  image: docker:cli
  variables:
    DOCKER_HOST: tcp://docker:2375
    DOCKER_TLS_CERTDIR: ""
  services:
    - docker:dind
  before_script:
    - docker info
  script:
    - export TEST_IMAGE_TAG="ci-${CI_COMMIT_REF_SLUG}-${CI_COMMIT_SHORT_SHA}"
    - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" "$CI_REGISTRY" --password-stdin
    - docker push "$CI_REGISTRY_IMAGE:$TEST_IMAGE_TAG"
    - docker buildx build --provenance=false --network=host -t "$CI_REGISTRY_IMAGE:$TEST_IMAGE_TAG" --push .
    - docker logout "$CI_REGISTRY"
  rules:
    - if: '$CI_COMMIT_BRANCH'
    - if: '$CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "develop"'