image: python:3.9 services: - mysql variables: MYSQL_DATABASE: "test" MYSQL_ROOT_PASSWORD: "mysql" MYSQL_USER: "django" MYSQL_PASSWORD: "mysql" MYSQL_HOST: "mysql" cache: paths: - ~/.cache/pip/ before_script: - python -V # Print out python version for debugging - apt-get -qq update - apt-get -qq install -y python3-virtualenv python3 python3-dev python3-pip gettext default-mysql-client default-libmysqlclient-dev - ./Utils/setup.sh --ci - mkdir -p public/badges public/lint - echo undefined > public/badges/$CI_JOB_NAME.score - source venv/bin/activate - pip install pylint-gitlab pylint-django - mysql --version check: script: - ./Utils/check.sh --all check-migrations: script: - source venv/bin/activate - ./manage.py makemigrations --dry-run --check test: script: - source venv/bin/activate - echo "GRANT ALL on *.* to '${MYSQL_USER}';"| mysql -u root --password="${MYSQL_ROOT_PASSWORD}" -h mysql - pip install pytest-cov unittest-xml-reporting - coverage run --source='.' manage.py test --settings AKPlanning.settings_ci after_script: - source venv/bin/activate - coverage report - coverage xml coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/' artifacts: reports: coverage_report: coverage_format: cobertura path: coverage.xml junit: unit.xml lint: stage: test script: - pylint --load-plugins pylint_django --exit-zero --output-format=text $(find -type f -name "*.py" ! -path "**/venv/**") | tee /tmp/pylint.txt - sed -n 's/^Your code has been rated at \([-0-9.]*\)\/.*/\1/p' /tmp/pylint.txt > public/badges/$CI_JOB_NAME.score - pylint --load-plugins pylint_django --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter $(find -type f -name "*.py" ! -path "**/venv/**") > codeclimate.json - pylint --load-plugins pylint_django --exit-zero --output-format=pylint_gitlab.GitlabPagesHtmlReporter $(find -type f -name "*.py" ! -path "**/venv/**") > public/lint/index.html after_script: - | echo "Linting score: $(cat public/badges/$CI_JOB_NAME.score)" artifacts: paths: - public reports: codequality: codeclimate.json when: always doc: stage: test script: - cd docs - make html - cd .. artifacts: paths: - docs/_build/html pages: stage: deploy image: alpine:latest script: - echo artifacts: paths: - public only: refs: - main