|Version 5 (modified by 7 years ago) ( diff ),|
Unittests on every PR
How PRs are tested
When a pull request is opened, Travis CI receives a pull request notification from GitHub. This notification is turned into a build and run. These are the steps that are followed.
- Web2py is installed from web2py src.
- A new requirements.txt file is generated from optional_requirements.txt and requirements.txt. In future, if any other requirements.txt (for eg: for EdenTest) is also given as argument, that will also be incorporated in the generated_requirements.txt file. Note: generated_requirements.txt is not in the main branch and not in version control. Also, packages like matplotlib are installed from the binaries as installing them from pip, which builds first, takes a lot of time.
- Eden is installed.
- 000_config.py is configured based on the enviorment variables. As of now, all the database systems supported by Eden are tested, namely, mysql, postgres-9.1, postgres-9.3, postgres-9.3+postgis and sqlite3.
- UnitTests are run
Note: For postgres-9.3, psycopg2 is used as the driver as the default web2py driver pg8000 does not have all the mappings.
Please see .travis.yml for the configuration and the files inside travis directory for the scripts used above.
Along the way, commit status of the commits involved is updated, which in turn shows on GitHub as either a warning that the build is still running, that the pull request should be merged with caution because the build failed, or that it can be merged safely because the build was successful.
Travis CI builds a pull request when it's first opened and when commits are added to the pull request throughout its lifetime. Rather than test the commits from the branches the pull request is sent from, it tests the merge between the origin and the upstream branch.
How to enable Travis CI for your developer branch
Travis is intended for continuous integration on various databases, it is not recommended for testing during development phase as it would be quite slow and the same can be done on one's local machine. Nonetheless, to enable Travis CI for your developer branch, follow these steps:
- Sign in with your GitHub account on Travis CI.
- You'll be asked to grant Travis CI a set of access permissions.
- Once you have given access permissions, go to the profile page of your Travis account. There you'll find all your repositories, flip the switch for those repositories for which you want to enable the Travis CI service.
- In order for Travis CI to build your project, you'll need to add a file named .travis.yml to the root of your repository(which is already present in the trunk of eden).
- To trigger the test, push your commit to your branch. Alternatively, you can go to your GitHub Webhooks & Services page and use the "Test Hook" button for Travis CI. Please note that you cannot trigger your first build using Test Hook button. It has to be triggered by a push to your repository.