2021-09-30 23:02:18 +05:30
|
|
|
# To contribute improvements to CI/CD templates, please follow the Development guide at:
|
|
|
|
# https://docs.gitlab.com/ee/development/cicd/templates.html
|
|
|
|
# This specific template is located at:
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Django.gitlab-ci.yml
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
# Official framework image. Look for the different tagged releases at:
|
|
|
|
# https://hub.docker.com/r/library/python
|
|
|
|
image: python:latest
|
|
|
|
|
|
|
|
# Pick zero or more services to be used on all builds.
|
|
|
|
# Only needed when using a docker container to run your tests in.
|
2021-01-03 14:25:43 +05:30
|
|
|
# Check out: http://docs.gitlab.com/ee/ci/docker/using_docker_images.html#what-is-a-service
|
2017-08-17 22:00:37 +05:30
|
|
|
services:
|
|
|
|
- mysql:latest
|
|
|
|
- postgres:latest
|
|
|
|
|
|
|
|
variables:
|
|
|
|
POSTGRES_DB: database_name
|
|
|
|
|
|
|
|
# This folder is cached between builds
|
2021-10-27 15:23:28 +05:30
|
|
|
# https://docs.gitlab.com/ee/ci/yaml/index.html#cache
|
2017-08-17 22:00:37 +05:30
|
|
|
cache:
|
|
|
|
paths:
|
2019-09-04 21:01:54 +05:30
|
|
|
- ~/.cache/pip/
|
2017-08-17 22:00:37 +05:30
|
|
|
|
|
|
|
# This is a basic example for a gem or script which doesn't use
|
|
|
|
# services such as redis or postgres
|
|
|
|
before_script:
|
2019-09-04 21:01:54 +05:30
|
|
|
- python -V # Print out python version for debugging
|
2017-08-17 22:00:37 +05:30
|
|
|
# Uncomment next line if your Django app needs a JS runtime:
|
|
|
|
# - apt-get update -q && apt-get install nodejs -yqq
|
|
|
|
- pip install -r requirements.txt
|
|
|
|
|
|
|
|
# To get Django tests to work you may need to create a settings file using
|
|
|
|
# the following DATABASES:
|
2019-09-04 21:01:54 +05:30
|
|
|
#
|
2017-08-17 22:00:37 +05:30
|
|
|
# DATABASES = {
|
|
|
|
# 'default': {
|
|
|
|
# 'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
|
|
|
# 'NAME': 'ci',
|
|
|
|
# 'USER': 'postgres',
|
|
|
|
# 'PASSWORD': 'postgres',
|
|
|
|
# 'HOST': 'postgres',
|
|
|
|
# 'PORT': '5432',
|
|
|
|
# },
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
# and then adding `--settings app.settings.ci` (or similar) to the test command
|
|
|
|
|
|
|
|
test:
|
|
|
|
variables:
|
|
|
|
DATABASE_URL: "postgresql://postgres:postgres@postgres:5432/$POSTGRES_DB"
|
|
|
|
script:
|
2019-09-04 21:01:54 +05:30
|
|
|
- python manage.py test
|