Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.42 KiB
image: registry.gitlab.com/arkindex/backend:base-0.10.3
stages:
  - test
  - build

cache:
  paths:
    - .cache/pip

before_script:
  - apk --update add build-base
  # Custom line to install our own deps from Git using GitLab CI credentials
  - "pip install -e git+https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/arkindex/common#egg=arkindex-common"
  - "pip install -e git+https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/arkindex/ponos#egg=ponos-server"
  - pip install -r tests-requirements.txt codecov

variables:
  # For the postgres image
  POSTGRES_DB: arkindex_dev
  POSTGRES_USER: devuser
  POSTGRES_PASSWORD: devdata

  # For the backend
  DB_HOST: postgres
  DB_PORT: 5432

  # Pip cache
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

backend-tests:
  stage: test

  services:
    - postgres:12.0

  script:
    - python setup.py test
    - codecov

backend-lint:
  stage: test

  script:
    - flake8

backend-migrations:
  stage: test

  services:
    - postgres:12.0

  script:
    - pip install -e .
    - arkindex/manage.py makemigrations --check --noinput --dry-run -v 3

backend-openapi:
  stage: build

  script:
    - mkdir -p output
    - pip install -e .
    - pip install uritemplate==3 apistar>=0.7.2
    - arkindex/manage.py generateschema > output/original.yml
    - openapi/patch.py openapi/patch.yml output/original.yml > output/schema.yml

  variables:
    PONOS_DATA_DIR: /tmp

  artifacts:
    paths: