diff --git a/travis/travis_after_tests_success b/travis/travis_after_tests_success index ad1eebb42..1bfc41bdc 100755 --- a/travis/travis_after_tests_success +++ b/travis/travis_after_tests_success @@ -1,6 +1,8 @@ #!/usr/bin/env python import os +import sys +import subprocess from coverage.cmdline import main as coverage_main from coveralls import cli as coveralls_cli @@ -19,3 +21,13 @@ if (os.environ.get('TESTS', '1') == '1' and codecov_main(argv=None) except: pass + +if os.environ.get('AUTODOC') == '1': + odoo_version = os.environ.get("VERSION") + proc = subprocess.call([ + 'travis-sphinx', + '--branch=%s' % odoo_version, + 'deploy' + ]) + sys.exit(proc.returncode) + diff --git a/travis/travis_autodoc_build b/travis/travis_autodoc_build new file mode 100755 index 000000000..06c50fa97 --- /dev/null +++ b/travis/travis_autodoc_build @@ -0,0 +1,20 @@ +#!/usr/bin/env python +import os +import subprocess +import sys + +from getaddons import get_modules + + +root_dir = os.path.dirname(os.path.abspath(__file__)) +status = 0 + +for addon in get_modules(os.path.abspath('.')): + status += subprocess.call(['sphinx-apidoc', + '-f', + '-o', + 'docs/source/addons/%s' % addon, + addon]) +status += subprocess.call(['travis-sphinx', '-n', 'build']) + +sys.exit(0 if status == 0 else 1) diff --git a/travis/travis_autodoc_requirements.txt b/travis/travis_autodoc_requirements.txt new file mode 100644 index 000000000..66b5b9823 --- /dev/null +++ b/travis/travis_autodoc_requirements.txt @@ -0,0 +1,7 @@ +sphinx +sphinx-rtd-theme +sphinx_bootstrap_theme +odoo-sphinx-autodoc +docutils +pillow +travis-sphinx diff --git a/travis/travis_install_nightly b/travis/travis_install_nightly index 918db3521..92fa17177 100755 --- a/travis/travis_install_nightly +++ b/travis/travis_install_nightly @@ -14,6 +14,10 @@ if [ "${LINT_CHECK}" != "0" ]; then exit 0 fi +if [ "${AUTODOC}" != "0" ]; then + pip install --upgrade -r travis_autodoc_requirements.txt +fi + # We can exit here and do nothing if this only a LINT check if [ "${TESTS}" != "1" ] && [ "${LINT_CHECK}" == "1" ]; then exit 0 diff --git a/travis/travis_run_tests b/travis/travis_run_tests index 9e3a40d6e..932355fae 100755 --- a/travis/travis_run_tests +++ b/travis/travis_run_tests @@ -56,6 +56,7 @@ if __name__ == '__main__': is_oca_project = os.environ.get('TRAVIS_REPO_SLUG', '').startswith('OCA/') is_oca_transifex_user = os.environ.get('TRANSIFEX_USER') == \ 'transbot@odoo-community.org' + doc_enabled = os.environ.get('AUTODOC') == '1' # TRAVIS_PULL_REQUEST contains the pull request number or 'false' is_pull_request = os.environ.get('TRAVIS_PULL_REQUEST') != 'false' @@ -79,5 +80,8 @@ if __name__ == '__main__': if transifex_enabled and is_valid_transifex: tests.append(['travis_transifex.py']) + if doc_enabled: + tests.append(['travis_autodoc_build']) + if tests: exit(main(tests))