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

# For jobs that run backend scripts directly
.backend-setup:
  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
    - "echo 'database: {host: postgres, port: 5432}' > $CONFIG_PATH"

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

    # For the backend
    CONFIG_PATH: "$CI_PROJECT_DIR/config.yml"

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

backend-tests:
  extends: .backend-setup
  stage: test

  services:
    - postgres:12.0

  script:
    - python setup.py test
    - codecov

backend-lint:
  extends: .backend-setup
  stage: test

  script:
    - flake8

backend-migrations:
  extends: .backend-setup
  stage: test

  services:
    - postgres:12.0

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

backend-openapi:
  extends: .backend-setup
  stage: build

  script:
    - ci/openapi.sh

  artifacts:
    paths: