Skip to content
Permalink
Browse files

travis: build using docker to get newer build environments

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
  • Loading branch information...
tycho committed Jun 11, 2019
1 parent e17181d commit 295bb31bfe076b2770d14d75ec2be8a1a297aa1d
Showing with 114 additions and 18 deletions.
  1. +25 −18 .travis.yml
  2. +20 −0 .travis/install-fedora.sh
  3. +9 −0 .travis/install-post.sh
  4. +12 −0 .travis/install-ubuntu.sh
  5. +48 −0 .travis/script.sh
@@ -1,24 +1,31 @@
language: c
language: cpp

sudo: required

services:
- docker

compiler:
- gcc
- clang

env:
- IMAGE=ubuntu IMAGE_TAG=latest
- IMAGE=ubuntu IMAGE_TAG=rolling
- IMAGE=ubuntu IMAGE_TAG=devel
- IMAGE=fedora IMAGE_TAG=latest
- IMAGE=fedora IMAGE_TAG=rawhide

before_install:
- export CONTAINER=${IMAGE}-${IMAGE_TAG}
- docker run -d --cap-add SYS_PTRACE --name $CONTAINER -e LC_ALL="en_US.UTF-8" -e LANG="en_US.UTF-8" -v $(pwd):/travis -w /travis $IMAGE:$IMAGE_TAG tail -f /dev/null
- docker ps

install:
- docker exec -e CC=$CC -e CXX=$CXX -t $CONTAINER bash .travis/install-$IMAGE.sh
- docker exec -e CC=$CC -e CXX=$CXX -t $CONTAINER bash .travis/install-post.sh

script:
# Attempt build with GNU make
- make

# Basic run test
- ./cpuid -c 0
- ./cpuid -c 0 -d

# Try processing a dump file
- ./cpuid -c -1 -d > dump.txt
- ./cpuid -f dump.txt

notifications:
pushover:
api_key:
secure: RAHLS+gadlUEWnCtB3TmymYQ3r7v7vPG8lzF631vA223TwwC235JcqzmRc12M+fq6JOkc4cyrfhpQ8XsYeEv3VdfeToQnIW9/XAbbKcqDF+WWoZoQ7xXWxtjBu46r2GFFSMWD7yEd9o6aZ8IBO08N+SSfFPCwfBlYumN5KIz4DA=
users:
secure: jmqcQuPhVhWlnOgmTPRTc7d5kwIOop8sD2tEp+L6Ojt4FdbJLwzpFbEX87a8uOL690Q2xTXpPBBZZWKfxv9WNgzozBZlR5gPr2skf4URi0Kx57XeCx4E1Kjsp+fGzW16w+B9SLxxfyFwO6V7ozixQ5ozwRvrdEgPI1uXltnunbM=
- docker exec -e CC=$CC -e CXX=$CXX -t $CONTAINER bash .travis/script.sh

# vim: set ts=2 sts=2 sw=2 et:
@@ -0,0 +1,20 @@
#!/bin/bash
#
# This is an install script for Fedora-specific packages.
#
set -ex

# Base build packages
PACKAGES=(
git
gcc-c++
libasan
libubsan
clang
meson
perl
pkgconf-pkg-config
which
)

dnf install -y "${PACKAGES[@]}"
@@ -0,0 +1,9 @@
#!/bin/bash
#
# This is a post-install script common to all Docker images.
#
cmake --version
meson --version
g++ --version
clang++ --version
exit 0
@@ -0,0 +1,12 @@
#!/bin/bash
#
# This is an install script for Ubuntu-specific packages.
#
set -ex
apt-get update
apt-get install -y locales
locale-gen en_US.UTF-8

PACKAGES=(git build-essential pkg-config meson clang perl)

apt-get install -y "${PACKAGES[@]}"
@@ -0,0 +1,48 @@
#!/bin/bash
#
# This is a distribution-agnostic build script. Do not use "apt-get", "dnf", or
# similar in here. Add any package installation gunk into the appropriate
# install script instead.
#
set -ex

rm -rf build-{a,ub,t}san build-meson

MESON_ARGS=()
BUILD_VARIANTS=(meson)

BUILD_SANITIZERS=1
[[ $(uname -s) == MINGW* ]] && BUILD_SANITIZERS=0

meson . build-meson -Dbuildtype=release -Ddebug=false -Db_lto=true

# Build some tests with sanitizers
if [[ $BUILD_SANITIZERS -ne 0 ]]; then
BUILD_VARIANTS+=(asan ubsan)
meson . build-asan -Db_sanitize=address
meson . build-ubsan -Db_sanitize=undefined
if [[ ${CXX} == *clang* ]]; then
BUILD_VARIANTS+=(tsan)
meson . build-tsan -Db_sanitize=thread
fi
fi

# Build all targets of meson, ensuring everything can build.
for BUILD_VARIANT in ${BUILD_VARIANTS[@]}; do
ninja -C build-${BUILD_VARIANT}
done

# Ensure plain makefile build works too
make

# Run basic tests
for BUILD_VARIANT in . ${BUILD_VARIANTS[@]}; do
BUILD_DIR=build-$BUILD_VARIANT
[[ "$BUILD_VARIANT" == "." ]] && BUILD_DIR=.
pushd $BUILD_DIR
./cpuid -c 0
./cpuid -c 0 -d
./cpuid -c -1 -d > dump.txt
./cpuid -f dump.txt
popd
done

0 comments on commit 295bb31

Please sign in to comment.
You can’t perform that action at this time.