[Skiboot] [PATCH] travis-ci: use Docker containers for a matrix of platforms

Stewart Smith stewart at linux.vnet.ibm.com
Wed Nov 2 14:06:34 AEDT 2016


This greatly simplifies the build process for travis, yet makes it more
powerful and increases coverage without increasing wall time to test.

Travis has the concept of a build matrix, and we want to ensure we continue
to build succesfully on a variety of platforms and compiler combinations.

We limit what we run on some OSs to conserve vital sanity.

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 .travis.yml                      | 59 ++++++++++++++++++++--------------------
 Makefile.main                    |  2 +-
 opal-ci/Dockerfile-centos6       |  9 ++++++
 opal-ci/Dockerfile-centos7       | 10 +++++++
 opal-ci/Dockerfile-fedora24      |  6 ++++
 opal-ci/Dockerfile-ubuntu-16.04  | 12 ++++++++
 opal-ci/Dockerfile-ubuntu-latest | 12 ++++++++
 opal-ci/Dockerfile-ubuntu-trusty | 19 +++++++++++++
 opal-ci/build-centos6.sh         | 27 ++++++++++++++++++
 opal-ci/build-fedora24.sh        | 25 +++++++++++++++++
 opal-ci/build-ubuntu-16.04.sh    | 24 ++++++++++++++++
 opal-ci/build-ubuntu-trusty.sh   | 24 ++++++++++++++++
 12 files changed, 199 insertions(+), 30 deletions(-)
 create mode 100644 opal-ci/Dockerfile-centos6
 create mode 100644 opal-ci/Dockerfile-centos7
 create mode 100644 opal-ci/Dockerfile-fedora24
 create mode 100644 opal-ci/Dockerfile-ubuntu-16.04
 create mode 100644 opal-ci/Dockerfile-ubuntu-latest
 create mode 100644 opal-ci/Dockerfile-ubuntu-trusty
 create mode 100755 opal-ci/build-centos6.sh
 create mode 100755 opal-ci/build-fedora24.sh
 create mode 100755 opal-ci/build-ubuntu-16.04.sh
 create mode 100755 opal-ci/build-ubuntu-trusty.sh

diff --git a/.travis.yml b/.travis.yml
index de21952..7aa58ff 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,41 +1,42 @@
 language: c
 
-sudo: required
-dist: trusty
-
-before_install:
-    - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
-    - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
-    - sudo apt-get update -qq
-    - sudo apt-get install -y gcc-4.8 libstdc++6 valgrind expect xterm
-    - sudo apt-get install -y gcc-arm-linux-gnueabi gcc-powerpc64le-linux-gnu gcc
-    - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
-    - wget https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.8.0/x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz
-    - sudo mkdir /opt/cross
-    - sudo tar -C /opt/cross -xvf x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz
-    - wget ftp://public.dhe.ibm.com/software/server/powerfuncsim/p8/packages/v1.0-2/systemsim-p8_1.0-2_amd64.deb
-    - sudo dpkg -i systemsim-p8_1.0-2_amd64.deb
-    - ./opal-ci/install-deps-qemu-powernv.sh
-
 env:
+    matrix:
+    - RUN_ON_CONTAINER=ubuntu-trusty
+    - RUN_ON_CONTAINER=ubuntu-16.04
+    - RUN_ON_CONTAINER=ubuntu-latest
+    - RUN_ON_CONTAINER=centos6
+    - RUN_ON_CONTAINER=centos7
+    - RUN_ON_CONTAINER=fedora24
     global:
-        - CROSS=/opt/cross/gcc-4.8.0-nolibc/powerpc64-linux/bin/powerpc64-linux-
-        - HOSTCC=gcc-4.8
         # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
         #   via the "travis encrypt" command using the project repo's public key
-        - secure: "MpNEGFa1VrF/vsQq24n5UgfRbz1wVC6B8mubFnyK4gX0IuQ9xhWuTzMLUQF9UJxe5jnC2DTmVUvYTYN/hggw+PpYwbOOAE0QGR5pmPHA4PSRmc5pxt1q18/sv7EPFw66GFyWJq94nWjpigyKQ8KGtA67j1xFqrDoS43OA76WZgo="
+        secure: "MpNEGFa1VrF/vsQq24n5UgfRbz1wVC6B8mubFnyK4gX0IuQ9xhWuTzMLUQF9UJxe5jnC2DTmVUvYTYN/hggw+PpYwbOOAE0QGR5pmPHA4PSRmc5pxt1q18/sv7EPFw66GFyWJq94nWjpigyKQ8KGtA67j1xFqrDoS43OA76WZgo="
+
 
+sudo: required
+services: docker
+
+dist: trusty
+
+before_install:
+    - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-certificates.crt
 
 script:
-  - if [ ${COVERITY_SCAN_BRANCH} != 1 ]; then
-      (cd opal-ci; ./build-qemu-powernv.sh) &&
-      ./opal-ci/fetch-debian-jessie-installer.sh &&
-      make -j4 all check ; (make clean; cd external/gard && CROSS= make) &&
-      (cd external/pflash; ./build-all-arch.sh) &&
-      make clean && SKIBOOT_GCOV=1 make && SKIBOOT_GCOV=1 make check &&
-      make clean && rm -rf builddir && mkdir builddir && make SRC=`pwd` -f ../Makefile -C builddir &&
-      make clean;
-    fi
+    - if [ ${COVERITY_SCAN_BRANCH} != 1 ]; then
+       docker build -t ${RUN_ON_CONTAINER} -f opal-ci/Dockerfile-${RUN_ON_CONTAINER} . &&
+       docker run --rm -t $RUN_ON_CONTAINER;
+      fi
+    - if [ ${COVERITY_SCAN_BRANCH} == 1 ]; then
+        sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test &&
+        sudo apt-get update -qq &&
+        sudo apt-get install -y gcc-4.8 libstdc++6 valgrind expect xterm &&
+        sudo apt-get install -y gcc-arm-linux-gnueabi gcc-powerpc64le-linux-gnu gcc &&
+        sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50 &&
+        wget https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.8.0/x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz &&
+        sudo mkdir /opt/cross &&
+        sudo tar -C /opt/cross -xvf x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz;
+      fi
 
 addons:
   coverity_scan:
diff --git a/Makefile.main b/Makefile.main
index 7918a18..62a659d 100644
--- a/Makefile.main
+++ b/Makefile.main
@@ -193,7 +193,7 @@ $(TARGET).elf: $(ALL_OBJS_2) $(TARGET).lds $(KERNEL)
 	$(call Q,LD, $(CC) $(LDFLAGS) -T $(TARGET).lds $(ALL_OBJS_2) -o $@, $@)
 
 $(SUBDIRS):
-	$(call Q,MKDIR,mkdir $@, $@)
+	$(call Q,MKDIR,mkdir -p $@, $@)
 
 -include $(wildcard *.d)
 -include $(wildcard $(SUBDIRS:%=%/*.d))
diff --git a/opal-ci/Dockerfile-centos6 b/opal-ci/Dockerfile-centos6
new file mode 100644
index 0000000..5cd9a7a
--- /dev/null
+++ b/opal-ci/Dockerfile-centos6
@@ -0,0 +1,9 @@
+FROM centos:6
+RUN yum -y update && yum clean all
+RUN yum -y install wget xterm gcc git xz
+RUN wget https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.8.0/x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz
+RUN mkdir /opt/cross
+RUN tar -C /opt/cross -xf x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz
+COPY . /build/
+WORKDIR /build
+ENTRYPOINT ./opal-ci/build-centos6.sh
diff --git a/opal-ci/Dockerfile-centos7 b/opal-ci/Dockerfile-centos7
new file mode 100644
index 0000000..c9d4c87
--- /dev/null
+++ b/opal-ci/Dockerfile-centos7
@@ -0,0 +1,10 @@
+FROM centos:7
+RUN yum -y update && yum clean all
+RUN yum -y install wget xterm gcc git xz make diffutils findutils expect valgrind valgrind-devel
+RUN wget https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.8.0/x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz
+RUN mkdir /opt/cross
+RUN tar -C /opt/cross -xf x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz
+COPY . /build/
+WORKDIR /build
+# We don't have a custom centos 7 build, same script for now
+ENTRYPOINT ./opal-ci/build-centos6.sh
diff --git a/opal-ci/Dockerfile-fedora24 b/opal-ci/Dockerfile-fedora24
new file mode 100644
index 0000000..7caa884
--- /dev/null
+++ b/opal-ci/Dockerfile-fedora24
@@ -0,0 +1,6 @@
+FROM fedora:24
+RUN dnf -y install wget xterm gcc git xz make diffutils findutils expect valgrind valgrind-devel
+RUN dnf -y install gcc-powerpc64-linux-gnu 
+COPY . /build/
+WORKDIR /build
+ENTRYPOINT ./opal-ci/build-fedora24.sh
diff --git a/opal-ci/Dockerfile-ubuntu-16.04 b/opal-ci/Dockerfile-ubuntu-16.04
new file mode 100644
index 0000000..2fb299b
--- /dev/null
+++ b/opal-ci/Dockerfile-ubuntu-16.04
@@ -0,0 +1,12 @@
+FROM ubuntu:16.04
+RUN apt-get update -qq
+RUN apt-get install -y gcc-powerpc64le-linux-gnu gcc
+RUN apt-get install -y wget xterm
+RUN apt-get install -y gcc-arm-linux-gnueabi
+RUN wget ftp://public.dhe.ibm.com/software/server/powerfuncsim/p8/packages/v1.0-2/systemsim-p8_1.0-2_amd64.deb
+RUN dpkg -i systemsim-p8_1.0-2_amd64.deb
+RUN apt-get -y install eatmydata
+RUN eatmydata apt-get -y install build-essential gcc python g++ pkg-config libz-dev libglib2.0-dev libpixman-1-dev libfdt-dev git libstdc++6 valgrind
+COPY . /build/
+WORKDIR /build
+ENTRYPOINT ./opal-ci/build-ubuntu-16.04.sh
diff --git a/opal-ci/Dockerfile-ubuntu-latest b/opal-ci/Dockerfile-ubuntu-latest
new file mode 100644
index 0000000..28fb904
--- /dev/null
+++ b/opal-ci/Dockerfile-ubuntu-latest
@@ -0,0 +1,12 @@
+FROM ubuntu:latest
+RUN apt-get update -qq
+RUN apt-get install -y gcc-powerpc64le-linux-gnu gcc
+RUN apt-get install -y wget xterm
+RUN apt-get install -y gcc-arm-linux-gnueabi
+RUN wget ftp://public.dhe.ibm.com/software/server/powerfuncsim/p8/packages/v1.0-2/systemsim-p8_1.0-2_amd64.deb
+RUN dpkg -i systemsim-p8_1.0-2_amd64.deb
+RUN apt-get -y install eatmydata
+RUN eatmydata apt-get -y install build-essential gcc python g++ pkg-config libz-dev libglib2.0-dev libpixman-1-dev libfdt-dev git libstdc++6 valgrind
+COPY . /build/
+WORKDIR /build
+ENTRYPOINT ./opal-ci/build-ubuntu-16.04.sh
diff --git a/opal-ci/Dockerfile-ubuntu-trusty b/opal-ci/Dockerfile-ubuntu-trusty
new file mode 100644
index 0000000..f7a3148
--- /dev/null
+++ b/opal-ci/Dockerfile-ubuntu-trusty
@@ -0,0 +1,19 @@
+FROM ubuntu:trusty
+RUN sudo apt-get update -qq
+RUN sudo apt-get install -y software-properties-common
+RUN sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
+RUN sudo apt-get update -qq
+RUN sudo apt-get install -y gcc-4.8 libstdc++6 valgrind expect xterm
+RUN sudo apt-get install -y gcc-arm-linux-gnueabi gcc-powerpc64le-linux-gnu gcc
+RUN sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
+RUN sudo apt-get install -y wget
+RUN wget https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.8.0/x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz
+RUN sudo mkdir /opt/cross
+RUN sudo tar -C /opt/cross -xf x86_64-gcc-4.8.0-nolibc_powerpc64-linux.tar.xz
+RUN wget ftp://public.dhe.ibm.com/software/server/powerfuncsim/p8/packages/v1.0-2/systemsim-p8_1.0-2_amd64.deb
+RUN sudo dpkg -i systemsim-p8_1.0-2_amd64.deb
+RUN sudo apt-get -y install eatmydata
+RUN sudo eatmydata apt-get -y install build-essential gcc python g++ pkg-config libz-dev libglib2.0-dev libpixman-1-dev libfdt-dev git libstdc++6
+COPY . /build/
+WORKDIR /build
+ENTRYPOINT ./opal-ci/build-ubuntu-trusty.sh
diff --git a/opal-ci/build-centos6.sh b/opal-ci/build-centos6.sh
new file mode 100755
index 0000000..25a25f2
--- /dev/null
+++ b/opal-ci/build-centos6.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+set -uo pipefail
+set -e
+
+# We're fairly limited as to what we want to bother to run on CentOS6
+# It's fairly old and some of the things (e.g. build+run qemu) we don't
+# want to bother doing.
+
+export CROSS=/opt/cross/gcc-4.8.0-nolibc/powerpc64-linux/bin/powerpc64-linux-
+
+MAKE_J=`grep -c processor /proc/cpuinfo`
+
+make -j${MAKE_J} all
+# Disable 'make check' for now, some errors with gcc 4.ancient
+#make -j${MAKE_J} check
+#(make clean; cd external/gard && CROSS= make -j${MAKE_J})
+#(cd external/pflash; make -j${MAKE_J})
+make clean
+SKIBOOT_GCOV=1 make -j${MAKE_J}
+#SKIBOOT_GCOV=1 make -j${MAKE_J} check
+
+make clean
+rm -rf builddir
+mkdir builddir
+make SRC=`pwd` -f ../Makefile -C builddir -j${MAKE_J}
+make clean
diff --git a/opal-ci/build-fedora24.sh b/opal-ci/build-fedora24.sh
new file mode 100755
index 0000000..609ee4a
--- /dev/null
+++ b/opal-ci/build-fedora24.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+set -uo pipefail
+set -e
+set -x
+
+MAKE_J=`grep -c processor /proc/cpuinfo`
+export CROSS=powerpc64-linux-gnu-
+
+make -j${MAKE_J} all
+make -j${MAKE_J} check
+(make clean; cd external/gard && CROSS= make -j${MAKE_J})
+(cd external/pflash; make -j${MAKE_J})
+make clean
+# Disable GCOV builds on Fedora 24 as toolchain gives us:
+# /usr/bin/powerpc64-linux-gnu-ld: section .bss VMA [0000000000200000,000000000024d757] overlaps section .sym_map VMA [000000000019f340,0000000000208e5c]
+# (we shoud fix it, but not yet)
+#SKIBOOT_GCOV=1 make -j${MAKE_J}
+#SKIBOOT_GCOV=1 make -j${MAKE_J} check
+
+make clean
+rm -rf builddir
+mkdir builddir
+make SRC=`pwd` -f ../Makefile -C builddir -j${MAKE_J}
+make clean
diff --git a/opal-ci/build-ubuntu-16.04.sh b/opal-ci/build-ubuntu-16.04.sh
new file mode 100755
index 0000000..8352be8
--- /dev/null
+++ b/opal-ci/build-ubuntu-16.04.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -uo pipefail
+set -e
+
+MAKE_J=`grep -c processor /proc/cpuinfo`
+
+export CROSS=powerpc64le-linux-gnu-
+
+make -j${MAKE_J} all
+(cd opal-ci; ./build-qemu-powernv.sh)
+./opal-ci/fetch-debian-jessie-installer.sh
+make -j${MAKE_J} check
+(make clean; cd external/gard && CROSS= make -j${MAKE_J})
+(cd external/pflash; ./build-all-arch.sh)
+make clean
+SKIBOOT_GCOV=1 make -j${MAKE_J}
+SKIBOOT_GCOV=1 make -j${MAKE_J} check
+
+make clean
+rm -rf builddir
+mkdir builddir
+make SRC=`pwd` -f ../Makefile -C builddir -j${MAKE_J}
+make clean
diff --git a/opal-ci/build-ubuntu-trusty.sh b/opal-ci/build-ubuntu-trusty.sh
new file mode 100755
index 0000000..224d305
--- /dev/null
+++ b/opal-ci/build-ubuntu-trusty.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -uo pipefail
+set -e
+
+export CROSS=/opt/cross/gcc-4.8.0-nolibc/powerpc64-linux/bin/powerpc64-linux-
+export HOSTCC=gcc-4.8
+MAKE_J=`grep -c processor /proc/cpuinfo`
+
+make -j${MAKE_J} all
+(cd opal-ci; ./build-qemu-powernv.sh)
+./opal-ci/fetch-debian-jessie-installer.sh
+make -j${MAKE_J} check
+(make clean; cd external/gard && CROSS= make -j${MAKE_J})
+(cd external/pflash; ./build-all-arch.sh)
+make clean
+SKIBOOT_GCOV=1 make -j${MAKE_J}
+SKIBOOT_GCOV=1 make -j${MAKE_J} check
+
+make clean
+rm -rf builddir
+mkdir builddir
+make SRC=`pwd` -f ../Makefile -C builddir -j${MAKE_J}
+make clean
-- 
2.7.4



More information about the Skiboot mailing list