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

WIP: Attempt to add Travis CI support #28

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ec50880
.travis.yml: Add stub for testing on Travis CI.
jakirkham Sep 15, 2015
ab0be30
.travis_scripts/test_qemu.sh: Add a script for testing on QEMU virtua…
jakirkham Sep 15, 2015
eba7903
.travis_scripts/test_qemu.sh: Change the test command.
jakirkham Sep 15, 2015
2b6f764
.travis.yml: Configure in the same way that was done here ( https://w…
jakirkham Sep 15, 2015
82c2bda
.travis.yml: Change QEMU installation and testing script path.
jakirkham Sep 15, 2015
87cc848
.travis.yml: Require `sudo`.
jakirkham Sep 15, 2015
dd3cb03
.travis.yml: Redirect build notifications to Fleep.
jakirkham Sep 15, 2015
1d67c6f
.travis_scripts/test_qemu.sh: Fix script to be called after setting u…
jakirkham Sep 15, 2015
f3ea011
.travis_scripts/test_qemu.sh: Update `apt-get` on the host as it is r…
jakirkham Sep 15, 2015
33784ce
.travis_scripts/test_qemu.sh: Run script with bash.
jakirkham Sep 15, 2015
53c18ec
.travis_scripts/test_qemu.sh: Made executable.
jakirkham Sep 15, 2015
f89af8b
.travis_scripts/test_qemu.sh: Get rid of sourced environment variable…
jakirkham Sep 15, 2015
0b5c240
.travis_scripts/test_qemu.sh: When testing, install the latest versio…
jakirkham Sep 15, 2015
6fc188d
.travis_scripts/test_qemu.sh: Install curl on the guest.
jakirkham Sep 15, 2015
9868ddf
.travis_scripts/test_qemu.sh: Cut out the guest dependencies that we …
jakirkham Sep 15, 2015
24836b6
.travis_scripts/test_qemu.sh: Try adding parentheses to make `curl` h…
jakirkham Sep 15, 2015
cecb5b4
.travis_scripts/test_qemu.sh: Require `setuptools` as a guest depende…
jakirkham Sep 15, 2015
092a3ce
.travis_scripts/test_qemu.sh: Simplify the testing command now that s…
jakirkham Sep 15, 2015
f001532
.travis_scripts/test_qemu.sh: Require pip just in case it is needed.
jakirkham Sep 15, 2015
cb69556
.travis_scripts/test_qemu.sh: Include the Python development package …
jakirkham Sep 15, 2015
71a1728
.travis_scripts/test_qemu.sh: Upgrade host packages.
jakirkham Sep 15, 2015
9ecec9e
.travis_scripts/test_qemu.sh: Make sure the guest updates by providin…
jakirkham Sep 15, 2015
3ec7845
.travis_scripts/test_qemu.sh: Upgrade the packages on the guest, as w…
jakirkham Sep 15, 2015
2eae074
.travis_scripts/test_qemu.sh: Drop setuptools and pip from the `apt-g…
jakirkham Sep 15, 2015
f79bc09
.travis_scripts/test_qemu.sh: Install `setuptools` for the guest alon…
jakirkham Sep 15, 2015
4411d66
.travis_scripts/test_qemu.sh: Install `pip` for the guest along with …
jakirkham Sep 15, 2015
ff93d1e
Revert ".travis_scripts/test_qemu.sh: Upgrade host packages."
jakirkham Sep 15, 2015
2c0a216
.travis_scripts/test_qemu.sh: Put `git` last in the guest dependency …
jakirkham Sep 15, 2015
1d70c99
setup.py: Add a hack to restrict `pbr` (required by `mock`) so as to …
jakirkham Sep 15, 2015
3ebe7e1
.travis_scripts/test_qemu.sh: Try setting `$LIBRARY_PATH` to pick up …
jakirkham Sep 15, 2015
58f197a
.travis_scripts/test_qemu.sh: Export `$LIBRARY_PATH` and the run the …
jakirkham Sep 15, 2015
3752c74
.travis_scripts/test_qemu.sh: Set the `$LIBRARY_PATH` before running …
jakirkham Sep 15, 2015
e95bc15
.travis.yml: Drop `x64` architecture as it is unneeded.
jakirkham Sep 15, 2015
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
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Borrowed from here ( https://www.tomaz.me/2013/12/02/running-travis-ci-tests-on-arm.html ).

sudo: required

language: c++

env:
- ARCH=arm

script:
- "bash -ex .travis_scripts/test_qemu.sh"

notifications:
email:
on_success: always
on_failure: always
recipients:
- [email protected]
74 changes: 74 additions & 0 deletions .travis_scripts/test_qemu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/bin/bash
# Based on a test script from avsm/ocaml repo https://github.com/avsm/ocaml
# Borrowed from here https://www.tomaz.me/2013/12/02/running-travis-ci-tests-on-arm.html

CHROOT_DIR=/tmp/arm-chroot
MIRROR=http://archive.raspbian.org/raspbian
VERSION=wheezy
CHROOT_ARCH=armhf

# Debian package dependencies for the host
HOST_DEPENDENCIES="debootstrap qemu-user-static binfmt-support sbuild"

# Debian package dependencies for the chrooted environment
GUEST_DEPENDENCIES="sudo curl python python-dev git"

# Command used to run the tests
# Try to pick up libmmal.so for picamera by specifying this path.
TEST_COMMAND="python setup.py test"

function setup_arm_chroot {
# Host dependencies
sudo apt-get update -y
sudo apt-get install -qq -y ${HOST_DEPENDENCIES}

# Create chrooted environment
sudo mkdir ${CHROOT_DIR}
sudo debootstrap --foreign --no-check-gpg --include=fakeroot,build-essential \
--arch=${CHROOT_ARCH} ${VERSION} ${CHROOT_DIR} ${MIRROR}
sudo cp /usr/bin/qemu-arm-static ${CHROOT_DIR}/usr/bin/
sudo chroot ${CHROOT_DIR} ./debootstrap/debootstrap --second-stage
sudo sbuild-createchroot --arch=${CHROOT_ARCH} --foreign --setup-only \
${VERSION} ${CHROOT_DIR} ${MIRROR}

# Create file with environment variables which will be used inside chrooted
# environment
echo "export ARCH=${ARCH}" > envvars.sh
echo "export TRAVIS_BUILD_DIR=${TRAVIS_BUILD_DIR}" >> envvars.sh
chmod a+x envvars.sh

# Install dependencies inside chroot
sudo chroot ${CHROOT_DIR} apt-get update -y
sudo chroot ${CHROOT_DIR} apt-get upgrade -y
sudo chroot ${CHROOT_DIR} apt-get --allow-unauthenticated install \
-qq -y ${GUEST_DEPENDENCIES}
sudo chroot ${CHROOT_DIR} bash -c 'curl https://bootstrap.pypa.io/ez_setup.py | python'
sudo chroot ${CHROOT_DIR} bash -c 'curl https://bootstrap.pypa.io/get-pip.py | python'

# Create build dir and copy travis build files to our chroot environment
sudo mkdir -p ${CHROOT_DIR}/${TRAVIS_BUILD_DIR}
sudo rsync -av ${TRAVIS_BUILD_DIR}/ ${CHROOT_DIR}/${TRAVIS_BUILD_DIR}/

# Indicate chroot environment has been set up
sudo touch ${CHROOT_DIR}/.chroot_is_done

# Call ourselves again which will cause tests to run
sudo chroot ${CHROOT_DIR} bash -c "cd ${TRAVIS_BUILD_DIR} && bash .travis_scripts/test_qemu.sh"
}

if [ -e "/.chroot_is_done" ]; then
# We are inside ARM chroot
echo "Running inside chrooted environment"
else
if [ "${ARCH}" = "arm" ]; then
# ARM test run, need to set up chrooted environment first
echo "Setting up chrooted ARM environment"
setup_arm_chroot
fi
fi

echo "Running tests"
echo "Environment: $(uname -a)"

export LIBRARY_PATH=/opt/vc/lib
${TEST_COMMAND}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
packages=find_packages(exclude=["tests*"]),
cmdclass=versioneer.get_cmdclass(),
install_requires=["picamera >=1.0", "RPi.GPIO >=0.5.11"],
tests_require=["nose", "mock"],
tests_require=["nose", "mock", "pbr <1.7.0"],
test_suite="nose.collector",
zip_safe=True
)
Expand Down