[CRIU] [PATCH] criu: add .travis.yml
Andrew Vagin
avagin at parallels.com
Fri Sep 26 08:42:42 PDT 2014
On Fri, Sep 26, 2014 at 06:17:56PM +0400, Andrey Vagin wrote:
> """
> Travis CI is configured by adding a file named .travis.yml, which is a
> YAML format text file, to the root directory of the GitHub
> repository.[5]
>
> Travis CI automatically detects when a commit has been made and pushed
> to a GitHub repository that is using Travis CI, and each time this
> happens, it will try to build the project and run tests.
> """ https://en.wikipedia.org/wiki/Travis_CI
>
> Currently Travis CI builds criu for x86_64 and ARM
Here is an example https://travis-ci.org/avagin/criu/builds/36360115
>
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
> .travis-ci.sh | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> .travis.yml | 11 ++++++++++
> 2 files changed, 81 insertions(+)
> create mode 100755 .travis-ci.sh
> create mode 100644 .travis.yml
>
> diff --git a/.travis-ci.sh b/.travis-ci.sh
> new file mode 100755
> index 0000000..0638514
> --- /dev/null
> +++ b/.travis-ci.sh
> @@ -0,0 +1,70 @@
> +#!/bin/bash
> +# Based on a test script from avsm/ocaml repo https://github.com/avsm/ocaml
> +
> +CHROOT_DIR=/tmp/arm-chroot
> +MIRROR=http://ports.ubuntu.com/ubuntu-ports/
> +VERSION=trusty
> +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="build-essential git m4 sudo python protobuf-c-compiler libprotobuf-c0-dev gcc make bsdmainutils bash"
> +
> +# Command used to run the tests
> +TEST_COMMAND="make -j 2"
> +
> +function setup_arm_chroot {
> + # Host dependencies
> + 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 --components=main,universe,multiverse \
> + ${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
> + sudo chroot ${CHROOT_DIR} apt-get --allow-unauthenticated install \
> + -qq -y ${GUEST_DEPENDENCIES}
> +
> + # 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} && ./.travis-ci.sh"
> +}
> +
> +if [ -e "/.chroot_is_done" ]; then
> + # We are inside ARM chroot
> + echo "Running inside chrooted environment"
> +
> + . ./envvars.sh
> +else
> + if [ "${ARCH}" = "arm" ]; then
> + # ARM test run, need to set up chrooted environment first
> + echo "Setting up chrooted ARM environment"
> + setup_arm_chroot
> + exit
> + fi
> +fi
> +
> +echo "Running tests"
> +echo "Environment: $(uname -a)"
> +
> +eval ${TEST_COMMAND}
> diff --git a/.travis.yml b/.travis.yml
> new file mode 100644
> index 0000000..d330e2c
> --- /dev/null
> +++ b/.travis.yml
> @@ -0,0 +1,11 @@
> +language: c
> +env:
> + - ARCH=arm
> + - ARCH=x86_64
> +compiler:
> + - gcc
> +before_install:
> + - sudo apt-get update -qq
> + - sudo apt-get install -qq protobuf-c-compiler libprotobuf-c0-dev
> +script:
> + - "bash -ex .travis-ci.sh"
> --
> 1.9.3
>
More information about the CRIU
mailing list