Thomas Orozco 8 years ago
parent b837c033f8
commit a2de1a79f2
  1. 1
      .travis.yml
  2. 2
      Dockerfile
  3. 25
      ci/install_deps.sh
  4. 26
      ci/run_build.sh
  5. 13
      ddist.sh
  6. 9
      dtest.sh

@ -8,6 +8,7 @@ env:
- CC=gcc ARCH_SUFFIX=amd64 ARCH_NATIVE=1 MINIMAL= - CC=gcc ARCH_SUFFIX=amd64 ARCH_NATIVE=1 MINIMAL=
- CC=arm-linux-gnueabihf-gcc ARCH_SUFFIX=armhf ARCH_NATIVE= MINIMAL= - CC=arm-linux-gnueabihf-gcc ARCH_SUFFIX=armhf ARCH_NATIVE= MINIMAL=
- CC=aarch64-linux-gnu-gcc ARCH_SUFFIX=arm64 ARCH_NATIVE= MINIMAL= - CC=aarch64-linux-gnu-gcc ARCH_SUFFIX=arm64 ARCH_NATIVE= MINIMAL=
- CFLAGS="-m32" ARCH_SUFFIX=i386 ARCH_NATIVE= MINIMAL=
- CC=gcc ARCH_SUFFIX=amd64 ARCH_NATIVE=1 MINIMAL=1 - CC=gcc ARCH_SUFFIX=amd64 ARCH_NATIVE=1 MINIMAL=1
global: global:
- SIGN_BINARIES=1 - SIGN_BINARIES=1

@ -1,5 +1,7 @@
FROM ubuntu:trusty FROM ubuntu:trusty
ARG ARCH_SUFFIX
COPY ci/install_deps.sh /install_deps.sh COPY ci/install_deps.sh /install_deps.sh
RUN /install_deps.sh RUN /install_deps.sh

@ -1,14 +1,27 @@
#!/bin/bash #!/bin/bash
set -o errexit set -o errexit
set -o nounset set -o nounset
set -o xtrace
apt-get update DEPS=(
apt-get install --no-install-recommends --yes \
build-essential git gdb valgrind cmake rpm \ build-essential git gdb valgrind cmake rpm \
python-dev libcap-dev python-pip python-virtualenv \ python-dev libcap-dev python-pip python-virtualenv \
hardening-includes gnupg \ hardening-includes gnupg
gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu libc6-dev-arm64-cross \ )
gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabi libc6-dev-armhf-cross
if [[ "$ARCH_SUFFIX" = "amd64" ]]; then
true
elif [[ "$ARCH_SUFFIX" = "armhf" ]]; then
DEPS+=(gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabi libc6-dev-armhf-cross)
elif [[ "$ARCH_SUFFIX" = "arm64" ]]; then
DEPS+=(gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu libc6-dev-arm64-cross)
elif [[ "$ARCH_SUFFIX" = "i386" ]]; then
DEPS+=(libc6-dev-i386 gcc-multilib)
else
echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX}"
exit 1
fi
apt-get update
apt-get install --no-install-recommends --yes "${DEPS[@]}"
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*

@ -7,7 +7,6 @@ set -o pipefail
# Default compiler # Default compiler
: ${CC:="gcc"} : ${CC:="gcc"}
echo "CC=${CC}"
# Paths # Paths
: ${SOURCE_DIR:="."} : ${SOURCE_DIR:="."}
@ -30,12 +29,17 @@ export FORCE_SUBREAPER
# Our build platform doesn't have those newer Linux flags, but we want Tini to have subreaper support # Our build platform doesn't have those newer Linux flags, but we want Tini to have subreaper support
# We also use those in our tests # We also use those in our tests
CFLAGS="-DPR_SET_CHILD_SUBREAPER=36 -DPR_GET_CHILD_SUBREAPER=37" CFLAGS="${CFLAGS-} -DPR_SET_CHILD_SUBREAPER=36 -DPR_GET_CHILD_SUBREAPER=37"
if [[ "${FORCE_SUBREAPER}" -eq 1 ]]; then if [[ "${FORCE_SUBREAPER}" -eq 1 ]]; then
# If FORCE_SUBREAPER is requested, then we set those CFLAGS for the Tini build # If FORCE_SUBREAPER is requested, then we set those CFLAGS for the Tini build
export CFLAGS export CFLAGS
fi fi
echo "CC=${CC}"
echo "CFLAGS=${CFLAGS}"
echo "ARCH_SUFFIX=${ARCH_SUFFIX-}"
echo "ARCH_NATIVE=${ARCH_NATIVE-}"
# Ensure Python output is not buffered (to make tests output clearer) # Ensure Python output is not buffered (to make tests output clearer)
export PYTHONUNBUFFERED=1 export PYTHONUNBUFFERED=1
@ -53,7 +57,7 @@ cmake "${CMAKE_ARGS[@]}"
pushd "${BUILD_DIR}" pushd "${BUILD_DIR}"
make clean make clean
make make
if [[ -n "${ARCH_NATIVE:=}" ]]; then if [[ -n "${ARCH_NATIVE-}" ]]; then
make package make package
fi fi
popd popd
@ -61,8 +65,8 @@ popd
pkg_version="$(cat "${BUILD_DIR}/VERSION")" pkg_version="$(cat "${BUILD_DIR}/VERSION")"
if [[ -n "${ARCH_NATIVE:=}" ]]; then if [[ -n "${ARCH_NATIVE-}" ]]; then
echo "Built native package (ARCH_NATIVE=${ARCH_NATIVE})" echo "Built native package (ARCH_NATIVE=${ARCH_NATIVE-})"
echo "Running smoke and internal tests" echo "Running smoke and internal tests"
BIN_TEST_DIR="${BUILD_DIR}/bin-test" BIN_TEST_DIR="${BUILD_DIR}/bin-test"
@ -194,7 +198,7 @@ if [[ -n "${ARCH_NATIVE:=}" ]]; then
# Run tests # Run tests
python "${SOURCE_DIR}/test/run_inner_tests.py" python "${SOURCE_DIR}/test/run_inner_tests.py"
else else
if [[ ! -n "${ARCH_SUFFIX:=}" ]]; then if [[ ! -n "${ARCH_SUFFIX-}" ]]; then
echo "Built cross package, but $ARCH_SUFFIX is empty!" echo "Built cross package, but $ARCH_SUFFIX is empty!"
exit 1 exit 1
fi fi
@ -210,30 +214,30 @@ mkdir -p "${DIST_DIR}"
TINIS=() TINIS=()
for tini in tini tini-static; do for tini in tini tini-static; do
if [[ -n "${ARCH_SUFFIX:=}" ]]; then if [[ -n "${ARCH_SUFFIX-}" ]]; then
to="${DIST_DIR}/${tini}-${ARCH_SUFFIX}" to="${DIST_DIR}/${tini}-${ARCH_SUFFIX}"
TINIS+=("$to") TINIS+=("$to")
cp "${BUILD_DIR}/${tini}" "$to" cp "${BUILD_DIR}/${tini}" "$to"
fi fi
if [[ -n "${ARCH_NATIVE:=}" ]]; then if [[ -n "${ARCH_NATIVE-}" ]]; then
to="${DIST_DIR}/${tini}" to="${DIST_DIR}/${tini}"
TINIS+=("$to") TINIS+=("$to")
cp "${BUILD_DIR}/${tini}" "$to" cp "${BUILD_DIR}/${tini}" "$to"
fi fi
done done
if [[ -n "${ARCH_NATIVE:=}" ]]; then if [[ -n "${ARCH_NATIVE-}" ]]; then
for pkg_format in deb rpm; do for pkg_format in deb rpm; do
src="${BUILD_DIR}/tini_${pkg_version}.${pkg_format}" src="${BUILD_DIR}/tini_${pkg_version}.${pkg_format}"
if [[ -n "${ARCH_SUFFIX:=}" ]]; then if [[ -n "${ARCH_SUFFIX-}" ]]; then
to="${DIST_DIR}/tini_${pkg_version}-${ARCH_SUFFIX}.${pkg_format}" to="${DIST_DIR}/tini_${pkg_version}-${ARCH_SUFFIX}.${pkg_format}"
TINIS+=("$to") TINIS+=("$to")
cp "$src" "$to" cp "$src" "$to"
fi fi
if [[ -n "${ARCH_NATIVE:=}" ]]; then if [[ -n "${ARCH_NATIVE-}" ]]; then
to="${DIST_DIR}/tini_${pkg_version}.${pkg_format}" to="${DIST_DIR}/tini_${pkg_version}.${pkg_format}"
TINIS+=("$to") TINIS+=("$to")
cp "$src" "$to" cp "$src" "$to"

@ -2,17 +2,23 @@
set -o errexit set -o errexit
set -o nounset set -o nounset
if [[ "$#" != 1 ]]; then
echo "Usage: $0 ARCH_SUFFIX"
exit 1
fi
suffix="$1"
REL_HERE=$(dirname "${BASH_SOURCE}") REL_HERE=$(dirname "${BASH_SOURCE}")
HERE=$(cd "${REL_HERE}"; pwd) HERE=$(cd "${REL_HERE}"; pwd)
IMG="tini" IMG="tini-build-${suffix}"
SRC="/tini" SRC="/tini"
# Cleanup the build dir # Cleanup the build dir
rm -f "${HERE}/dist"/* rm -f "${HERE}/dist"/*
# Create the build image # Create the build image
docker build -t "${IMG}" . docker build --build-arg "ARCH_SUFFIX=${suffix}" -t "${IMG}" .
# Run test without subreaper support, don't copy build files here # Run test without subreaper support, don't copy build files here
docker run -it --rm \ docker run -it --rm \
@ -22,7 +28,8 @@ docker run -it --rm \
-e FORCE_SUBREAPER="${FORCE_SUBREAPER:="1"}" \ -e FORCE_SUBREAPER="${FORCE_SUBREAPER:="1"}" \
-e GPG_PASSPHRASE="${GPG_PASSPHRASE:=}" \ -e GPG_PASSPHRASE="${GPG_PASSPHRASE:=}" \
-e CC="${CC:=gcc}" \ -e CC="${CC:=gcc}" \
-e CFLAGS="${CFLAGS-}" \
-e ARCH_NATIVE="${ARCH_NATIVE-1}" \ -e ARCH_NATIVE="${ARCH_NATIVE-1}" \
-e ARCH_SUFFIX="${ARCH_SUFFIX-}" \ -e ARCH_SUFFIX="${suffix}" \
-e MINIMAL="${MINIMAL-}" \ -e MINIMAL="${MINIMAL-}" \
"${IMG}" "${SRC}/ci/run_build.sh" "${IMG}" "${SRC}/ci/run_build.sh"

@ -4,6 +4,11 @@ set -o nounset
IMG="tini" IMG="tini"
if [[ "$#" != 1 ]]; then
echo "Usage: $0 ARCH_SUFFIX"
exit 1
fi
suffix="$1"
docker build -t "${IMG}" . IMG="tini-build-${suffix}"
python test/run_outer_tests.py "${IMG}" python test/run_outer_tests.py "${IMG}"

Loading…
Cancel
Save