added cicd pipeline
Signed-off-by: Jochen Mehlich <contact@jochenmehlich.de>
This commit is contained in:
parent
a9829259a6
commit
44a4222024
45
.gitlab-ci.yml
Normal file
45
.gitlab-ci.yml
Normal file
@ -0,0 +1,45 @@
|
||||
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
|
||||
- apt -y install net-tools python3.8 python3-pip mysql-client libmysqlclient-dev
|
||||
- apt -y upgrade
|
||||
- pip3 install -r requirements.txt
|
||||
|
||||
|
||||
migrations:
|
||||
stage: build
|
||||
script:
|
||||
- python3 manage.py makemigrations
|
||||
- python3 manage.py migrate
|
||||
- python3 manage.py check
|
||||
|
||||
|
||||
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
|
||||
|
||||
3
requirements.txt
Normal file
3
requirements.txt
Normal file
@ -0,0 +1,3 @@
|
||||
asgiref==3.7.2
|
||||
Django==4.2.7
|
||||
sqlparse==0.4.4
|
||||
Loading…
x
Reference in New Issue
Block a user