From 1ef6bba51e7e81440d64cfe878cea8f9f85b1cfe Mon Sep 17 00:00:00 2001 From: Geoffroy Van Cutsem Date: Wed, 4 Apr 2018 23:21:09 +0200 Subject: [PATCH] Enable Travis CI testing Enable Travis CI testing for the following development host OSs: * Clearlinux * Ubuntu 16.04 * Fedora 26 Signed-off-by: Geoffroy Van Cutsem --- .../.travis-dockerfiles/Dockerfile.centos7 | 16 ++++ .../.travis-dockerfiles/Dockerfile.clearlinux | 10 +++ .../.travis-dockerfiles/Dockerfile.debian8 | 15 ++++ .../.travis-dockerfiles/Dockerfile.fedora26 | 16 ++++ .../.travis-dockerfiles/Dockerfile.fedora27 | 16 ++++ .../Dockerfile.ubuntu14.04 | 15 ++++ .../Dockerfile.ubuntu16.04 | 15 ++++ devicemodel/.travis-dockerfiles/README.md | 80 +++++++++++++++++++ devicemodel/.travis.yml | 25 ++++++ 9 files changed, 208 insertions(+) create mode 100644 devicemodel/.travis-dockerfiles/Dockerfile.centos7 create mode 100644 devicemodel/.travis-dockerfiles/Dockerfile.clearlinux create mode 100644 devicemodel/.travis-dockerfiles/Dockerfile.debian8 create mode 100644 devicemodel/.travis-dockerfiles/Dockerfile.fedora26 create mode 100644 devicemodel/.travis-dockerfiles/Dockerfile.fedora27 create mode 100644 devicemodel/.travis-dockerfiles/Dockerfile.ubuntu14.04 create mode 100644 devicemodel/.travis-dockerfiles/Dockerfile.ubuntu16.04 create mode 100644 devicemodel/.travis-dockerfiles/README.md create mode 100644 devicemodel/.travis.yml diff --git a/devicemodel/.travis-dockerfiles/Dockerfile.centos7 b/devicemodel/.travis-dockerfiles/Dockerfile.centos7 new file mode 100644 index 000000000..c16deb1f6 --- /dev/null +++ b/devicemodel/.travis-dockerfiles/Dockerfile.centos7 @@ -0,0 +1,16 @@ +# Build container based on CentOS 7 +FROM centos:centos7 + +RUN yum -y update; yum clean all +RUN yum -y install gcc \ + git \ + make \ + vim \ + libuuid-devel \ + openssl-devel \ + libpciaccess-devel \ + gnu-efi-devel + +WORKDIR /root/acrn + +CMD ["/bin/bash"] diff --git a/devicemodel/.travis-dockerfiles/Dockerfile.clearlinux b/devicemodel/.travis-dockerfiles/Dockerfile.clearlinux new file mode 100644 index 000000000..f339eb7f6 --- /dev/null +++ b/devicemodel/.travis-dockerfiles/Dockerfile.clearlinux @@ -0,0 +1,10 @@ +# Build container based on Clearlinux +FROM clearlinux:base + +# python-basic-dev is only there because it gives us +# the openssl/md5.h header that we need +RUN swupd bundle-add os-core-dev dev-utils-dev + +WORKDIR /root/acrn + +CMD ["/bin/bash"] diff --git a/devicemodel/.travis-dockerfiles/Dockerfile.debian8 b/devicemodel/.travis-dockerfiles/Dockerfile.debian8 new file mode 100644 index 000000000..ed0eba941 --- /dev/null +++ b/devicemodel/.travis-dockerfiles/Dockerfile.debian8 @@ -0,0 +1,15 @@ +# Build container based on Debian 8 +FROM debian:8 + +# Install dependencies. +RUN apt-get update \ + && apt-get install -y gcc make vim git \ + gnu-efi \ + libssl-dev \ + libpciaccess-dev \ + uuid-dev \ + && apt-get clean + +WORKDIR /root/acrn + +CMD ["/bin/bash"] diff --git a/devicemodel/.travis-dockerfiles/Dockerfile.fedora26 b/devicemodel/.travis-dockerfiles/Dockerfile.fedora26 new file mode 100644 index 000000000..4b8a3f329 --- /dev/null +++ b/devicemodel/.travis-dockerfiles/Dockerfile.fedora26 @@ -0,0 +1,16 @@ +# Build container based on Fedora 26 +FROM fedora:26 + +RUN dnf -y update && dnf clean all +RUN dnf -y install gcc \ + git \ + make \ + vim \ + libuuid-devel \ + openssl-devel \ + libpciaccess-devel \ + gnu-efi-devel + +WORKDIR /root/acrn + +CMD ["/bin/bash"] diff --git a/devicemodel/.travis-dockerfiles/Dockerfile.fedora27 b/devicemodel/.travis-dockerfiles/Dockerfile.fedora27 new file mode 100644 index 000000000..1f7e698ba --- /dev/null +++ b/devicemodel/.travis-dockerfiles/Dockerfile.fedora27 @@ -0,0 +1,16 @@ +# Build container based on Fedora 27 +FROM fedora:27 + +RUN dnf -y update && dnf clean all +RUN dnf -y install gcc \ + git \ + make \ + vim \ + libuuid-devel \ + openssl-devel \ + libpciaccess-devel \ + gnu-efi-devel + +WORKDIR /root/acrn + +CMD ["/bin/bash"] diff --git a/devicemodel/.travis-dockerfiles/Dockerfile.ubuntu14.04 b/devicemodel/.travis-dockerfiles/Dockerfile.ubuntu14.04 new file mode 100644 index 000000000..adeeecf83 --- /dev/null +++ b/devicemodel/.travis-dockerfiles/Dockerfile.ubuntu14.04 @@ -0,0 +1,15 @@ +# Build container based on Ubuntu 14.04 +FROM ubuntu:14.04 + +# Install dependencies. +RUN apt-get update \ + && apt-get install -y gcc make vim git \ + gnu-efi \ + libssl-dev \ + libpciaccess-dev \ + uuid-dev \ + && apt-get clean + +WORKDIR /root/acrn + +CMD ["/bin/bash"] diff --git a/devicemodel/.travis-dockerfiles/Dockerfile.ubuntu16.04 b/devicemodel/.travis-dockerfiles/Dockerfile.ubuntu16.04 new file mode 100644 index 000000000..2856e4f28 --- /dev/null +++ b/devicemodel/.travis-dockerfiles/Dockerfile.ubuntu16.04 @@ -0,0 +1,15 @@ +# Build container based on Ubuntu 16.04 +FROM ubuntu:16.04 + +# Install dependencies. +RUN apt-get update \ + && apt-get install -y gcc make vim git \ + gnu-efi \ + libssl-dev \ + libpciaccess-dev \ + uuid-dev \ + && apt-get clean + +WORKDIR /root/acrn + +CMD ["/bin/bash"] diff --git a/devicemodel/.travis-dockerfiles/README.md b/devicemodel/.travis-dockerfiles/README.md new file mode 100644 index 000000000..35c38cf85 --- /dev/null +++ b/devicemodel/.travis-dockerfiles/README.md @@ -0,0 +1,80 @@ +# Build containers for Project ACRN + +## Introduction + +This folder contains a number of Dockerfile that include +all the build tools and dependencies to build the ACRN Project +components, i.e. the `acrn-hypervisor` and `acrn-devicemodel` + +The workflow is pretty simple and can be summarized in these few steps: + +1. Build the *build containers* based on your preferred OS +1. Clone the Project ACRN repositories +1. Start the build container and give it the repositories +1. Build the Project ACRN components + +The pre-requisite is that you have Docker installed on your machine. +Explaining how to install it on your system is beyond the scope of this +document, please visit https://www.docker.com for detailed instructions. + +## Build the *build containers* + +Each `Dockerfile` in this repo has an extension that tells what Linux +distribution it is based on. To build a container using any of those, +use this command: +``` +$ sudo docker build -t -f Dockerfile. . +``` + +As an example, to build a container based on CentOS 7, do: +``` +$ sudo docker build -t centos7 -f Dockerfile.centos7 . +``` + +## Clone Project ACRN + +Follow these simple steps to clone the Project ACRN repositories +``` +$ mkdir ~/acrn +$ cd ~/acrn +$ git clone https://github.com/projectacrn/acrn-hypervisor +$ git clone https://github.com/projectacrn/acrn-devicemodel +``` + +## Start the build container + +Use this `~/acrn` folder and pass it on to your build container: +``` +$ cd ~/acrn +$ sudo docker run -ti -v $PWD:/root/acrn +``` + +Using CentOS 7 again as an example, that gives us: +``` +$ cd ~/acrn +$ sudo docker run -ti -v $PWD:/root/acrn centos7 +``` + +**Note:** if you encounter permission issues within the container (as it +happens on a Fedora 27 host), try adding the `:z` parameter to the mount option. +This will unlock the permission restriction (that comes from SElinux). Your +command-line would then be: +``` +$ cd ~/acrn +$ sudo docker run -ti -v $PWD:/root/acrn:z centos7 +``` + +## Build the ACRN components + +The steps above place you inside the container and give you access to +the Project ACRN repositories you cloned earlier. You can now build any +of the components. Here is an example: +``` +# cd acrn-hypervisor +# make PLATFORM=uefi RELEASE=1 +``` + +You can do this for all build combinations and also try to build the `acrn-devicemodel`. +All the build dependencies and tools are pre-installed in the container as well as a +couple of useful tools (`git` and `vim`) so you can directly edit files to experiment +from within the container. diff --git a/devicemodel/.travis.yml b/devicemodel/.travis.yml new file mode 100644 index 000000000..bfe7cb089 --- /dev/null +++ b/devicemodel/.travis.yml @@ -0,0 +1,25 @@ +sudo: required + +language: c + +env: + global: + - OS_TESTED_CL="clearlinux" + - OS_TESTED_UBUNTU="ubuntu16.04" + - OS_TESTED_FEDORA="fedora26" + +services: + - docker + +before_install: + - docker build -t ${OS_TESTED_CL} -f .travis-dockerfiles/Dockerfile.${OS_TESTED_CL} . + - docker build -t ${OS_TESTED_UBUNTU} -f .travis-dockerfiles/Dockerfile.${OS_TESTED_UBUNTU} . + - docker build -t ${OS_TESTED_FEDORA} -f .travis-dockerfiles/Dockerfile.${OS_TESTED_FEDORA} . + - docker images + +install: true + +script: + - docker run -v $PWD:/root/acrn ${OS_TESTED_CL} /bin/bash -c "make clean && make" + - docker run -v $PWD:/root/acrn ${OS_TESTED_UBUNTU} /bin/bash -c "make clean && make" + - docker run -v $PWD:/root/acrn ${OS_TESTED_FEDORA} /bin/bash -c "make clean && make"