Skip to content

Commit bdd0cd2

Browse files
committed
[travis] Implement build stages
To: - be neatest - modernize travis config - send coverage reports only if we succeed with all tests (instead of sending it in each successful test) As a side note: I would like to mention that if the rebuild_updated_recipes test fails and we merge a pr with a red cross in our CI tests...then we would have an outdated coverage for a little while (until we merge a pr/commit with a green tick mark for the CI tests)
1 parent af728d9 commit bdd0cd2

File tree

1 file changed

+51
-25
lines changed

1 file changed

+51
-25
lines changed

.travis.yml

Lines changed: 51 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,20 @@ dist: xenial # needed for more recent python 3 and python3-venv
44

55
language: generic
66

7+
stages:
8+
- lint
9+
- test
10+
- deploy
11+
712
services:
813
- docker
914

1015
before_install:
1116
- travis_retry sudo apt update -qq
1217
# to successfully send the coveralls reports we need pyOpenSSL
13-
- travis_retry sudo apt install -qq --no-install-recommends python2.7 python3 python3-venv python3-virtualenv python3-setuptools python3-pip python3-openssl
18+
- travis_retry sudo apt install -qq --no-install-recommends
19+
python2.7 python3 python3-venv python3-virtualenv python3-pip
20+
python3-setuptools python3-openssl
1421
# (venv/virtualenv are both used by tests/test_pythonpackage.py)
1522
- sudo pip install tox>=2.0
1623
- sudo pip3 install coveralls
@@ -22,27 +29,46 @@ env:
2229
global:
2330
- ANDROID_SDK_HOME=/opt/android/android-sdk
2431
- ANDROID_NDK_HOME=/opt/android/android-ndk
25-
matrix:
26-
- 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'
27-
# overrides requirements to skip `peewee` pure python module, see:
28-
# https://github.com/kivy/python-for-android/issues/1263#issuecomment-390421054
29-
- 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'
30-
- COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --bootstrap sdl2 --requirements python2,numpy'
31-
# builds only the recipes that moved
32-
- COMMAND='. venv/bin/activate && ./ci/rebuild_updated_recipes.py'
33-
34-
before_script:
35-
# we want to fail fast on tox errors without having to `docker build` first
36-
- tox -- tests/ --ignore tests/test_pythonpackage.py
37-
# (we ignore test_pythonpackage.py since these run way too long!! test_pythonpackage_basic.py will still be run.)
38-
39-
script:
40-
# Run a background process to make sure that travis will not kill our tests in
41-
# case that the travis log doesn't produce any output for more than 10 minutes
42-
- while sleep 540; do echo "==== Still running (travis, don't kill me) ===="; done &
43-
- docker build --tag=p4a --file Dockerfile.py3 .
44-
- docker run -e CI -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" -e TRAVIS_BRANCH="$TRAVIS_BRANCH" p4a /bin/sh -c "$COMMAND"
45-
# kill the background process started before run docker
46-
- kill %1
47-
after_success:
48-
- coveralls
32+
33+
jobs:
34+
include:
35+
- stage: lint
36+
name: "Tox tests"
37+
script:
38+
# we want to fail fast on tox errors without having to `docker build` first
39+
- tox -- tests/ --ignore tests/test_pythonpackage.py
40+
# (we ignore test_pythonpackage.py since these run way too long!!
41+
# test_pythonpackage_basic.py will still be run.)
42+
43+
- &testing
44+
stage: test
45+
before_script:
46+
# build docker image
47+
- docker build --tag=p4a --file Dockerfile.py3 .
48+
# Run a background process to make sure that travis will not kill our tests in
49+
# case that the travis log doesn't produce any output for more than 10 minutes
50+
- while sleep 540; do echo "==== Still running (travis, don't kill me) ===="; done &
51+
script:
52+
- docker run -e CI -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" -e TRAVIS_BRANCH="$TRAVIS_BRANCH" p4a /bin/sh -c "$COMMAND"
53+
after_script:
54+
# kill the background process started before run docker
55+
- kill %1
56+
name: Python 3 basic
57+
# overrides requirements to skip `peewee` pure python module, see:
58+
# https://github.com/kivy/python-for-android/issues/1263#issuecomment-390421054
59+
env: 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'
60+
- <<: *testing
61+
name: Python 2 basic
62+
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'
63+
- <<: *testing
64+
name: Python 2 numpy
65+
env: COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2.py apk --sdk-dir $ANDROID_SDK_HOME --ndk-dir $ANDROID_NDK_HOME --bootstrap sdl2 --requirements python2,numpy'
66+
- <<: *testing
67+
name: Rebuild updated recipes
68+
env: COMMAND='. venv/bin/activate && ./ci/rebuild_updated_recipes.py'
69+
70+
- stage: deploy
71+
script: echo "All done"
72+
name: "Send coverage report"
73+
after_success:
74+
- coveralls

0 commit comments

Comments
 (0)