Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.92 KiB
stages:
  - build
  - test
  - build_image
  - pages
  - staging

variables:
  IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME


# ========================== Build Testing section =========================== #
build_test_env:
  image: python:3.6
  stage: build
  script:
    - python -m venv .venv
    - source .venv/bin/activate
    - make install
  artifacts:
    paths:
      - .venv/
    expire_in: 20 minutes
  cache:
    key: "$CI_JOB_NAME"
    paths:
      - .venv

# ============================== Testing section ============================= #
# ----------------------------- Backend subsection --------------------------- #
.test_template_virtualenv: &test_definition_virtualenv
  image: python:3.6
  before_script:
    - source .venv/bin/activate
  dependencies:
    - build_test_env

test_pytest:
  <<: *test_definition_virtualenv
  stage: test
  services:
    - postgres:9.6
  script:
    - pytest --cov --ds=grady.settings.test core/tests
  artifacts:
    paths:
      - .coverage
  cache:
    key: "$CI_JOB_NAME"
    paths:
      - .coverage

test_flake8:
  <<: *test_definition_virtualenv
  stage: test
  script:
    - flake8 --exclude=migrations core util

# ----------------------------- Frontend subsection -------------------------- #
.test_template_frontend: &test_definition_frontend
  image: crbanman/nightwatch
  when: manual
  before_script:
    - cd frontend/

test_frontend:
  <<: *test_definition_frontend
#  when: manual
  stage: test
  script: