FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.48 KiB
Newer Older
# CI configuration which tests ucamlookup against supported Django and Python
# versions.
#
# GitLab CI does nto support Matrix builds in the traditional sense. Instead we
# build up a matrix of test jobs using inheritance via "extends".
#
# See also: https://gitlab.com/gitlab-org/gitlab-ce/issues/19199

include:
  # Bring in the AutoDevOps template from GitLab.
  # It can be viewed at:
  # https://gitlab.com/gitlab-org/gitlab-ee/blob/master/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
  - template: Auto-DevOps.gitlab-ci.yml

variables:
  # We use matrix testing (below) rather than the Auto-DevOps "test" job.
  TEST_DISABLED: "true"

# Test code coverage
coverage:
  extends: .test
  variables:
    TOX_ENVLIST: coverage
    PYTHON_VERSION: "3.9"

  # Look for the summary line output from coverage's text report. The
  # parentheses are used to indicate which portion of the report contains the
  # coverage percentage.
  coverage: '/^TOTAL\s+\d+\s+\d+\s+(\d+)%$/'

# Check for PEP8 violations
flake8:
  extends: .test
  variables:
    TOX_ENVLIST: flake8
    PYTHON_VERSION: "3.9"

# Run test suite against supported Python/Django combinations.
python36-django22:
  extends: .py36
  variables:
    TOX_DJANGO_FRAGMENT: "django22"
python37-django22:
  extends: .py37
  variables:
    TOX_DJANGO_FRAGMENT: "django22"
python38-django22:
  extends: .py38
    TOX_DJANGO_FRAGMENT: "django22"
python39-django22:
  extends: .py39
    TOX_DJANGO_FRAGMENT: "django22"
python37-django32:
  extends: .py37
  variables:
    TOX_DJANGO_FRAGMENT: "django32"
python38-django32:
  extends: .py38
    TOX_DJANGO_FRAGMENT: "django32"
python39-django32:
  extends: .py39
    TOX_DJANGO_FRAGMENT: "django32"

# Template jobs which run tests in various Python versions.
.py36:
  extends: .test
  variables:
    PYTHON_VERSION: "3.6"
    TOX_PY_FRAGMENT: "py36"

.py37:
  extends: .test
  variables:
    PYTHON_VERSION: "3.7"
    TOX_PY_FRAGMENT: "py37"

.py38:
  extends: .test
  variables:
    PYTHON_VERSION: "3.8"
    TOX_PY_FRAGMENT: "py38"

.py39:
  extends: .test
  variables:
    PYTHON_VERSION: "3.9"
    TOX_PY_FRAGMENT: "py39"

# Base test template job.
.test:
  image: python:${PYTHON_VERSION}

  script:
    - pip install tox
    - tox -e ${TOX_ENVLIST}

  variables:
    PYTHON_VERSION: replace-with-python-version
    TOX_PY_FRAGMENT: replace-with-pyXY
    TOX_DJANGO_FRAGMENT: replace-with-djangoXY
    TOX_ENVLIST: "$TOX_PY_FRAGMENT-$TOX_DJANGO_FRAGMENT"