Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
.gitlab-ci.yml 10.88 KiB
image: python:3.9

include:
  - template: Security/License-Scanning.gitlab-ci.yml

variables:
  POSTGRES_DB: smash
  POSTGRES_USER: runner
  POSTGRES_PASSWORD: password


.test_template: &test_definition
  stage: test
  before_script:
    - apt-get update && apt-get install -y --allow-unauthenticated libsasl2-dev libssl-dev locales locales-all libsasl2-dev libldap2-dev libssl-dev
    - python -V
    - pip install --upgrade pip --default-timeout=180 -i https://pypi.python.org/simple/
    - pip install -r requirements.txt --default-timeout=180 -i https://pypi.python.org/simple/
    - pip install -r requirements-dev.txt --default-timeout=180 -i https://pypi.python.org/simple/

test_migrations_created:
    <<: *test_definition
    services:
         - postgres:latest
    script:
         - cp "local_settings_ci.py" "smash/smash/local_settings.py"
         - cd smash
         - python manage.py makemigrations --check --dry-run
         - test 1 = $(python manage.py makemigrations --check --dry-run | grep 'No changes detected' |wc -l)

test_postgres:
    <<: *test_definition
    services:
         - postgres:latest
    script:
         - cp "local_settings_ci.py" "smash/smash/local_settings.py"
         - cd smash
         - coverage run --source web manage.py test -v3
         - coverage report -m --omit="*/test*,*/migrations*,*debug_utils*"

test_sqlite:
    <<: *test_definition
    script:
         - cp "local_settings_ci_sqlite.py" "smash/smash/local_settings.py"
         - cd smash
         - coverage run --source web manage.py test -v3
         - coverage report -m --omit="*/test*,*/migrations*,*debug_utils*"

test_python_3.9:
    <<: *test_definition
    image: python:3.9
    script:
         - cp "local_settings_ci_sqlite.py" "smash/smash/local_settings.py"
         - cd smash
         - coverage run --source web manage.py test -v3
         - coverage report -m --omit="*/test*,*/migrations*,*debug_utils*"

test_python_3.10:
    <<: *test_definition
    image: python:3.10
    script:
         - cp "local_settings_ci_sqlite.py" "smash/smash/local_settings.py"
         - cd smash
         - coverage run --source web manage.py test -v3
         - coverage report -m --omit="*/test*,*/migrations*,*debug_utils*"

test_python_3.11:
    <<: *test_definition
    image: python:3.11
    script: