Skip to content
Snippets Groups Projects
Commit cc4ffc02 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[gitlabci] Moved test prefix creation to before_script and deletion to after_script

This ensure that whatever the outcome of the tests, the prefix is
cleaned up. Currently these are piling up in the /var/tmp folder.
parent db2a5ff6
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -3,6 +3,7 @@ stages:
variables:
PREFIX: /opt/beat.env.web/usr
TEST_PREFIX_PATH_FILE: '/tmp/test_prefix_$CI_JOB_ID.txt'
build:
stage: build
......@@ -11,12 +12,13 @@ build:
before_script:
- ${PREFIX}/bin/python --version
- docker info
- export BEAT_TEST_PREFIX=`mktemp -d --tmpdir=/var/tmp beat_test_prefix.XXXXXXXXX`
- echo $BEAT_TEST_PREFIX > $TEST_PREFIX_PATH_FILE
script:
- git clean -ffdx
- ${PREFIX}/bin/python bootstrap-buildout.py
- ./bin/buildout
- export COVERAGE_FILE=.coverage.django
- export BEAT_TEST_PREFIX=`mktemp -d --tmpdir=/var/tmp beat_test_prefix.XXXXXXXXX`
- ./bin/python ${PREFIX}/bin/coverage run --source=${CI_PROJECT_NAME} ./bin/django test --settings=beat.web.settings.ci -v 2
- export BEAT_CMDLINE_TEST_PLATFORM=django://beat.web.settings.ci
- export COVERAGE_FILE=.coverage.cmdline
......@@ -24,13 +26,16 @@ build:
- export NOSE_COVER_PACKAGE=beat.web
- ./bin/python ${PREFIX}/bin/coverage run --source=./src/beat.cmdline ./bin/nosetests -sv beat.cmdline
- unset COVERAGE_FILE
- rm -rf $BEAT_TEST_PREFIX
- unset BEAT_TEST_PREFIX
- ./bin/python ${PREFIX}/bin/coverage combine .coverage.django .coverage.cmdline
- ./bin/python ${PREFIX}/bin/coverage report
- ./bin/python ${PREFIX}/bin/sphinx-apidoc --separate -d 2 --output=doc/api ${CI_PROJECT_NAMESPACE} beat/web/*/migrations beat/web/*/tests
- ./bin/python ${PREFIX}/bin/sphinx-build doc/api html/api
- ./bin/python ${PREFIX}/bin/sphinx-build doc/admin html/admin
- ./bin/python ${PREFIX}/bin/sphinx-build doc/user html/user
after_script:
- export BEAT_TEST_PREFIX=`cat $TEST_PREFIX_PATH_FILE`
- echo "Deleting BEAT test prefix $BEAT_TEST_PREFIX"
- rm -rf $BEAT_TEST_PREFIX $TEST_PREFIX_PATH_FILE
- unset BEAT_TEST_PREFIX
tags:
- docker-build
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment