Skip to content

Commit 8cf66cc

Browse files
authored
Merge pull request #2111 from kivy/release-2020.03.30
Release 2020.03.30
2 parents 52abfe9 + c78a90d commit 8cf66cc

File tree

86 files changed

+1493
-459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1493
-459
lines changed

.env

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# used by coveralls.io, refs:
2+
# https://coveralls-python.readthedocs.io/en/latest/usage/tox.html#travisci
3+
CI
4+
TRAVIS
5+
TRAVIS_BRANCH
6+
TRAVIS_JOB_ID
7+
TRAVIS_PULL_REQUEST

.github/workflows/push.yml

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Unit tests & Build Testapp
2+
3+
on: ['push', 'pull_request']
4+
5+
jobs:
6+
7+
flake8:
8+
name: Flake8 tests
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout python-for-android
12+
uses: actions/checkout@v2
13+
- name: Set up Python 3.7
14+
uses: actions/[email protected]
15+
with:
16+
python-version: 3.7
17+
- name: Run flake8
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install tox>=2.0
21+
tox -e pep8
22+
23+
test:
24+
name: Pytest [Python ${{ matrix.python-version }} | ${{ matrix.os }}]
25+
needs: flake8
26+
runs-on: ${{ matrix.os }}
27+
strategy:
28+
matrix:
29+
python-version: [3.6, 3.7]
30+
os: [ubuntu-latest, macOs-latest]
31+
steps:
32+
- name: Checkout python-for-android
33+
uses: actions/checkout@v2
34+
- name: Set up Python ${{ matrix.python-version }}
35+
uses: actions/[email protected]
36+
with:
37+
python-version: ${{ matrix.python-version }}
38+
- name: Tox tests
39+
run: |
40+
python -m pip install --upgrade pip
41+
pip install tox>=2.0
42+
make test
43+
44+
build:
45+
name: Build testapp
46+
needs: [flake8]
47+
runs-on: ubuntu-latest
48+
strategy:
49+
matrix:
50+
build-arch: ['arm64-v8a', 'armeabi-v7a']
51+
steps:
52+
- name: Checkout python-for-android
53+
uses: actions/checkout@v2
54+
- name: Pull docker image
55+
run: |
56+
make docker/pull
57+
- name: Build apk for Python 3 ${{ matrix.build-arch }}
58+
run: |
59+
mkdir -p apks
60+
make docker/run/make/with-artifact/testapps/python3/${{ matrix.build-arch }}
61+
- uses: actions/upload-artifact@v1
62+
with:
63+
name: bdisttest_python3_sqlite_openssl_googlendk__${{ matrix.build-arch }}-debug-1.1.apk
64+
path: apks
65+
66+
rebuild_updated_recipes:
67+
name: Test updated recipes
68+
needs: [flake8]
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Checkout python-for-android (current branch)
72+
uses: actions/checkout@v2
73+
- name: Checkout python-for-android (develop branch)
74+
uses: actions/checkout@v2
75+
with:
76+
ref: 'develop'
77+
- name: Pull docker image
78+
run: |
79+
make docker/pull
80+
- name: Rebuild updated recipes
81+
run: |
82+
make docker/run/make/rebuild_updated_recipes

.travis.yml

+19-54
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
sudo: required
2-
3-
dist: xenial # needed for more recent python 3 and python3-venv
4-
51
language: generic
62

73
stages:
8-
- lint
9-
- test
4+
- unit tests
5+
- build testapps
106

117
services:
128
- docker
@@ -18,8 +14,8 @@ before_install:
1814

1915
jobs:
2016
include:
21-
- &linting
22-
stage: lint
17+
- &unittests
18+
stage: unit tests
2319
language: python
2420
python: 3.7
2521
before_script:
@@ -36,66 +32,35 @@ jobs:
3632
- pip3.7 install pyOpenSSL
3733
- pip3.7 install coveralls
3834
script:
39-
# we want to fail fast on tox errors without having to `docker build` first
35+
# ignores test_pythonpackage.py since it runs for too long
4036
- tox -- tests/ --ignore tests/test_pythonpackage.py
41-
# (we ignore test_pythonpackage.py since these run way too long!!
42-
# test_pythonpackage_basic.py will still be run.)
4337
name: "Tox Pep8"
4438
env: TOXENV=pep8
45-
- <<: *linting
39+
- <<: *unittests
4640
name: "Tox Python 2"
4741
env: TOXENV=py27
48-
- <<: *linting
42+
- <<: *unittests
4943
name: "Tox Python 3 & Coverage"
5044
env: TOXENV=py3
5145
after_success:
5246
- coveralls
53-
54-
- &testing
55-
stage: test
56-
before_script:
57-
# build docker image
58-
- docker build --tag=p4a --file Dockerfile.py3 .
59-
# Run a background process to make sure that travis will not kill our tests in
60-
# case that the travis log doesn't produce any output for more than 10 minutes
61-
- while sleep 540; do echo "==== Still running (travis, don't kill me) ===="; done &
62-
script:
63-
- >
64-
docker run
65-
-e CI
66-
-e TRAVIS_JOB_ID
67-
-e TRAVIS_BRANCH
68-
-e ANDROID_SDK_HOME="/home/user/.android/android-sdk"
69-
-e ANDROID_NDK_HOME="/home/user/.android/android-ndk"
70-
p4a /bin/sh -c "$COMMAND"
71-
after_script:
72-
# kill the background process started before run docker
73-
- kill %1
74-
name: Python 3 arm64-v8a
75-
# overrides requirements to skip `peewee` pure python module, see:
76-
# https://github.com/kivy/python-for-android/issues/1263#issuecomment-390421054
77-
env:
78-
COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3_sqlite_openssl.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements libffi,sdl2,pyjnius,kivy,python3,openssl,requests,sqlite3,setuptools --arch=arm64-v8a'
79-
- <<: *testing
47+
- &testapps
48+
name: Python 3 arm64-v8a (with numpy)
49+
stage: build testapps
50+
before_script: make docker/pull
51+
script: make docker/run/make/testapps/python3/arm64-v8a
52+
- <<: *testapps
8053
name: Python 3 armeabi-v7a
8154
os: osx
8255
osx_image: xcode11 # since xcode1.3, python3 is the default interpreter
8356
before_script:
8457
# installs java 1.8, android's SDK/NDK and p4a
8558
- make -f ci/makefiles/osx.mk
8659
- export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
87-
# Run a background process (like we do with linux tests)
88-
- while sleep 540; do echo "==== Still running (travis, don't kill me) ===="; done &
89-
script:
90-
- >
91-
cd testapps && python3 setup_testapp_python3_sqlite_openssl.py apk
92-
--sdk-dir $HOME/.android/android-sdk
93-
--ndk-dir $HOME/.android/android-ndk
94-
--requirements libffi,sdl2,pyjnius,kivy,python3,openssl,requests,sqlite3,setuptools
95-
--arch=armeabi-v7a
96-
- <<: *testing
97-
name: Python 2 armeabi-v7a (with numpy)
98-
env: COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2_sqlite_openssl.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --requirements sdl2,pyjnius,kivy,python2,openssl,requests,sqlite3,setuptools,numpy'
99-
- <<: *testing
60+
script: make testapps/python3/armeabi-v7a PYTHON_WITH_VERSION=python3
61+
- <<: *testapps
62+
name: Python 2 armeabi-v7a
63+
script: make docker/run/make/testapps/python2/armeabi-v7a
64+
- <<: *testapps
10065
name: Rebuild updated recipes
101-
env: COMMAND='. venv/bin/activate && ./ci/rebuild_updated_recipes.py'
66+
script: travis_wait 30 make docker/run/make/rebuild_updated_recipes

Dockerfile.py3

+61-37
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@ ENV LANG="en_US.UTF-8" \
2525
LANGUAGE="en_US.UTF-8" \
2626
LC_ALL="en_US.UTF-8"
2727

28-
RUN apt -y update -qq \
29-
&& apt -y install -qq --no-install-recommends curl unzip ca-certificates \
30-
&& apt -y autoremove
28+
RUN apt -y update -qq > /dev/null && apt -y install -qq --no-install-recommends \
29+
ca-certificates \
30+
curl \
31+
&& apt -y autoremove \
32+
&& apt -y clean \
33+
&& rm -rf /var/lib/apt/lists/*
3134

3235
# retry helper script, refs:
3336
# https://github.com/kivy/python-for-android/issues/1306
@@ -37,37 +40,53 @@ RUN curl https://raw.githubusercontent.com/kadwanev/retry/1.0.1/retry \
3740

3841
ENV USER="user"
3942
ENV HOME_DIR="/home/${USER}"
40-
ENV ANDROID_HOME="${HOME_DIR}/.android"
41-
ENV WORK_DIR="${HOME_DIR}" \
42-
PATH="${HOME_DIR}/.local/bin:${PATH}"
43+
ENV WORK_DIR="${HOME_DIR}/app" \
44+
PATH="${HOME_DIR}/.local/bin:${PATH}" \
45+
ANDROID_HOME="${HOME_DIR}/.android" \
46+
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
4347

44-
# install system dependencies
45-
RUN ${RETRY} apt -y install -qq --no-install-recommends \
46-
python3 virtualenv python3-pip python3-venv \
47-
wget lbzip2 patch sudo python python-pip \
48-
&& apt -y autoremove
4948

50-
# build dependencies
51-
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
49+
# install system dependencies
5250
RUN dpkg --add-architecture i386 \
53-
&& ${RETRY} apt -y update -qq \
51+
&& ${RETRY} apt -y update -qq > /dev/null \
5452
&& ${RETRY} apt -y install -qq --no-install-recommends \
55-
build-essential ccache git python3 python3-dev \
56-
libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
57-
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 \
58-
zip zlib1g-dev zlib1g:i386 \
59-
&& apt -y autoremove
60-
61-
# specific recipes dependencies (e.g. libffi requires autoreconf binary)
62-
RUN ${RETRY} apt -y install -qq --no-install-recommends \
63-
libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \
53+
autoconf \
54+
automake \
55+
autopoint \
56+
build-essential \
57+
ccache \
58+
cmake \
59+
gettext \
60+
git \
61+
lbzip2 \
62+
libffi-dev \
63+
libgtk2.0-0:i386 \
64+
libidn11:i386 \
65+
libltdl-dev \
66+
libncurses5:i386 \
67+
libpangox-1.0-0:i386 \
68+
libpangoxft-1.0-0:i386 \
69+
libstdc++6:i386 \
70+
libtool \
71+
openjdk-8-jdk \
72+
patch \
73+
pkg-config \
74+
python \
75+
python-pip \
76+
python3 \
77+
python3-dev \
78+
python3-pip \
79+
python3-venv \
80+
sudo \
81+
unzip \
82+
virtualenv \
83+
wget \
84+
zip \
85+
zlib1g-dev \
86+
zlib1g:i386 \
6487
&& apt -y autoremove \
65-
&& apt -y clean
66-
67-
# Install Java and set JAVA_HOME (to accept android's SDK licenses)
68-
RUN ${RETRY} apt -y install -qq --no-install-recommends openjdk-8-jdk \
69-
&& apt -y autoremove && apt -y clean
70-
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
88+
&& apt -y clean \
89+
&& rm -rf /var/lib/apt/lists/*
7190

7291
# prepare non root env
7392
RUN useradd --create-home --shell /bin/bash ${USER}
@@ -77,18 +96,23 @@ RUN usermod -append --groups sudo ${USER}
7796
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
7897

7998
# install cython for python 2 (for python 3 it's inside the venv)
80-
RUN pip2 install --upgrade Cython==0.28.6
99+
RUN pip2 install --upgrade Cython==0.28.6 \
100+
&& rm -rf ~/.cache/
81101

82102
WORKDIR ${WORK_DIR}
83-
COPY --chown=user:user . ${WORK_DIR}
84-
RUN mkdir ${ANDROID_HOME} && chown --recursive ${USER} ${ANDROID_HOME}
103+
RUN mkdir ${ANDROID_HOME} && chown --recursive ${USER} ${HOME_DIR} ${ANDROID_HOME}
85104
USER ${USER}
86105

87106
# Download and install android's NDK/SDK
88-
RUN make -f ci/makefiles/android.mk target_os=linux
107+
COPY ci/makefiles/android.mk /tmp/android.mk
108+
RUN make --file /tmp/android.mk target_os=linux \
109+
&& sudo rm /tmp/android.mk
89110

90111
# install python-for-android from current branch
91-
RUN virtualenv --python=python3 venv \
92-
&& . venv/bin/activate \
93-
&& pip3 install --upgrade Cython==0.28.6 \
94-
&& pip3 install -e .
112+
COPY --chown=user:user Makefile README.md setup.py pythonforandroid/__init__.py ${WORK_DIR}/
113+
RUN mkdir pythonforandroid \
114+
&& mv __init__.py pythonforandroid/ \
115+
&& make virtualenv \
116+
&& rm -rf ~/.cache/
117+
118+
COPY --chown=user:user . ${WORK_DIR}

0 commit comments

Comments
 (0)