Skip to content

Continuous integration with Travis and Docker, fixes #625#1255

Merged
inclement merged 1 commit into
kivy:masterfrom
AndreMiras:feature/ticket625_continuous_integration_docker
May 7, 2018
Merged

Continuous integration with Travis and Docker, fixes #625#1255
inclement merged 1 commit into
kivy:masterfrom
AndreMiras:feature/ticket625_continuous_integration_docker

Conversation

@AndreMiras

Copy link
Copy Markdown
Member

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
Copy Markdown
Member Author

Build is green here: https://travis-ci.org/AndreMiras/python-for-android/builds/363435368
So you just need to register to Travis using your GitHub account and after merging the pull request the continuous integration will be setup.

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 AndreMiras force-pushed the feature/ticket625_continuous_integration_docker branch from 2dec324 to 2982ce5 Compare April 7, 2018 09:10
@inclement

Copy link
Copy Markdown
Member

Nice, very clear. I'll look into enabling travis for p4a, but as previously discussed won't be able to focus on it until next week.

@AndreMiras

Copy link
Copy Markdown
Member Author

Any news regarding that pull request @inclement ? You look quite busy, maybe we should ping another member of the project? I feel like it's an important one because it should help to increase overall project maintainability.
BTW good news I could compile some APK from the latest Ubuntu 18.04 LTS, so at some point we may want to officially support it too.

@inclement

Copy link
Copy Markdown
Member

@AndreMiras I'm very sorry for not getting around to this. I completely agree that it's important, and I'll try to make some time for this in particular at the weekend. Thank you for reminding me about it.

@inclement

inclement commented May 7, 2018

Copy link
Copy Markdown
Member

I've been looking into this and it seems great. I've also enabled travis CI for this repository, ready to merge it.

However, am I right in understanding that running docker build -t p4a . using this image should work on my local machine? It currently fails for me right at the end, with:

Step 16/20 : RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-19"
 ---> Running in 0504256a5c08
done
Removing intermediate container 0504256a5c08
 ---> b6a380bcc37e
Step 17/20 : RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;26.0.2"
 ---> Running in 92cd2fe7d31f
done
Removing intermediate container 92cd2fe7d31f
 ---> 382c24558f79
Step 18/20 : WORKDIR /app
Removing intermediate container b6d21db0ce9f
 ---> f03fab2e8738
Step 19/20 : COPY . /app
 ---> 4ae2f86411a7
Step 20/20 : RUN virtualenv --python=python venv && . venv/bin/activate && pip install -e .
 ---> Running in 2604380b3306
New python executable in /app/venv/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
Running virtualenv with interpreter /usr/bin/python
Directory '.' is not installable. File 'setup.py' not found.
The command '/bin/sh -c virtualenv --python=python venv && . venv/bin/activate && pip install -e .' returned a non-zero code: 1

Hopefully it's just some mistake on my part.

@AndreMiras

Copy link
Copy Markdown
Member Author

Great :)
Yes it should work on your local machine indeed. It's weird that it's saying setup.py is not found. It should get deployed during the COPY command, unless you have a .dockerignore that state otherwise.
You could try to debug it by commenting that last RUN line from the Dockerfile, do the build again and then start an interactive shell in the Docker container with: docker run -it --rm p4a.
From that interactive shell you can play with the environment to see what's wrong. Perhaps we can talk on IRC.

@inclement inclement merged commit 18a99b8 into kivy:master May 7, 2018
@AndreMiras AndreMiras deleted the feature/ticket625_continuous_integration_docker branch October 6, 2018 17:40
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

Successfully merging this pull request may close these issues.

2 participants