Add support for running tests from a Docker container.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
stages:
|
||||
- test
|
||||
- build
|
||||
|
||||
|
||||
job_docker_master:
|
||||
stage: build
|
||||
stage: build
|
||||
image: docker:latest
|
||||
services:
|
||||
- docker:dind
|
||||
@@ -11,10 +11,11 @@ job_docker_master:
|
||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||
script:
|
||||
- docker build --pull -t "$CI_REGISTRY_IMAGE" -f docker/Dockerfile .
|
||||
- docker run --rm "$CI_REGISTRY_IMAGE" run-tests
|
||||
- docker push "$CI_REGISTRY_IMAGE"
|
||||
only:
|
||||
- master
|
||||
|
||||
|
||||
job_docker_other:
|
||||
stage: build
|
||||
image: docker:latest
|
||||
@@ -24,6 +25,7 @@ job_docker_other:
|
||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||
script:
|
||||
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" -f docker/Dockerfile .
|
||||
- docker run --rm "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" run-tests
|
||||
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
|
||||
except:
|
||||
- master
|
||||
@@ -44,7 +46,7 @@ job_docker_other:
|
||||
- export LC_ALL=en_US.UTF-8
|
||||
- apt-get install -qq curl gcc ghostscript gpgv gnupg graphviz libjpeg-dev libmagic1 libpng-dev libtiff-dev poppler-utils libreoffice poppler-utils python-dev python-pip tesseract-ocr tesseract-ocr-deu
|
||||
- pip install -r requirements/testing.txt
|
||||
|
||||
|
||||
test-mysql:
|
||||
<<: *test_base
|
||||
variables:
|
||||
@@ -59,7 +61,7 @@ test-mysql:
|
||||
- python manage.py test --mayan-apps --settings=mayan.settings.testing.gitlab-ci.db_mysql --nomigrations
|
||||
tags:
|
||||
- mysql
|
||||
|
||||
|
||||
test-postgres:
|
||||
<<: *test_base
|
||||
variables:
|
||||
@@ -73,7 +75,7 @@ test-postgres:
|
||||
- python manage.py test --mayan-apps --settings=mayan.settings.testing.gitlab-ci.db_postgres --nomigrations
|
||||
tags:
|
||||
- postgres
|
||||
|
||||
|
||||
test-sqlite:
|
||||
<<: *test_base
|
||||
script:
|
||||
|
||||
8
contrib/scripts/docker/run-tests.sh
Executable file
8
contrib/scripts/docker/run-tests.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends tesseract-ocr-deu
|
||||
|
||||
pip install -r $DOCKER_ROOT/requirements-testing.txt
|
||||
|
||||
mayan-edms.py test --mayan-apps
|
||||
@@ -3,6 +3,7 @@
|
||||
set -e
|
||||
echo "mayan: starting entrypoint.sh"
|
||||
INSTALL_FLAG=/var/lib/mayan/media/system/SECRET_KEY
|
||||
export DOCKER_ROOT=/root
|
||||
|
||||
export MAYAN_DEFAULT_BROKER_URL=redis://127.0.0.1:6379/0
|
||||
export MAYAN_DEFAULT_CELERY_RESULT_BACKEND=redis://127.0.0.1:6379/0
|
||||
@@ -57,15 +58,29 @@ pip_installs() {
|
||||
os_package_installs || true
|
||||
pip_installs || true
|
||||
|
||||
if [ "$1" = 'mayan' ]; then
|
||||
# Check if this is a new install, otherwise try to upgrade the existing
|
||||
# installation on subsequent starts
|
||||
if [ ! -f $INSTALL_FLAG ]; then
|
||||
initialize
|
||||
else
|
||||
upgrade
|
||||
fi
|
||||
start
|
||||
else
|
||||
su mayan -c "mayan-edms.py $@";
|
||||
fi
|
||||
case "$1" in
|
||||
|
||||
mayan) # Check if this is a new install, otherwise try to upgrade the existing
|
||||
# installation on subsequent starts
|
||||
if [ ! -f $INSTALL_FLAG ]; then
|
||||
initialize
|
||||
else
|
||||
upgrade
|
||||
fi
|
||||
start
|
||||
;;
|
||||
|
||||
run-tests) # Check if this is a new install, otherwise try to upgrade the existing
|
||||
# installation on subsequent starts
|
||||
if [ ! -f $INSTALL_FLAG ]; then
|
||||
initialize
|
||||
else
|
||||
upgrade
|
||||
fi
|
||||
$DOCKER_ROOT/run-tests.sh
|
||||
;;
|
||||
|
||||
*) su mayan -c "$@";
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user