1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
#!/bin/sh
set -eu
# keep container around if $DEBUG is set
[ -n "${DEBUG:-}" ] || OPTS="--rm"
if type podman >/dev/null 2>&1; then
RUNC=podman
else
RUNC="sudo docker"
fi
IMAGE="${1:-docker.io/amd64/ubuntu:rolling}"
[ "${IMAGE%i386*}" = "$IMAGE" ] || OPTS="${OPTS:-} --arch i386"
[ -n "${PUBLISH_TAR:-}" ] || MOUNT_MODE=":ro"
$RUNC run --interactive ${RUNC_OPTIONS:-} ${OPTS:-} --volume `pwd`:/source${MOUNT_MODE:-} "$IMAGE" /bin/sh << EOF
set -ex
# avoid meson exit code 125; https://github.com/containers/podman/issues/11540
trap '[ \$? -eq 0 ] || exit 1' EXIT
# go-faster apt
echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/90nolanguages
# upgrade
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y eatmydata
eatmydata apt-get -y --purge dist-upgrade
# install build and test dependencies
eatmydata apt-get install -y --no-install-recommends meson git pkg-config valac libglib2.0-dev libudev-dev libgudev-1.0-dev libpcap-dev python3-gi gobject-introspection libgirepository1.0-dev gir1.2-glib-2.0 gir1.2-gudev-1.0 gtk-doc-tools udev xserver-xorg-video-dummy xserver-xorg-input-evdev xserver-xorg-input-synaptics xinput procps usbutils evtest gphoto2 valgrind gcovr
# run coverage on a stable release, as it's prone to break
if grep -q jammy /etc/os-release; then
coverage=true
else
coverage=false
fi
# run build as user
useradd --create-home build
su -s /bin/sh - build << EOG
set -ex
git config --global safe.directory /source
export BRITTLE_TESTS="${BRITTLE_TESTS:-}"
cd /source
meson setup /tmp/dbg --buildtype debug --prefix /usr -Dgtk_doc=true -Db_coverage=\$coverage --werror
cd /tmp/dbg
if meson dist --help | grep -q no-tests; then
if { meson --version; echo 0.62.0; } | sort -V | head -n1 | grep -q "^0.62.0"; then
# HACK: --allow-dirty workaround for https://github.com/mesonbuild/meson/issues/10329
meson dist --no-test --allow-dirty
else
meson dist --no-test
fi
else
# HACK: force gtk-doc build for older meson releases
DESTDIR=/tmp/inst meson install
fi
meson test -v --num-processes=1
# valgrind is broken on i386
if [ "\$(dpkg --print-architecture)" = "amd64" ]; then
meson test -v --num-processes=1 --setup valgrind --no-suite fails-valgrind
fi
if [ "\$coverage" = true ]; then
ninja coverage-text
meson test -v --num-processes=1 --setup valgrind --no-suite fails-valgrind
cat meson-logs/coverage.txt
fi
EOG
# install and run check-installed; make sure there is nothing on stderr (for Debian/Ubuntu autopkgtests)
meson install -C /tmp/dbg
ldconfig
su -c 'meson test -C /tmp/dbg -v --num-processes=1 --setup installed 2>/tmp/installed-err' - build
if [ -s /tmp/installed-err ]; then
echo "installed tests have output on stderr:" >&2
cat /tmp/installed-err >&2
exit 1
fi
# check build without assertions
su - build <<EOG
set -ex
cd /source
meson setup /tmp/rel --buildtype release -Db_ndebug=true --prefix /usr -Dgtk_doc=true --werror
meson test -C /tmp/rel -v --num-processes=1
EOG
# copy release tarball to outside for the release that .travis.yml releases on
if [ -n "${PUBLISH_TAR:-}" ]; then
cp /tmp/dbg/meson-dist/umockdev-*.tar.xz /source
fi
EOF
|