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"
},
"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",
"lint": "eslint --no-color 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]
envlist = pep8,py35,py35dj20,py27,jstests,docs,releasenotes
envlist = pep8,py35,py35dj20,py27,eslint,karma,docs,releasenotes
minversion = 2.3.2
skipsdist = True
@ -33,122 +33,76 @@ max-complexity = 20
commands = python setup.py test --coverage --testr-args='{posargs}'
[testenv:py27]
whitelist_externals =
git
mv
rm
commands =
# Crean up env
rm -fr .tox/py27/src/
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
# Clean-up env and install horizon from git
{toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
# Run test
python manage.py test {posargs}
# To save disk space, clean up installed modules except log
mv .tox/py27/log/ .tox/py27-log/
rm -fr .tox/py27/
# Clean-up env except log
{toxinidir}/tools/tox_helper.sh {envname} {basepython} post
[testenv:py35]
basepython = python3.5
whitelist_externals =
git
mv
rm
commands =
# Crean up env
rm -fr .tox/py35/src/
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
# Clean-up env and install horizon from git
{toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
# Run test
python manage.py test {posargs}
# To save disk space, clean up installed modules except log
mv .tox/py35/log/ .tox/py35-log/
rm -fr .tox/py35/
# Clean-up env except log
{toxinidir}/tools/tox_helper.sh {envname} {basepython} post
[testenv:py35dj20]
basepython = python3.5
whitelist_externals =
git
mv
rm
commands =
# Crean up env
rm -fr .tox/py35dj20/src/
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
# Clean-up env and install horizon from git
{toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
# Run test
pip install django>=2.0,<2.1
python manage.py test {posargs}
# To save disk space, clean up installed modules except log
mv .tox/py35dj20/log/ .tox/py35dj20-log/
rm -fr .tox/py35dj20/
# Clean-up env except log
{toxinidir}/tools/tox_helper.sh {envname} {basepython} post
[testenv:jstests]
# jstests includes checks for eslint and karma test.
[testenv:eslint]
whitelist_externals =
npm
git
mv
rm
commands =
# Crean up env
rm -fr .tox/jstests/src/
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
# Clean-up env and install horizon from git
{toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
# Run test
npm install
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
# clean up installed modules except log
mv .tox/jstests/log/ .tox/jstests-log/
rm -fr .tox/jstests/
rm -fr .tox/py27/
# Clean-up env except log
{toxinidir}/tools/tox_helper.sh {envname} {basepython} post
[testenv:docs]
whitelist_externals =
git
mv
rm
commands =
# Crean up env
rm -fr .tox/docs/src/
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
# Clean-up env and install horizon from git
{toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
# Run test
python setup.py build_sphinx
# To save disk space, clean up installed modules except log
mv .tox/docs/log/ .tox/docs-log/
rm -fr .tox/docs/
rm -fr .tox/py27/
# Clean-up env except log
{toxinidir}/tools/tox_helper.sh {envname} {basepython} post
[testenv:releasenotes]
whitelist_externals =
git
mv
rm
commands =
# Crean up env
rm -fr .tox/releasenotes/src/
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
# Clean-up env and install horizon from git
{toxinidir}/tools/tox_helper.sh {envname} {basepython} pre
# Run test
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
mv .tox/releasenotes/log/ .tox/releasenotes-log/
rm -fr .tox/releasenotes/
rm -fr .tox/py27/
# Clean-up env except log
{toxinidir}/tools/tox_helper.sh {envname} {basepython} post
[testenv:lower-constraints]
basepython = python3

View File

@ -19,7 +19,7 @@ var path = require('path');
module.exports = function (config) {
// 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';
@ -70,7 +70,7 @@ module.exports = function (config) {
toxPath + 'xstatic/pkg/angular_schema_form/data/schema-form.js',
// 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.