Enable Travis CI for all combinations

Enable the Travis CI testing for all combinations of variables
that can be set at compile-time. I.e. RELEASE={0|1} and
PLATFORM={0|1}

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
This commit is contained in:
Geoffroy Van Cutsem 2018-04-04 15:45:34 +02:00 committed by Jack Ren
parent eadc921bf0
commit 1ac5a2aebd
12 changed files with 270 additions and 15 deletions

View File

@ -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"]

View File

@ -0,0 +1,8 @@
# Build container based on Clearlinux
FROM clearlinux:base
RUN swupd bundle-add os-core-dev dev-utils-dev
WORKDIR /root/acrn
CMD ["/bin/bash"]

View File

@ -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"]

View File

@ -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"]

View File

@ -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"]

View File

@ -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"]

View File

@ -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"]

View File

@ -0,0 +1,29 @@
BSD 3-Clause License
Copyright (c) 2018, Geoffroy Van Cutsem
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,80 @@
# Build containers for Project ACRN
## Introduction
This repository 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 <container-name> -f Dockerfile.<baseos> .
```
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 <container-name>
```
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.

View File

@ -0,0 +1,37 @@
#!/bin/bash
DOCKER_BIN=`which docker`
function usage {
echo "Usage: $0 <path-to-acrn>"
echo " Where <path-to-acrn> is the path to where you"
echo " have cloned the acrn repositories"
exit 1
}
if [ $# -eq 0 ];
then
usage
fi
build_container () {
var=$(sudo $DOCKER_BIN images --format '{{.Tag}}' | grep -c $distro)
echo $var
if [ $(sudo $DOCKER_BIN images --format '{{.Repository}}' | grep -c $distro) == '0' ];
then
echo There is no build container for $distro yet.
echo Creating a build container for $distro... please be patient!
$DOCKER_BIN build -t $distro -f Dockerfile.$distro .
else
echo We already have a build container for $distro, attempting to use it...
fi
}
for distro in `ls Dockerfile.*`; do
# Extract the name of the Linux distro. It assumes the Dockerfile name is built as "Dockerfile.<distro>"
distro=${distro:11}
build_container
echo "Testing Linux distribion: $distro"
$DOCKER_BIN run -v $1:/root/acrn:z $distro make
done

View File

@ -2,11 +2,31 @@ sudo: required
language: c
env:
global:
- OS_TESTED="clearlinux"
matrix:
- RELEASE=0
PLATFORM=sbl
- RELEASE=1
PLATFORM=sbl
- RELEASE=0
PLATFORM=uefi
- RELEASE=1
PLATFORM=uefi
services:
- docker
- docker
before_install:
- docker ps -a
- docker build -t ${OS_TESTED} -f .travis-dockerfiles/Dockerfile.${OS_TESTED} .
- docker images
install: true
script:
- docker build -t shrmrf/acrn-hypervisor .
- docker run -v $PWD:/root/acrn ${OS_TESTED} /bin/bash -c "make clean && make PLATFORM=$PLATFORM RELEASE=$RELEASE"

View File

@ -1,12 +0,0 @@
FROM clearlinux:base
MAINTAINER shrmrf "https://github.com/shrmrf"
# Install packages for building acrn
# RUN swupd update
RUN swupd bundle-add os-core-dev
RUN git config --global http.sslVerify false
COPY . /root/acrn-hypervisor
RUN cd /root/acrn-hypervisor; make clean && make PLATFORM=uefi