Skip to content
Snippets Groups Projects
.gitlab-ci.yml 4.35 KiB
stages:
  - test
  - build
  - release

variables:
  DEBIAN_FRONTEND: non-interactive

lint:
  image: python:3.12-slim

  cache:
    paths:
      - .cache/pip
      - .cache/pre-commit

  variables:
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
    PRE_COMMIT_HOME: "$CI_PROJECT_DIR/.cache/pre-commit"

  except:
    - schedules

  before_script:
    - pip install pre-commit
    # Install git
    - apt-get update -q -y && apt-get install -q -y --no-install-recommends git

  script:
    - pre-commit run -a

test:
  image: python:3.12-slim
  stage: test

  cache:
    paths:
      - .cache/pip

  artifacts:
    when: always
    reports:
      junit:
        - test-report.xml

  variables:
    PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
    ARKINDEX_API_SCHEMA_URL: schema.yml

  except:
    - schedules

  before_script:
    - pip install tox
    # Install curl and gpg
    - apt-get update -q -y && apt-get install -q -y --no-install-recommends curl gpg

    # Download OpenAPI schema from last backend build
    - curl https://assets.teklia.com/arkindex/openapi.yml > schema.yml
  script:
    - tox -e arkindex_worker -- --junitxml=test-report.xml --durations=50

test-cookiecutter:
  image: python:3.12-slim

  stage: test
  cache:
    paths:
      - .cache/pip
      - .cache/pre-commit