Skip to content
Permalink
Browse files

Moved CI tests to Ubuntu 18.04 on Docker (#336)

  • Loading branch information...
joachimmetz committed May 4, 2019
1 parent ba4c803 commit ebee933d4cd99bff64d8b51f078917e40d54cec5
@@ -1,35 +1,15 @@
matrix:
include:
- name: "Pylint on Ubuntu Xenial (16.04) with Python 3.5"
env: TARGET="pylint"
- name: "Pylint on Ubuntu Bionic (18.04) (Docker) with Python 3.6"
env: [TARGET="pylint", UBUNTU_VERSION="18.04"]
os: linux
dist: xenial
sudo: required
group: edge
language: python
python: 3.5
virtualenv:
system_site_packages: true
- name: "Ubuntu Xenial (16.04) with Python 2.7"
env: TARGET="linux-python27"
os: linux
dist: xenial
sudo: required
group: edge
language: python
python: 2.7
virtualenv:
system_site_packages: true
- name: "Ubuntu Xenial (16.04) with Python 3.5"
env: TARGET="linux-python35"
os: linux
dist: xenial
sudo: required
group: edge
language: python
python: 3.5
virtualenv:
system_site_packages: true
python: 3.6
services:
- docker
- name: "Fedora Core 29 (Docker) with Python 2.7"
env: FEDORA_VERSION="29"
os: linux
@@ -51,7 +31,7 @@ matrix:
services:
- docker
- name: "Ubuntu Bionic (18.04) (Docker) with Python 2.7"
env: UBUNTU_VERSION="18.04"
env: [TARGET="coverage", UBUNTU_VERSION="18.04"]
os: linux
dist: xenial
sudo: required
@@ -129,6 +109,3 @@ install:
- ./config/travis/install.sh
script:
- ./config/travis/run_with_timeout.sh 30 ./config/travis/runtests.sh
after_success:
- if ! test -f /usr/bin/coverage; then sudo ln -s /usr/bin/python-coverage /usr/bin/coverage; fi
- if test ${TARGET} = "linux-python27"; then curl -o codecov.sh -s https://codecov.io/bash && /bin/bash ./codecov.sh; fi
@@ -2,7 +2,7 @@ Source: artifacts
Section: python
Priority: extra
Maintainer: Forensic artifacts <forensicartifacts@googlegroups.com>
Build-Depends: debhelper (>= 9), python-all (>= 2.7~), python-setuptools, python3-all (>= 3.4~), python3-setuptools
Build-Depends: debhelper (>= 9), dh-python, python-all (>= 2.7~), python-setuptools, python3-all (>= 3.4~), python3-setuptools
Standards-Version: 3.9.5
X-Python-Version: >= 2.7
X-Python3-Version: >= 3.4
@@ -11,19 +11,19 @@ L2TBINARIES_TEST_DEPENDENCIES="funcsigs mock pbr six";

DPKG_PYTHON2_DEPENDENCIES="python-yaml";

DPKG_PYTHON2_TEST_DEPENDENCIES="python-coverage python-funcsigs python-mock python-pbr python-six";
DPKG_PYTHON2_TEST_DEPENDENCIES="python-coverage python-funcsigs python-mock python-pbr python-setuptools python-six";

DPKG_PYTHON3_DEPENDENCIES="python3-yaml";

DPKG_PYTHON3_TEST_DEPENDENCIES="python3-mock python3-pbr python3-setuptools python3-six";
DPKG_PYTHON3_TEST_DEPENDENCIES="python3-distutils python3-mock python3-pbr python3-setuptools python3-six";

RPM_PYTHON2_DEPENDENCIES="python2-pyyaml";

RPM_PYTHON2_TEST_DEPENDENCIES="python2-funcsigs python2-mock python2-pbr python2-six";
RPM_PYTHON2_TEST_DEPENDENCIES="python2-funcsigs python2-mock python2-pbr python2-setuptools python2-six";

RPM_PYTHON3_DEPENDENCIES="python3-pyyaml";

RPM_PYTHON3_TEST_DEPENDENCIES="python3-mock python3-pbr python3-six";
RPM_PYTHON3_TEST_DEPENDENCIES="python3-mock python3-pbr python3-setuptools python3-six";

# Exit on error.
set -e;
@@ -58,20 +58,31 @@ then

docker run --name=${CONTAINER_NAME} --detach -i registry.fedoraproject.org/fedora:${FEDORA_VERSION};

# Install dnf-plugins-core.
docker exec ${CONTAINER_NAME} dnf install -y dnf-plugins-core;

# Add additional dnf repositories.
docker exec ${CONTAINER_NAME} dnf copr -y enable @gift/dev;

if test -n "${TOXENV}";
then
docker exec ${CONTAINER_NAME} dnf install -y python3-tox;
RPM_PACKAGES="python3-tox";

elif test ${TRAVIS_PYTHON_VERSION} = "2.7";
then
docker exec ${CONTAINER_NAME} dnf install -y git python2 ${RPM_PYTHON2_DEPENDENCIES} ${RPM_PYTHON2_TEST_DEPENDENCIES};
else
docker exec ${CONTAINER_NAME} dnf install -y git python3 ${RPM_PYTHON3_DEPENDENCIES} ${RPM_PYTHON3_TEST_DEPENDENCIES};
RPM_PACKAGES="";

if test ${TARGET} = "pylint";
then
RPM_PACKAGES="${RPM_PACKAGES} findutils pylint";
fi
if test ${TRAVIS_PYTHON_VERSION} = "2.7";
then
RPM_PACKAGES="${RPM_PACKAGES} python2 ${RPM_PYTHON2_DEPENDENCIES} ${RPM_PYTHON2_TEST_DEPENDENCIES}";
else
RPM_PACKAGES="${RPM_PACKAGES} python3 ${RPM_PYTHON3_DEPENDENCIES} ${RPM_PYTHON3_TEST_DEPENDENCIES}";
fi
fi
docker exec ${CONTAINER_NAME} dnf install -y ${RPM_PACKAGES};

docker cp ../artifacts ${CONTAINER_NAME}:/

@@ -83,51 +94,54 @@ then

docker run --name=${CONTAINER_NAME} --detach -i ubuntu:${UBUNTU_VERSION};

# Install add-apt-repository and locale-gen.
docker exec ${CONTAINER_NAME} apt-get update -q;
docker exec ${CONTAINER_NAME} sh -c "DEBIAN_FRONTEND=noninteractive apt-get install -y locales software-properties-common";

docker exec ${CONTAINER_NAME} add-apt-repository ppa:gift/dev -y;

docker exec ${CONTAINER_NAME} locale-gen en_US.UTF-8;
docker exec -e "DEBIAN_FRONTEND=noninteractive" ${CONTAINER_NAME} sh -c "apt-get install -y locales software-properties-common";

# Add additional apt repositories.
if test -n "${TOXENV}";
then
docker exec ${CONTAINER_NAME} add-apt-repository universe;
docker exec ${CONTAINER_NAME} add-apt-repository ppa:deadsnakes/ppa -y;

DPKG_PYTHON="python${TRAVIS_PYTHON_VERSION} python${TRAVIS_PYTHON_VERSION}-dev";

docker exec ${CONTAINER_NAME} sh -c "DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential ${DPKG_PYTHON} tox";

elif test ${TRAVIS_PYTHON_VERSION} = "2.7";
elif test ${TARGET} = "pylint";
then
docker exec ${CONTAINER_NAME} sh -c "DEBIAN_FRONTEND=noninteractive apt-get install -y git python ${DPKG_PYTHON2_DEPENDENCIES} ${DPKG_PYTHON2_TEST_DEPENDENCIES}";
else
docker exec ${CONTAINER_NAME} sh -c "DEBIAN_FRONTEND=noninteractive apt-get install -y git python3 ${DPKG_PYTHON3_DEPENDENCIES} ${DPKG_PYTHON3_TEST_DEPENDENCIES}";
docker exec ${CONTAINER_NAME} add-apt-repository ppa:gift/pylint3 -y;
fi
docker exec ${CONTAINER_NAME} add-apt-repository ppa:gift/dev -y;

docker cp ../artifacts ${CONTAINER_NAME}:/

elif test ${TRAVIS_OS_NAME} = "linux" && test ${TARGET} != "jenkins";
then
sudo rm -f /etc/apt/sources.list.d/travis_ci_zeromq3-source.list;

if test ${TARGET} = "pylint";
then
sudo add-apt-repository ppa:gift/pylint3 -y;
fi
docker exec ${CONTAINER_NAME} apt-get update -q;

sudo add-apt-repository ppa:gift/dev -y;
sudo apt-get update -q;
# Set locale to US English and UTF-8.
docker exec ${CONTAINER_NAME} locale-gen en_US.UTF-8;

if test ${TRAVIS_PYTHON_VERSION} = "2.7";
# Install packages.
if test -n "${TOXENV}";
then
sudo apt-get install -y ${DPKG_PYTHON2_DEPENDENCIES} ${DPKG_PYTHON2_TEST_DEPENDENCIES};
DPKG_PACKAGES="build-essential python${TRAVIS_PYTHON_VERSION} python${TRAVIS_PYTHON_VERSION}-dev tox";
else
sudo apt-get install -y ${DPKG_PYTHON3_DEPENDENCIES} ${DPKG_PYTHON3_TEST_DEPENDENCIES};
fi
if test ${TARGET} = "pylint";
then
sudo apt-get install -y pylint;
DPKG_PACKAGES="";

if test "${TARGET}" = "coverage";
then
DPKG_PACKAGES="${DPKG_PACKAGES} curl git";

elif test "${TARGET}" = "jenkins2" || test "${TARGET}" = "jenkins3";
then
DPKG_PACKAGES="${DPKG_PACKAGES} sudo";

elif test ${TARGET} = "pylint";
then
DPKG_PACKAGES="${DPKG_PACKAGES} python3-distutils pylint";
fi
if test ${TRAVIS_PYTHON_VERSION} = "2.7";
then
DPKG_PACKAGES="${DPKG_PACKAGES} python ${DPKG_PYTHON2_DEPENDENCIES} ${DPKG_PYTHON2_TEST_DEPENDENCIES}";
else
DPKG_PACKAGES="${DPKG_PACKAGES} python3 ${DPKG_PYTHON3_DEPENDENCIES} ${DPKG_PYTHON3_TEST_DEPENDENCIES}";
fi
fi
docker exec -e "DEBIAN_FRONTEND=noninteractive" ${CONTAINER_NAME} sh -c "apt-get install -y ${DPKG_PACKAGES}";

docker cp ../artifacts ${CONTAINER_NAME}:/
fi
@@ -0,0 +1,37 @@
#!/bin/bash
#
# Script to run Python 2 with code coverage tests on Travis-CI.
#
# This file is generated by l2tdevtools update-dependencies.py, any dependency
# related changes should be made in dependencies.ini.

# Exit on error.
set -e;

COVERAGE="/usr/bin/coverage";

if ! test -x "${COVERAGE}" && test -x "/usr/bin/python-coverage";
then
# Ubuntu has renamed coverage but codecov.sh depends on /usr/bin/coverage
ln -s /usr/bin/python-coverage /usr/bin/coverage;
fi
curl -o codecov.sh -s https://codecov.io/bash;

${COVERAGE} erase;

${COVERAGE} run --source=artifacts --omit="*_test*,*__init__*,*test_lib*" ./run_tests.py;

/bin/bash ./codecov.sh;

if test -f tests/end-to-end.py;
then
PYTHONPATH=. python2 ./tests/end-to-end.py --debug -c config/end-to-end.ini;
fi

python2 ./setup.py build

python2 ./setup.py sdist

python2 ./setup.py bdist

python2 ./setup.py install
@@ -0,0 +1,18 @@
#!/bin/bash
#
# Script to run pylint on Travis-CI.
#
# This file is generated by l2tdevtools update-dependencies.py, any dependency
# related changes should be made in dependencies.ini.

# Exit on error.
set -e;

pylint --version

for FILE in $(find setup.py artifacts config tests tools -name \*.py);
do
echo "Checking: ${FILE}";

pylint --rcfile=.pylintrc ${FILE};
done
@@ -0,0 +1,24 @@
#!/bin/bash
#
# Script to run Python 2 tests on Travis-CI.
#
# This file is generated by l2tdevtools update-dependencies.py, any dependency
# related changes should be made in dependencies.ini.

# Exit on error.
set -e;

python2 ./run_tests.py

if test -f tests/end-to-end.py;
then
PYTHONPATH=. python2 ./tests/end-to-end.py --debug -c config/end-to-end.ini;
fi

python2 ./setup.py build

python2 ./setup.py sdist

python2 ./setup.py bdist

python2 ./setup.py install
@@ -0,0 +1,24 @@
#!/bin/bash
#
# Script to run Python 3 tests on Travis-CI.
#
# This file is generated by l2tdevtools update-dependencies.py, any dependency
# related changes should be made in dependencies.ini.

# Exit on error.
set -e;

python3 ./run_tests.py

if test -f tests/end-to-end.py;
then
PYTHONPATH=. python3 ./tests/end-to-end.py --debug -c config/end-to-end.ini;
fi

python3 ./setup.py build

python3 ./setup.py sdist

python3 ./setup.py bdist

python3 ./setup.py install
Oops, something went wrong.

0 comments on commit ebee933

Please sign in to comment.
You can’t perform that action at this time.