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

Add Dockerfiles for testing, fix tests and style #408

Merged
merged 22 commits into from
Jul 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
77b1bf8
Add common module for testing
KeyWeeUsr Jul 5, 2018
a1741d2
Fix and extend test for plyer.battery
KeyWeeUsr Jul 6, 2018
a9c73ce
Add Dockerfiles, script to run and edit .travis.yml configuration
KeyWeeUsr Jul 8, 2018
3245085
Fix missing __init__.py for plyer.tests.common module, merge apt upda…
KeyWeeUsr Jul 9, 2018
b147845
Fix LANG default for env vars, convert str to float when LC_NUMERIC u…
KeyWeeUsr Jul 9, 2018
7ececb6
Fix style issues in plyer.battery related modules
KeyWeeUsr Jul 9, 2018
5b0c70a
Fix test for NotifySendNotification
KeyWeeUsr Jul 11, 2018
61a1f44
Fix test for WindowsNotification
KeyWeeUsr Jul 11, 2018
7e530f0
Fix test for NotifyDbus
KeyWeeUsr Jul 11, 2018
32f8e2c
Fix style issues in plyer.battery + plyer.notification related modules
KeyWeeUsr Jul 14, 2018
ec0731e
Fix CRLF/LF for entrypoint.sh with gitattributes
KeyWeeUsr Jul 14, 2018
895077d
Fix test for facades/Proxy
KeyWeeUsr Jul 15, 2018
367192d
Disable py3 only classes style warning
KeyWeeUsr Jul 17, 2018
9f6e4e9
Fix style issues in test_facade and related modules
KeyWeeUsr Jul 17, 2018
8ff67a0
Fix test for WindowsEmail
KeyWeeUsr Jul 17, 2018
b540740
Fix style issues in plyer.email and related modules
KeyWeeUsr Jul 21, 2018
9890284
Fix test for WinUniqueID
KeyWeeUsr Jul 24, 2018
8c3e967
Fix style issues in plyer.uniqueid and related modules
KeyWeeUsr Jul 24, 2018
c7e2114
Add missing package to Dockerfiles, fix .travis.yml instructions, add…
KeyWeeUsr Jul 24, 2018
9aaea6e
Fix winreg ImportError in test_uniqueid
KeyWeeUsr Jul 30, 2018
3ac0385
Simplify .travis.yml, comments, depth = 1, fix test_facade on py3 osx
KeyWeeUsr Jul 30, 2018
7b327ba
Fix appveyor jobs for testing
KeyWeeUsr Jul 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text=auto eol=lf
294 changes: 143 additions & 151 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,176 +1,168 @@
matrix:
fast_finish: true
include:
- language: python
python: 2.7
env: RUN=unit
os: linux
dist: trusty

- language: python
python: 3.5
env: RUN=unit COVERALLS=1
os: linux
dist: trusty

- language: python
python: 3.5
env: RUN=pep8
os: linux
dist: trusty

- language: generic
env: RUN=unit PY=2
os: osx

- language: generic
env: RUN=unit PY=3
os: osx


before_install:
# https://github.com/travis-ci/travis-ci/issues/6307
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then

rvm get head;
sudo: required

fi;
services:
- docker

git:
depth: 1

install:
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
if [ "${RUN}" == "pep8" ]; then

python -m pip install pycodestyle;

fi;
if [ "${RUN}" != "pep8" ]; then

echo "[YML] Necessary build stuff";
matrix:
fast_finish: true
include:
- env: DOCK=1 PY=2 RUN=unit
python: 2.7
os: linux
dist: trusty

sudo add-apt-repository ppa:fkrull/deadsnakes -y;
sudo apt-get update;
sudo apt-get -y install --reinstall
python-setuptools
python-dev
python3.5-dev;
python -m pip install --upgrade nose coveralls;
- env: DOCK=1 PY=3 RUN=unit COVERALLS=1
python: 3.5
os: linux
dist: trusty

echo "[YML] plyer.notification deps";
echo "[YML] * plyer.notification.NotifyDbus";
sudo apt-get -y install python-dbus python3-dbus
- env: DOCK=1 PY=3 RUN=style
python: 3.5
os: linux
dist: trusty

echo "[YML] * plyer.notification.NotifySendNotification";
sudo apt-get -y install libnotify-bin;
- language: generic
env: RUN=unit PY=2 HOMEBREW_NO_AUTO_UPDATE=1
os: osx

echo "[YML] * Fixing DBusException";
echo "[YML] * org.freedesktop.DBus.Error.ServiceUnknown";
echo "[YML] * The name org.freedesktop.Notifications was not provided";
sudo apt-get -y install --reinstall notification-daemon notify-osd;
- language: generic
env: RUN=unit PY=3 HOMEBREW_NO_AUTO_UPDATE=1
os: osx

echo "[YML] plyer.battery deps";
sudo apt-get install upower;

before_install:
- echo PATH=$PATH;

# uninstall old GNUpg, install new one and add Brew
# 'Cellar' folder to the path (contains binaries)
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
brew uninstall gnupg;
brew install gnupg2;
sudo ln -sv /usr/local/Cellar/gnupg /usr/local/Cellar/gpg || true;
sudo ln -sv /usr/local/Cellar/gnupg /usr/local/Cellar/gpg2 || true;
export PATH=$PATH:/usr/local/Cellar;
fi;
fi;

- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then

ariagh=https://github.com/aria2/aria2/releases/download/release-1.29.0/;
ariadmg=aria2-1.29.0-osx-darwin.dmg;
pyftp=https://www.python.org/ftp/python/3.5.2/;
py3pkg=python-3.5.2-macosx10.6.pkg;
curl -O -L $ariagh$ariadmg;

hdiutil attach aria2-1.29.0-osx-darwin.dmg;
sudo installer -package "/Volumes/aria2 1.29.0 Intel/aria2.pkg" -target /;

if [ "${PY}" == "3" ]; then

curl -O -L $pyftp$py3pkg;
sudo installer -package python-3.5.2-macosx10.6.pkg -target /;

pip3 install --upgrade --user nose cython;
pip3 install https://github.com/kivy/pyobjus/zipball/master;

else
pip install --upgrade --user nose cython;
pip install https://github.com/kivy/pyobjus/zipball/master;

# https://github.com/travis-ci/travis-ci/issues/6307
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then
curl -sSL https://rvm.io/mpapis.asc | gpg --import -;
rvm get head;
fi;
fi;


before_script:
- if [ "${TRAVIS_OS_NAME}" == "linux" ] && [ "${RUN}" != "pep8" ]; then

export DISPLAY=:99.0;
/sbin/start-stop-daemon
--start
--quiet
--pidfile /tmp/custom_xvfb_99.pid
--make-pidfile
--background
--exec /usr/bin/Xvfb --
:99
-screen 0 1280x720x24
-ac +extension GLX;

export PYTHONPATH=$PYTHONPATH:$(pwd);

fi;


script:
- python -m pip install .

# setup dummies before running tests
# nose throws stuff to globals and won't clean up afterwards
- python ./plyer/tests/dummy_setup.py

- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then

set -ex;
if [ "${RUN}" == "unit" ]; then

python -m nose.core -s ./plyer/tests --with-coverage;

install:
# build docker images
- if [ "${TRAVIS_OS_NAME}" == "linux" ] && [ -v DOCK ]; then
if [ "$PY" == "2" ]; then
docker build
--tag plyer:py2
--file Dockerfile.trusty.py2
"$(pwd)";
elif [ "$PY" == "3" ]; then
docker build
--tag plyer:py3
--file Dockerfile.trusty.py3
"$(pwd)";

docker build
--tag plyer:style
--file Dockerfile.trusty.style
"$(pwd)";
fi;
fi;
if [ "${RUN}" == "pep8" ]; then

pycodestyle "$(pwd)"
--exclude=pep8.py,compat.py,utils.py
--ignore=E402,W503;
# get Py3 because it's not present in any OSX image on Travis
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
pyftp=https://www.python.org/ftp/python/3.5.4/;
py3pkg=python-3.5.4rc1-macosx10.6.pkg;

if [ "${PY}" == "3" ]; then
curl -O -L $pyftp$py3pkg;
sudo installer -package $py3pkg -target /;
fi;
fi;
if [ "${COVERALLS}" == "1" ] && [ "${TRAVIS_BRANCH}" == "master" ]; then

coveralls;

# manual get-pip.py on OSX because TLS1.2+ required
# pyfound.blogspot.com/2017/01/time-to-upgrade-your-python-tls-v12.html
# and install to virtualenv
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py;
if [ "${PY}" == "3" ]; then
sudo python3 get-pip.py;
else
sudo python get-pip.py;
fi;

if [ "${PY}" == "3" ]; then
pip3 install --user virtualenv;
python3 -m virtualenv env;
else
pip install --user virtualenv;
python -m virtualenv env;
fi;

source env/bin/activate;
pip install --upgrade --requirement devrequirements.txt;
pip install https://github.com/kivy/pyobjus/zipball/master;
fi;
fi;

- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then

set -ex;
if [ "${PY}" == "3" ]; then

python3 -m nose.core ./plyer/tests;

else
python -m nose.core ./plyer/tests;

script:
# run containers from images
- if [ "${TRAVIS_OS_NAME}" == "linux" ] && [ -v DOCK ]; then
if [ "$PY" == "2" ] && [ "$RUN" == "unit" ]; then
docker run
--interactive
--tty
plyer:py2;

elif [ "$PY" == "3" ] && [ "$RUN" == "unit" ]; then
if [ "${COVERALLS}" == "1" ]; then
docker run
--interactive
--tty
--env COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN
--env COVERALLS_SERVICE_NAME=travis-ci
--env TRAVIS_JOB_ID=$TRAVIS_JOB_ID
--env TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST
plyer:py3;

else
docker run
--interactive
--tty
plyer:py3;
fi;

elif [ "$PY" == "3" ] && [ "$RUN" == "style" ]; then
docker run
--interactive
--tty
plyer:style;
fi;
fi;

# test_facade.py fails to reload modules when run
# on Travis OSX images in Py3 yet works properly
# on Windows, Linux and OSX devices
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
if [ "$PY" == "3" ]; then
rm ./plyer/tests/test_facade.py;
fi;
pip install --editable .;
nosetests
--stop
--nocapture
./plyer/tests;
fi;
fi;

# remove dummies and return to previous state
- python ./plyer/tests/dummy_teardown.py


notifications:
webhooks:
urls:
- https://kivy.org:5000/travisevent
on_success: always
on_failure: always
on_start: always
webhooks:
urls:
- https://kivy.org:5000/travisevent
on_success: always
on_failure: always
on_start: always
37 changes: 37 additions & 0 deletions Dockerfile.trusty.py2
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM ubuntu:trusty-20180531

ENV APP_DIR=/app
RUN mkdir $APP_DIR
WORKDIR $APP_DIR
ENV PYTHONPATH=$PYTHONPATH:$(pwd)

# install default packages
RUN apt-get update && \
apt-get -y --force-yes install \
python-setuptools \
python-dev \
openjdk-7-jdk \
lshw \
wget \
git \
&& apt-get -y autoremove \
&& apt-get -y clean

# install PIP
RUN wget https://bootstrap.pypa.io/2.6/get-pip.py -O get-pip2.py
RUN python -V && \
python get-pip2.py && \
rm get-pip2.py && \
python -m pip install --upgrade pip

# install dev packages
COPY devrequirements.txt .
RUN python -m pip install \
--upgrade \
--requirement devrequirements.txt
RUN python -m pip install \
https://github.com/kivy/pyjnius/zipball/master

COPY . $APP_DIR
RUN python -m pip install .
ENTRYPOINT ["/app/entrypoint.sh", "py2"]
Loading