Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use travis to automatically test builds on different platforms #625

Closed
cbenhagen opened this issue Feb 3, 2016 · 9 comments
Closed

Use travis to automatically test builds on different platforms #625

cbenhagen opened this issue Feb 3, 2016 · 9 comments

Comments

@cbenhagen
Copy link
Contributor

@kived:

Do you mean use Travis to check for these issues? My primary concern there would be the build time required to check everything. Maybe if it could be set up to run once a night rather than whenever a commit happens - won't get immediate results, but issues would still be detected. But mostly I think the revamp just hasn't been tested well in OSX, not that there is any regression.

Yeah I meant to setup travis to continuously check for build issues. We can use something like nightli.es for this. Or any alternative mentioned here.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@AndreMiras
Copy link
Member

That would be interesting to have Continuous Integration indeed.
Unfortunately we would have issues with conflicting recipes. But I guess we could at least start with a small subset of recipes to compile. I feel that would be a good start and better than nothing.
I guess that would require to create a dedicated buildozer.spec file with the target recipes in the requirements list.
Because as far as I know there's no command to build a single recipe (buildozer android p4a -- --help), right?

@inclement
Copy link
Member

inclement commented Jun 24, 2017

Because as far as I know there's no command to build a single recipe

There isn't really a command for this, but it would be easy to add one. It wouldn't be any barrier (and you don't need to build recipes one by one anyway, for the testing).

@AndreMiras
Copy link
Member

AndreMiras commented Jun 24, 2017

There isn't really a command for this, but it would be easy to add one.

OK

It wouldn't be any barrier (and you don't need to build recipes one by one anyway, for the testing).
What do you mean? How would you do if not building one by one for CI? I see only this way or creating buildozer.spec files per "compatibles recipes".
Anyway I'm currently trying to setup Travis-CI for one python-for-android project I and already so other pitfalls. I'll come back with my findings.

Would you eventually be interested with a PR that demonstrates Travis-CI building few recipes?

@inclement
Copy link
Member

Sorry, I missed this reply (just noticed your edit) - yes, a PR for this would be really great!

@AndreMiras
Copy link
Member

OK great, I've implemented it for my project https://travis-ci.org/AndreMiras/PyWallet it runs two builds:

  1. Kivy Linux install + unit tests
  2. buildozer build for Android

Everything is here: https://github.com/AndreMiras/PyWallet/tree/v20170625/travis/
It's bit hacky, but seems to work OK so far.
I'll work on the PR when I get time then :)

@AndreMiras
Copy link
Member

I'll try to take a look over the weekend.
My strategy would be:

  1. Create a Dockerfile image with Android build tools and p4a dependencies
  2. Actually install p4a pip install -e . within the Dockerfile
  3. Use the Docker container to build APKs e.g. p4a apk --private testapps/testapp --package=org.example.myapp --name "My application" --version 0.1 --bootstrap=sdl2 --requirements=python2,kivy

So I believe if anything goes wrong (e.g. cross compilation failing) it will exit with status code other than zero and Travis CI should complain. Also I think we're free from adding any --requirements=recipe1,recipe2 as we want as long as they don't conflict with eachother.
So that would be a first iteration to continuous integration. Next steps would be to handle both Python 2 and 3. And the ultimate step would be to actually try to run the APK in an Android environment.
Tell me what you think or if you have any suggestions.
PS: sorry for the formatting and typos, I'm on phone.

@inclement
Copy link
Member

Sounds reasonable to me. I don't have any docker experience, and didn't even really know that this might be a convenient way to manage the install, but it would be great if it works.

Thanks a lot for you efforts on this!

@AndreMiras
Copy link
Member

AndreMiras commented Apr 6, 2018

Great! Yes in fact Docker makes complete sense in this, because it let us create a completely isolated, but light environment. And you can decide which base to use, I'm gonna go for the last LTS (currently ubuntu:16.04).
Edit: And yes I forgot to add that's specially more convenient in CI tools such as Travis, because they don't always provide the Linux distribution and tools you expect, but they often provide a mean to use Docker.

AndreMiras added a commit to AndreMiras/python-for-android that referenced this issue Apr 7, 2018
This is a first step to python-for-android continuous integration.
It currently only verifies that p4a creates an APK by cross compiling
a limited set of recipes.

How it works; On git push Travis "executes" `.travis.yml` instructions:

1. the `before_install` section runs `docker build` to prepare the environment
2. the `script` section is the actual test, building the APK with `docker run`
3. based the exit status Travis build will be green or red

For example editing `pythonforandroid/recipes/hostpython2/__init__.py` and
introducing an error e.g. replace `-j5` with `--wrong-flag` would make it fail.

Things to improve:

 - improve `.travis.yml` readability
 - test more recipes
 - bring Python3 and Crystax support
 - speed up build/run by caching downloads
 - switch to sdkmanager
 - and much more
AndreMiras added a commit to AndreMiras/python-for-android that referenced this issue Apr 7, 2018
This is a first step to python-for-android continuous integration.
It currently only verifies that p4a creates an APK by cross compiling
a limited set of recipes.

How it works; On git push Travis "executes" `.travis.yml` instructions:

1. the `before_install` section runs `docker build` to prepare the environment
2. the `script` section is the actual test, building the APK with `docker run`
3. based the exit status Travis build will be green or red

For example editing `pythonforandroid/recipes/hostpython2/__init__.py` and
introducing an error e.g. replace `-j5` with `--wrong-flag` would make it fail.

Things to improve:

 - improve `.travis.yml` readability
 - test more recipes
 - bring Python3 and Crystax support
 - speed up build/run by caching downloads
 - switch to sdkmanager
 - and much more
AndreMiras added a commit to AndreMiras/python-for-android that referenced this issue Apr 7, 2018
This is a first step to python-for-android continuous integration.
It currently only verifies that p4a creates an APK by cross compiling
a limited set of recipes.

How it works; On git push Travis "executes" `.travis.yml` instructions:

1. the `before_install` section runs `docker build` to prepare the environment
2. the `script` section is the actual test, building the APK with `docker run`
3. based the exit status Travis build will be green or red

For example editing `pythonforandroid/recipes/hostpython2/__init__.py` and
introducing an error e.g. replace `-j5` with `--wrong-flag` would make it fail.

Things to improve:

 - improve `.travis.yml` readability
 - test more recipes
 - bring Python3 and Crystax support
 - speed up build/run by caching downloads
 - and much more
@AndreMiras
Copy link
Member

AndreMiras commented Apr 7, 2018

@cbenhagen, @inclement and @kived pull request is ready here #1255
Please let me what you think and merge it if you don't see any blocker. It's not perfect, but we should see it as a minimal valuable product which we can later improve once it's merged.
Edit: by the way it currently build in only 15 minutes, even though it only has --requirements=python2,kivy I think we can still have relatively short timed build by introducing some caching. This will come in subsequent pull requests.

inclement added a commit that referenced this issue May 7, 2018
…_integration_docker

Continuous integration with Travis and Docker, fixes #625
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants