67 lines
2.0 KiB
YAML
67 lines
2.0 KiB
YAML
variables:
|
|
DJANGO_CONFIG: "test"
|
|
MYSQL_DATABASE: $MYSQL_DB
|
|
MYSQL_ROOT_PASSWORD: $MYSQL_PASS
|
|
MYSQL_USER: $MYSQL_USER
|
|
MYSQL_PASSWORD: $MYSQL_PASS
|
|
|
|
default:
|
|
image: ubuntu:20.04
|
|
#
|
|
# Pick zero or more services to be used on all builds.
|
|
# Only needed when using a docker container to run your tests in.
|
|
# Check out: https://docs.gitlab.com/ee/ci/services/index.html
|
|
services:
|
|
- mysql:8.0
|
|
#
|
|
# This folder is cached between builds
|
|
# http://docs.gitlab.com/ee/ci/yaml/README.html#cache
|
|
cache:
|
|
paths:
|
|
- ~/.cache/pip/
|
|
before_script:
|
|
- apt -y update
|
|
- apt -y install apt-utils -yqq
|
|
- echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
|
- DEBIAN_FRONTEND=noninteractive apt-get update && apt-get -y --no-install-recommends install tzdata
|
|
- cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime
|
|
- apt -y install net-tools python3.8 python3-pip mysql-client libmysqlclient-dev pkg-config -yqq
|
|
- apt -y upgrade
|
|
- pip3 install -r requirements.txt
|
|
|
|
|
|
migrations:
|
|
stage: build
|
|
script:
|
|
- python3 manage.py makemigrations
|
|
- python3 manage.py migrate --database=test
|
|
- python3 manage.py check --database=test
|
|
|
|
|
|
django-tests:
|
|
stage: test
|
|
script:
|
|
# The MYSQL user only gets permissions for MYSQL_DB, so Django can't create a test database.
|
|
- echo "GRANT ALL on *.* to '${MYSQL_USER}';"| mysql -u root --password="${MYSQL_ROOT_PASSWORD}" -h mysql
|
|
# use python3 explicitly. see https://wiki.ubuntu.com/Python/3
|
|
- python3 manage.py test
|
|
|
|
qodana:
|
|
stage: test
|
|
inherit:
|
|
default: false
|
|
image:
|
|
name: jetbrains/qodana-python:2023.3-eap
|
|
entrypoint: [""]
|
|
variables:
|
|
QODANA_REMOTE_URL: git@$CI_SERVER_HOST:$CI_PROJECT_PATH.git
|
|
QODANA_BRANCH: $CI_COMMIT_BRANCH
|
|
QODANA_REPO_URL: $CI_PROJECT_URL
|
|
QODANA_JOB_URL: $CI_JOB_URL
|
|
script:
|
|
- qodana --save-report --results-dir=$CI_PROJECT_DIR/qodana --report-dir=$CI_PROJECT_DIR/qodana/report
|
|
artifacts:
|
|
paths:
|
|
- qodana/report/
|
|
expose_as: 'Qodana report'
|