Merge "Clean-up tox"

This commit is contained in:
Zuul 2018-04-13 12:32:51 +00:00 committed by Gerrit Code Review
commit 3f7935d3ac
4 changed files with 60 additions and 86 deletions

View File

@ -21,7 +21,7 @@
"phantomjs-prebuilt": "2.1.x" "phantomjs-prebuilt": "2.1.x"
}, },
"scripts": { "scripts": {
"postinstall": "if [ ! -d .tox ] || [ ! -d .tox/py27 ]; then tox -epy27 --notest; fi", "postinstall": "if [ ! -d .tox ] || [ ! -d .tox/karma ]; then tox -ekarma --notest; git clone https://git.openstack.org/openstack/horizon.git .tox/karma/src/horizon; pip install -U -t .tox/karma/lib/python2.7/site-packages/ .tox/karma/src/horizon; fi",
"test": "karma start zun_ui/karma.conf.js --single-run", "test": "karma start zun_ui/karma.conf.js --single-run",
"lint": "eslint --no-color zun_ui/static", "lint": "eslint --no-color zun_ui/static",
"lintq": "eslint --quiet zun_ui/static" "lintq": "eslint --quiet zun_ui/static"

20
tools/tox_helper.sh Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
ENVNAME=$1
BASEPYTHON=$2
COMMAND=$3
if [ ${COMMAND} = "pre" ]; then
# crean-up
rm -fr .tox/${ENVNAME}-log/
# install horizon from git
rm -fr .tox/${ENVNAME}/src/
git clone https://git.openstack.org/openstack/horizon.git .tox/${ENVNAME}/src/horizon
pip install -U -t .tox/${ENVNAME}/lib/${BASEPYTHON}/site-packages/ .tox/${ENVNAME}/src/horizon
elif [ ${COMMAND} = "post" ]; then
# crean-up
rm -fr .tox/${ENVNAME}/src/
mv .tox/${ENVNAME}/log/ .tox/${ENVNAME}-log/
rm -fr .tox/${ENVNAME}/
fi

120
tox.ini
View File

@ -1,5 +1,5 @@
[tox] [tox]
envlist = pep8,py35,py35dj20,py27,jstests,docs,releasenotes envlist = pep8,py35,py35dj20,py27,eslint,karma,docs,releasenotes
minversion = 2.3.2 minversion = 2.3.2
skipsdist = True skipsdist = True
@ -33,122 +33,76 @@ max-complexity = 20
commands = python setup.py test --coverage --testr-args='{posargs}' commands = python setup.py test --coverage --testr-args='{posargs}'
[testenv:py27] [testenv:py27]
whitelist_externals =
git
mv
rm
commands = commands =
# Crean up env # Clean-up env and install horizon from git
rm -fr .tox/py27/src/ {toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
rm -fr .tox/py27-log/
# To test on local, re-install horizon from git like CI infra does.
git clone https://git.openstack.org/openstack/horizon.git .tox/py27/src/horizon
pip install -U -t .tox/py27/lib/python2.7/site-packages/ .tox/py27/src/horizon
# Run test # Run test
python manage.py test {posargs} python manage.py test {posargs}
# To save disk space, clean up installed modules except log # Clean-up env except log
mv .tox/py27/log/ .tox/py27-log/ {toxinidir}/tools/tox_helper.sh {envname} {basepython} post
rm -fr .tox/py27/
[testenv:py35] [testenv:py35]
basepython = python3.5 basepython = python3.5
whitelist_externals =
git
mv
rm
commands = commands =
# Crean up env # Clean-up env and install horizon from git
rm -fr .tox/py35/src/ {toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
rm -fr .tox/py35-log/
# To test on local, re-install horizon from git like CI infra does.
git clone https://git.openstack.org/openstack/horizon.git .tox/py35/src/horizon
pip install -U -t .tox/py35/lib/python3.5/site-packages/ .tox/py35/src/horizon
# Run test # Run test
python manage.py test {posargs} python manage.py test {posargs}
# To save disk space, clean up installed modules except log # Clean-up env except log
mv .tox/py35/log/ .tox/py35-log/ {toxinidir}/tools/tox_helper.sh {envname} {basepython} post
rm -fr .tox/py35/
[testenv:py35dj20] [testenv:py35dj20]
basepython = python3.5 basepython = python3.5
whitelist_externals =
git
mv
rm
commands = commands =
# Crean up env # Clean-up env and install horizon from git
rm -fr .tox/py35dj20/src/ {toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
rm -fr .tox/py35dj20-log/
# To test on local, re-install horizon from git like CI infra does.
git clone https://git.openstack.org/openstack/horizon.git .tox/py35dj20/src/horizon
pip install -U -t .tox/py35dj20/lib/python3.5/site-packages/ .tox/py35dj20/src/horizon
# Run test # Run test
pip install django>=2.0,<2.1 pip install django>=2.0,<2.1
python manage.py test {posargs} python manage.py test {posargs}
# To save disk space, clean up installed modules except log # Clean-up env except log
mv .tox/py35dj20/log/ .tox/py35dj20-log/ {toxinidir}/tools/tox_helper.sh {envname} {basepython} post
rm -fr .tox/py35dj20/
[testenv:jstests] [testenv:eslint]
# jstests includes checks for eslint and karma test.
whitelist_externals = whitelist_externals =
npm npm
git
mv
rm
commands = commands =
# Crean up env # Clean-up env and install horizon from git
rm -fr .tox/jstests/src/ {toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
rm -fr .tox/jstests-log/
# To test on local, re-install horizon from git like CI infra does.
git clone https://git.openstack.org/openstack/horizon.git .tox/jstests/src/horizon
pip install -U -t .tox/jstests/lib/python2.7/site-packages/ .tox/jstests/src/horizon
# Run test # Run test
npm install npm install
npm run lint npm run lint
# Clean-up env except log
{toxinidir}/tools/tox_helper.sh {envname} {basepython} post
[testenv:karma]
whitelist_externals =
npm
commands =
# Clean-up env and install horizon from git
{toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
# Run test
npm install
npm run test npm run test
# clean up installed modules except log # Clean-up env except log
mv .tox/jstests/log/ .tox/jstests-log/ {toxinidir}/tools/tox_helper.sh {envname} {basepython} post
rm -fr .tox/jstests/
rm -fr .tox/py27/
[testenv:docs] [testenv:docs]
whitelist_externals =
git
mv
rm
commands = commands =
# Crean up env # Clean-up env and install horizon from git
rm -fr .tox/docs/src/ {toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
rm -fr .tox/docs-log/
# To test on local, re-install horizon from git like CI infra does.
git clone https://git.openstack.org/openstack/horizon.git .tox/docs/src/horizon
pip install -U -t .tox/docs/lib/python2.7/site-packages/ .tox/docs/src/horizon
# Run test # Run test
python setup.py build_sphinx python setup.py build_sphinx
# To save disk space, clean up installed modules except log # Clean-up env except log
mv .tox/docs/log/ .tox/docs-log/ {toxinidir}/tools/tox_helper.sh {envname} {basepython} post
rm -fr .tox/docs/
rm -fr .tox/py27/
[testenv:releasenotes] [testenv:releasenotes]
whitelist_externals =
git
mv
rm
commands = commands =
# Crean up env # Clean-up env and install horizon from git
rm -fr .tox/releasenotes/src/ {toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
rm -fr .tox/releasenotes-log/
# To test on local, re-install horizon from git like CI infra does.
git clone https://git.openstack.org/openstack/horizon.git .tox/releasenotes/src/horizon
pip install -U -t .tox/releasenotes/lib/python2.7/site-packages/ .tox/releasenotes/src/horizon
# Run test # Run test
sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html sphinx-build -a -E -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
# To save disk space, clean up installed modules except log # Clean-up env except log
mv .tox/releasenotes/log/ .tox/releasenotes-log/ {toxinidir}/tools/tox_helper.sh {envname} {basepython} post
rm -fr .tox/releasenotes/
rm -fr .tox/py27/
[testenv:lower-constraints] [testenv:lower-constraints]
basepython = python3 basepython = python3

View File

@ -19,7 +19,7 @@ var path = require('path');
module.exports = function (config) { module.exports = function (config) {
// This tox venv is setup in the post-install npm step // This tox venv is setup in the post-install npm step
var toxPath = '../.tox/py27/lib/python2.7/site-packages/'; var toxPath = '../.tox/karma/lib/python2.7/site-packages/';
process.env.PHANTOMJS_BIN = 'node_modules/phantomjs-prebuilt/bin/phantomjs'; process.env.PHANTOMJS_BIN = 'node_modules/phantomjs-prebuilt/bin/phantomjs';
@ -70,7 +70,7 @@ module.exports = function (config) {
toxPath + 'xstatic/pkg/angular_schema_form/data/schema-form.js', toxPath + 'xstatic/pkg/angular_schema_form/data/schema-form.js',
// TODO: These should be mocked. // TODO: These should be mocked.
toxPath + '/horizon/static/horizon/js/horizon.js', toxPath + 'horizon/static/horizon/js/horizon.js',
/** /**
* Include framework source code from horizon that we need. * Include framework source code from horizon that we need.