From 1591952f137256a6919db3a8e5b894fc39b1729a Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Fri, 9 Nov 2018 08:54:26 -0700 Subject: [PATCH 1/2] ci: Shift to a prebuilt Docker image This moves our Travis setup to use a Docker image built specifically for ClangBuiltLinux. It will be built daily via a Travis cron. The benefits of this include: 1. Removing the potentially messy dependency dance that we are currently doing with our QEMU PPA by moving to an up to date version of Ubuntu instead of Debian. 2. Having a consistent environment that can not only be used by Travis but by other developers looking to get involved with the project. 3. Faster CI. The current image clocks in at around 231MB, which is the only thing that needs to be downloaded because everything else is already installed and setup. 4. If for some reason we wanted to switch environments (such as to a smaller distro like Alpine Linux), we could build more things from source if they were out of date because we would have a full 50 minutes with a Travis job (since the Dockerfile is in a separate repo). Closes #34. Signed-off-by: Nathan Chancellor --- .travis.yml | 2 +- debian-setup.sh | 69 ------------------------------------------------- env-setup.sh | 22 ++++++++++++++++ 3 files changed, 23 insertions(+), 70 deletions(-) delete mode 100755 debian-setup.sh create mode 100755 env-setup.sh diff --git a/.travis.yml b/.travis.yml index 7e40e79..1729096 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,7 +88,7 @@ script: --rm \ --workdir /travis \ --volume ${TRAVIS_BUILD_DIR}:/travis \ - debian:sid /bin/bash -c './debian-setup.sh && ./driver.sh && ccache -s' + clangbuiltlinux/ubuntu /bin/bash -c './env-setup.sh && ./driver.sh && ccache -s' after_script: - sleep 1 notifications: diff --git a/debian-setup.sh b/debian-setup.sh deleted file mode 100755 index c5ababf..0000000 --- a/debian-setup.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env bash -# Installs all of the necessary packages in a Docker container - -# Show all commands and exit upon failure -set -eux - -# Install the official Debian packages that we need -# curl and wget are not installed by default so this -# is separate from the Clang/lld installation below -# because we would need to at least install curl to -# get LLVM's apt key -apt-get update -qq -apt-get install -y -qq \ - bc \ - binutils \ - binutils-aarch64-linux-gnu \ - binutils-arm-linux-gnueabi \ - binutils-powerpc64le-linux-gnu \ - bison \ - ccache \ - curl \ - expect \ - flex \ - git \ - gnupg \ - libelf-dev \ - libssl-dev \ - make \ - openssl \ - >/dev/null - -# Install Qemu 3.0 from shenki's ppa. Debian nor Ubuntu package 3.0 yet, which -# is required for ppc64le powernv support. Skiboot is also required for this machine -apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E007EC6A -echo "deb http://ppa.launchpad.net/shenki/ppa/ubuntu bionic main" | tee -a /etc/apt/sources.list -apt-get update -qq -apt-get install -y -qq \ - qemu-system-arm \ - qemu-system-ppc \ - qemu-system-x86 \ - skiboot \ - >/dev/null - -# Install nightly verisons of Clang and lld (apt.llvm.org) -curl https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - -echo "deb http://apt.llvm.org/unstable/ llvm-toolchain main" | tee -a /etc/apt/sources.list -apt-get update -qq -apt-get install --no-install-recommends -y -qq \ - clang-8 \ - lld-8 \ - llvm-8 \ - >/dev/null - -# By default, Travis's ccache size is around 500MB. We'll -# start with 2GB just to see how it plays out. -ccache -M 2G - -# Enable compression so that we can have more objects in -# the cache (9 is most compressed, 6 is default) -ccache --set-config=compression=true -ccache --set-config=compression_level=9 - -# Set the cache directory to /travis/.ccache, which we've -# bind mounted during 'docker create' so that we can keep -# this cached across builds -ccache --set-config=cache_dir=/travis/.ccache - -# Clear out the stats so we actually know the cache stats -ccache -z diff --git a/env-setup.sh b/env-setup.sh new file mode 100755 index 0000000..46a6e2b --- /dev/null +++ b/env-setup.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# Configure our Docker container during Travis builds + +# Show all commands and exit upon failure +set -eux + +# By default, Travis's ccache size is around 500MB. We'll +# start with 2GB just to see how it plays out. +ccache -M 2G + +# Enable compression so that we can have more objects in +# the cache (9 is most compressed, 6 is default) +ccache --set-config=compression=true +ccache --set-config=compression_level=9 + +# Set the cache directory to /travis/.ccache, which we've +# bind mounted during 'docker create' so that we can keep +# this cached across builds +ccache --set-config=cache_dir=/travis/.ccache + +# Clear out the stats so we actually know the cache stats +ccache -z From 235265ee938136b8f6f836b096a21cd063db382d Mon Sep 17 00:00:00 2001 From: Nathan Chancellor Date: Tue, 20 Nov 2018 11:28:03 -0700 Subject: [PATCH 2/2] driver: GCC is not required As of https://github.com/ClangBuiltLinux/dockerimage/commit/99b0f1a791af1bb849b86e2d10507a60edfaad86, we no longer package GCC in our Docker iamge. Don't check for it in driver.sh (where it was never actually used after commit 4ae897612adaa2935d674528ff145f1a28d8876f). Signed-off-by: Nathan Chancellor --- driver.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/driver.sh b/driver.sh index 061b746..a5d5bd1 100755 --- a/driver.sh +++ b/driver.sh @@ -87,7 +87,6 @@ setup_variables() { check_dependencies() { command -v nproc - command -v gcc command -v "${CROSS_COMPILE:-}"as command -v "${CROSS_COMPILE:-}"ld command -v ${qemu}