fabioz/Pydev — pull request #76 by jonahkichwacoders (2013-09-23 23:07:21+00:00)
Title: Travis CI Integration

Here is a pull request to enable PyDev to be built with Travis CI https://travis-ci.org.

I have completed the work of getting PyDev to build, test and deploy using Travis. The build and test is entirely done with Maven/Tycho so is quite portable. It worked well on my Windows machine and the main development was done on Ubuntu 12.04 64-bit (which is the same as the Travis VMs run).

High level features are:
1) Tests are run with Tycho/Maven. This includes Workbench tests and all dependencies in TestDependent met (including Jython and IronPython)
2) Maven signs jars so that the release version can be done from Travis CI
3) Travis scripts exist to setup and deploy. Deployment is implemented to deploy to an S3 bucket.
4) All tests

There are some outstanding issues, listed in travis.TODO.

The overview of the changes are:
1) Update projects to support building for Tycho. This meant adding tests/ folders into the build path. See the very first item in travis.TODO
2) Tycho runs the JUnit tests with OSGi on. This means that PydevPlugin.getDefault() != null when tests are running. There is a lot of code that relied on this test in one way or another to change behaviour when under test. All such uses have been replaced with SharedCorePlugin.inTestMode(). This still allows tests to be run from within the IDE as (plain) JUnit tests. To best replicate how tests are run from Tycho, run the test as a "JUnit Plug-in Test", but, in Main tab, "Run an application" choose "[No Application] Headless Mode"
3) I have update some tests to make sure they run correctly in the OSGi mode.
4) I have marked all tests that I have reviewed that fail (for me/on Travis) with "fail("Known failure.")". I have put a comment above the fail documenting my understanding of why it fails. A number of the failures are due to Python 2.6 vs 2.7. A perfect example is in 2.6 unittest with a python file, in 2.7 it is a directory. I don't understand some of the failures, but I don't think they are that significant. With more info on what the reference platform and results are we can decide how to deal with them going forward.

You can see the result of this build here:
https://travis-ci.org/jonahkichwacoders/Pydev/builds/11710518
if you look at the bottom of the log:
https://s3.amazonaws.com/archive.travis-ci.org/jobs/11710519/log.txt
you can see links to the upload artifacts, eg.:
http://pydevbuilds2.s3.amazonaws.com/artifacts/build/11710518/11710519/junit-noframes.html
which shows 2390 Tests with 1 Error and 41 Failures

To fully integrate travis, the secure environment variables need to be set to work with PyDev:
1) Log-in/setup Travis CI and enable it for Pydev repo (follow instructions on Travis)
2) Create an S3 bucket in us-east-1 (physically located next to Travis's build machines, makes build times faster)
3) Follow http://about.travis-ci.org/docs/user/encryption-keys/ to create environment variables and update the relevant ones in .travis.yml
NOTE: You don't need to do any of these steps. The things that S3 is used for:
1) Storing your keystore so you can sign jars. This is independently optional, if you don't provide a keystore in the expected place (s3://$ARTIFACTS_S3_BUCKET/pydev.keystore) then the travis build will not sign the jars.
2) Caching .m2/repository value in s3://$ARTIFACTS_S3_BUCKET/m2repo.tar.gz. This does not have to be pre-loaded, the builds will create/update it on each run.
3) Storing JUnit and Build results. See travisupload.sh

Please be in touch if there is anything I can change. Once this gets approved I will work on the remaining TODOs in travis.TODO, starting from the top.

Thanks
Jonah