Skip to content

Playing with on_device_unit_test_app #2046 #2073

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

Closed
wants to merge 43 commits into from

Conversation

opacam
Copy link
Member

@opacam opacam commented Feb 29, 2020

This is not to be reviewed nor merged, of course commented if you want, but the purpose of this is to play a little with some recipes and the on_device_unit_test_app (#2046).

Some of the commits I will make in here, will be to test some active PRs. But I also will make some other commits which may be future PRs...if we like them. BTW, each gh-actions run should produce four apks, one for each arch, but probably it won't be the case...we will have failures on some/all archs (but this is fine...since is the first step to find a future solution). Also You should know that the generated artifacts via gh-actions are .zip compressed files with the apk inside them.

So, this is what I'm planning to do in here:

Notes:

  • I will completely ignore travis results in here, because this is to test gh-actions generated artifacts
  • The planning may change along the way, so I will try to keep it updated
  • This tests will be useful because we are testing with latest develop branch (at the time of writing), so we are testing with our current default python version 3.8.1 (Python 3.8 support on Android #2044)

So depending on the supplied recipes, a different test app will be ran.

The supported test apps are:
  - kivy
  - flask
  - no-gui
for our CI providers and `rebuild_updated_recipes.py` because we recently removed
the old test app that we made use of.
Remove sentence regarding python2 compatibility...
because python2 it's almost at the end of his life
So we can get an apk via gh-actions

Notes:
  - this way the reviewers can install the flask apk without making the build
  - these changes will be reverted in the next
    commit...since we want a kivy app as our default)
in case that we detect that p4a will build an `service_only` app.

Note: if we don't do this we wil get errors once we try to create our apk with the target distribution
and:
  - remove Python 2 test apps because:
      + we already test Python 2 with travis
      + Python 2 it's almost at the end of his life
  - change gh-actions job title (because it looks better)
Because it looks better and is more readable.
Because reducing filename to `setup.py` will make our cli arguments shorter and source code cleaner
So our matrix gh-actions builds will not be cancelled if some arch fails
We also add `harfbuzz` to requirements to have freetype library built
with harfbuzz support.
@opacam opacam added the WIP label Feb 29, 2020
@opacam
Copy link
Member Author

opacam commented Feb 29, 2020

Hahahaha, first bugs found, for archs x86 and x86_64...when building harfbuzz recipe in both cases:

BTW, the first commit I made here 9fca4b0 (not included in #2046), allow us to go on if some arch fails to build...:thinking:...I think that we should include that in #2046, since it will be difficult to test at runtime all the generated artifacts (precisely those failed archs are the ones that I cannot test at runtime, so I don't usually test the build in my local machine...and it will probably be the same case for other members/contributors, since those kind of CPUs, AFAIK are not common on smartphones...).

About the errors:

  • x86_64: it looks like that we should include -fPIC to our CFLAGS, probably we should do that at class level at Archx86_64
  • x86: This is not so clear to me...:thinking:

Anyway, let's go on and test the updated Pillow recipe #2067 and see what happens...

@opacam
Copy link
Member Author

opacam commented Feb 29, 2020

Ok, as expected, same harfbuzz errors for mentioned archs: x86 and x86_64 for the updated Pillow recipe (v7.0.0), so let's merge the updated one, since it cannot broke what is already broken and, probably, it has better Python 3.8.1 compatibility 😉

I tested the generated apks at runtime for the updated Pillow recipe, both works with my android device running Android 10.

Here are the generated apks, zip file compressed

BTW, I never uploaded an image of how it will look like the on device unit test app, here you have the one I got with one of those generated apk via gh-actions (only showing one screen of the app in portrait mode, split into two screenshots):

Screenshot_20200229-233121
Screenshot_20200229-233153

@AndreMiras
Copy link
Member

It looks amazing, thanks for sharing 👏

opacam added 3 commits March 1, 2020 01:06
Since, at this point, we know that we need to add the mentioned flags at
some point, let's be brave and try to add it at Arch level (since we
need `-fPIC` for `ArchARMv7_a` it may be also the case for `Archx86_64`)

See also: kivy#2073 (comment)
@opacam
Copy link
Member Author

opacam commented Mar 1, 2020

Ok, matplotlib recipe doesn't even have a chance to be built, fails installing kiwisolver, we may needed a cppy recipe...so let's fix this...

To do so, I will create a couple of PRs, which then I will merge the corresponding branch into here. This way, we can play a little more with this, having the fixes ready to review into the proper PR and the testing in here, since the matplotlib fix will probably fail the CI tests, because it will depend of the kiwisolver fix.

@opacam
Copy link
Member Author

opacam commented Mar 2, 2020

Yeah, the same situation that with the old freetype and harfbuzz libraries. Here are the generated apks. In this case I tested, at runtime, arch armeabi-v7a, works fine.

So, so far we have this situation:

  • harfbuzz is broken for x86 (I don't know what is happening here...needs investigation)
  • Pillow doesn't build for x86_64 (not find zlib headers)
  • numpy doesn't compile for MacOS (at least in our CI tests)
  • x86_64 may need some extra CFLAGS at Arch level (7d61143)

So now I will remove harfbuzz again, but also Pillow so we should see if we can get a succesful matplotlib build for all archs.

Because the updated `matplotlib` recipe could work now...let's test it
@opacam
Copy link
Member Author

opacam commented Mar 4, 2020

More thoughts:

  • Successfully built all archs for matplotlib recipe (without harfbuzz) 😄
  • MacOs build with travis is still failing (of course...nothing made to change that)
  • Yeah, rebuild_updated_recipes has no problem now with matplotlib recipe 🎉. BTW, if you look to the commit I made eb5e35a , you will see that the matplotlib recipe has hardcoded version for freetype library, and for png as well. That is not ideal and we probably want to get the version dynamically...anyway doesn't seem to affect the matplotlib compilation/installation....I suppose that matplotlib build only checks for a minimal version...still...before the merging of Fix matplotlib and update to v3.1.3 #2076, I'm planning to do a couple more of commits to address these things 😉
  • I cannot test, at runtime, the generated apks for x86 and x86_64...will work at runtime? 😶

@opacam
Copy link
Member Author

opacam commented Mar 5, 2020

Ok, we have matplotlib recipe merged into develop branch, with the issues mentioned before already fixed in there. BTW, thanks for the fast review @AndreMiras 👍 :)

So now I want to do one last test in here, the numpy update #2077, because matplotlib recipe depends on it...so better not to broke that, right? So...let's continue the investigation 🔎

@opacam opacam force-pushed the testing-testapps-rework branch from dbec040 to b943edc Compare March 5, 2020 14:38
@opacam
Copy link
Member Author

opacam commented Mar 14, 2020

Yeah, The new numpy recipe plays nice with the matpltolib recipe for armeabi-v7a and arm64-v8a (Here are the generated apks)

BTW, the error we got are the expected ones:

  • MacOsX test app build fails for travis
  • Python2 fails because the new numpy recipe is not compatible with it.

So, as a conclusion for the numpy test:
The new numpy recipe is not compatible with python2. Given that python2 will not be maintained anymore, and the fact that we have the numpy recipe posted and approved without merging for several days without anyone complaining, I think that the show must go on, so let's merge numpy into develop branch 😄

opacam added a commit to opacam/python-for-android that referenced this pull request Mar 14, 2020
Since, at this point, we know that we need to add the mentioned flags at
some point, let's be brave and try to add it at Arch level (since we
need `-fPIC` for `ArchARMv7_a` it may be also the case for `Archx86_64`)

**See also:**
  - kivy#2073 (comment)
opacam added a commit that referenced this pull request Mar 14, 2020
Since, at this point, we know that we need to add the mentioned flags at
some point, let's be brave and try to add it at Arch level (since we
need `-fPIC` for `ArchARMv7_a` it may be also the case for `Archx86_64`)

**See also:**
  - #2073 (comment)
opacam added a commit to opacam/python-for-android that referenced this pull request Mar 14, 2020
So our matrix gh-actions builds will not be cancelled if some arch fails
which is very useful to fix specific arch issues.

See also: kivy#2073
opacam added a commit to opacam/python-for-android that referenced this pull request Mar 14, 2020
Fix our `CI` travis tests by explicitly omit the numpy build for MacOsX.
Yeah...not actually a solution for MacOsX...but at least we will have
the `green tick mark` for our `CI` tests...but we have a problem with
MacOsX and numpy recipe :<

See also: kivy#2073
opacam added a commit to opacam/python-for-android that referenced this pull request Mar 30, 2020
So our matrix gh-actions builds will not be cancelled if some arch fails
which is very useful to fix specific arch issues.

See also: kivy#2073
opacam added a commit to opacam/python-for-android that referenced this pull request Mar 30, 2020
So our matrix gh-actions builds will not be cancelled if some arch fails
which is very useful to fix specific arch issues.

See also: kivy#2073
inclement pushed a commit that referenced this pull request Mar 31, 2020
* 📦 Refactor (move) `PythonTestMixIn` into `tests.mixin`

* 📦 Unify most of the test apps into one app

So depending on the supplied recipes, a different test app will be ran.

The supported test apps are:
  - kivy
  - flask
  - no-gui

* 🏗️ Make test app `on_device_unit_tests` the default...

for our CI providers and `rebuild_updated_recipes.py` because we recently removed
the old test app that we made use of.

* 📝 Update docs

* ✅ Create a `x86_64` testapp for gh-actions

* 📝 Fix typo errors and...

Remove sentence regarding python2 compatibility...
because python2 it's almost at the end of his life

* ✅ Make a `flask` testapp...

So we can get an apk via gh-actions

Notes:
  - this way the reviewers can install the flask apk without making the build
  - these changes will be reverted in the next
    commit...since we want a kivy app as our default)

* ✅ Revert "Make a `flask` testapp..."

This reverts commit 0ed4d70.

* 🔥 Remove `orientation` kwarg...

in case that we detect that p4a will build an `service_only` app.

Note: if we don't do this we wil get errors once we try to create our apk with the target distribution

* ✅ Create a `x86` testapp for gh-actions

and change gh-actions job title (because it looks better)

* 🏗️ Rename test app

Because it looks better and is more readable.

* 📝 Fix a syntactical error at docstring

* 🚚 Rename `setup_test_app.py` to `setup.py`

Because reducing filename to `setup.py` will make our cli arguments shorter and source code cleaner

* 🔧 Disable gh-actions `fail-fast`

So our matrix gh-actions builds will not be cancelled if some arch fails
which is very useful to fix specific arch issues.

See also: #2073

* 💚 Add `testapps-with-numpy/%` & ...

make `testapps/%` support multiple archs

Notes: this completes the job started at 9ea53fc & afd4413
zworkb pushed a commit to zworkb/python-for-android that referenced this pull request Apr 15, 2020
* 📦 Refactor (move) `PythonTestMixIn` into `tests.mixin`

* 📦 Unify most of the test apps into one app

So depending on the supplied recipes, a different test app will be ran.

The supported test apps are:
  - kivy
  - flask
  - no-gui

* 🏗️ Make test app `on_device_unit_tests` the default...

for our CI providers and `rebuild_updated_recipes.py` because we recently removed
the old test app that we made use of.

* 📝 Update docs

* ✅ Create a `x86_64` testapp for gh-actions

* 📝 Fix typo errors and...

Remove sentence regarding python2 compatibility...
because python2 it's almost at the end of his life

* ✅ Make a `flask` testapp...

So we can get an apk via gh-actions

Notes:
  - this way the reviewers can install the flask apk without making the build
  - these changes will be reverted in the next
    commit...since we want a kivy app as our default)

* ✅ Revert "Make a `flask` testapp..."

This reverts commit 0ed4d70.

* 🔥 Remove `orientation` kwarg...

in case that we detect that p4a will build an `service_only` app.

Note: if we don't do this we wil get errors once we try to create our apk with the target distribution

* ✅ Create a `x86` testapp for gh-actions

and change gh-actions job title (because it looks better)

* 🏗️ Rename test app

Because it looks better and is more readable.

* 📝 Fix a syntactical error at docstring

* 🚚 Rename `setup_test_app.py` to `setup.py`

Because reducing filename to `setup.py` will make our cli arguments shorter and source code cleaner

* 🔧 Disable gh-actions `fail-fast`

So our matrix gh-actions builds will not be cancelled if some arch fails
which is very useful to fix specific arch issues.

See also: kivy#2073

* 💚 Add `testapps-with-numpy/%` & ...

make `testapps/%` support multiple archs

Notes: this completes the job started at 9ea53fc & afd4413
@iruriksl
Copy link

iruriksl commented May 28, 2021

The issue is still persistent as I faced it while building for armeabi-v7a & arm64-v8a android arch using buildozer, which is as the results are also crossed in checks link of the post.
I m using python==3.8.2, buildozer==1.2.0.dev0, kivy==2.0.0 on MacOS==11.3.1

Is their any work around for mentioned arch till?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants