← Back to team overview

openerp-community team mailing list archive

OCA 8.0 Travis Update: it works!

 

An update:

I have commited a project to github: lp:openerp-travel to play around
with travis-ci.org and coverall.io
A .travis.yml[1], a .coveragerc[2] file and a README.md[3] with travis
and coveralls badge have been added to the project. This should serve as
a template (or an example) for the other OCA projects.

You can view it here on my branch[4].
Pull requests have a useful check mark or x mark depending on if the
tests passed or failed[5].

PR which pass[6] tests have a message visible to commiters from travis
saying "All is well — The Travis CI build passed · Details" next to the
automatic merge button. Details is a link to the travis build for that
particular PR[7]. Coveralls.io also posts whether the tests coverage
increased, decreased or stayed the same along with a link to the details
of changed coverage[8].

PR which fail[9][10] tests have a message visible to commiters from
travis saying "Failed — The Travis CI build failed · Details Merge with
caution!" next to the automatic merge button. Details is a link to the
travis build details[11][12].

Additionally, each commit on the repo, as well as each successful PR is
tested by travis-ci.org[13] which the publishes a test coverage report
to coverage.io[14] which has a very thorough level of detail[15].

About the .travis.yml implementation. I ran into a few issues which are
important to point out.
  * The travis test relies on the setup.py script of odoo to be used by
the command pip in a virtualenv:
      pip install https://github.com/odoo/odoo/archive/master.zip
    This script is currently broken, as, firstly, it fails to install
the contents of addons and, secondly, in the virtualenv, it will install
odoo in two places, which causes problems since the latter is missing
import_xml.rng:
       - env/openerp
       - env/lib/python2.7/site-packages/openerp
    A temporary solution was to use the branch proposed in a PR[16]
which attempts to solve the first problem instead of the official odoo
branch.
  * I dropped testing on python 2.6 as it seems odoo 8.0 uses dictionary
generators which were introduced to 2.7. I haven't tested with pypy and
3.4 yet, but I highly doubt they have been made compatible since last
time I tried[17]. I have however added them in comments in case they
become compatible in the future.
  * Some repos contain modules which depend on other modules in other
OCA modules. I have therefore added lines in the install section which
branches or clones these dependencies to /tmp so to have them but not
test them,
  * openerp-server is run twice. The first time during the before_script
to install without testing and the second time in script to test. The
reason for this is to skip testing dependencies and only test modules in
the repo.
  * I abandonned the idea of running flake against the changes using
`git diff -W | flake --diff` as discovering the revision numbers didn't
always work and caused more problems than it solves. The flake is
therefore run on the entirety of the repo. I assumes the base branch is
fully pep8-compliant (as it should be). What this means is that adding
travis testing to an OCA repo requires the whole repo be fixed to pass
pep8 tests. The flake specifications are line lengths of max 120 and
ignore F401 (imported but not used) in __init__.py files only:
    * flake8 . --max-line-length=120 --filename=__init__.py
--ignore=F401
    * flake8 . --max-line-length=120 --exclude=__init__.py
  * Coverage report will ignore the following path patterns:
    /usr/*
    /tmp/*
    */bin/*
    */lib/*
    */odoo/*
    */openerp/*
    */tests/*
    *__init__.py
  * Coverage report will ignore line containing the following patterns:
    * # pragma: no cover
    * if context is None:

Your feedback is highly encoraged and appreciated.

-- 
Sandy

Sorry for the wall of links. This is just very exciting as a reviewer.
[1] https://github.com/bwrsandman/openerp-travel/blob/master/.travis.yml
[2] https://github.com/bwrsandman/openerp-travel/blob/master/.coveragerc
[3]
https://raw.githubusercontent.com/bwrsandman/openerp-travel/master/README.md 
[4] https://github.com/bwrsandman/openerp-travel
[5] https://github.com/bwrsandman/openerp-travel/pulls
[6] https://github.com/bwrsandman/openerp-travel/pull/4
[7] https://travis-ci.org/bwrsandman/openerp-travel/builds/25836924
[8] https://coveralls.io/builds/797335
[9] https://github.com/bwrsandman/openerp-travel/pull/3 
[10] https://github.com/bwrsandman/openerp-travel/pull/2 
[11]
https://travis-ci.org/bwrsandman/openerp-travel/builds/25836879#L1390
[12] https://travis-ci.org/bwrsandman/openerp-travel/builds/25836901
[13] https://travis-ci.org/bwrsandman/openerp-travel/builds
[14] https://coveralls.io/r/bwrsandman/openerp-travel 
[15] https://coveralls.io/files/204859233
[16] https://github.com/odoo/odoo/pull/81
[17]
http://bwrsandman.wordpress.com/2014/04/25/running-openerp-8-0-trunk-with-pypy-and-psycopg2cffi/ 

Attachment: signature.asc
Description: This is a digitally signed message part


Follow ups