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
|
#!/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/alpine}"
[ "${IMAGE%i386*}" = "$IMAGE" ] || OPTS="${OPTS:-} --arch i386"
$RUNC run --interactive ${OPTS:-} --volume `pwd`:/source:ro "$IMAGE" /bin/sh <<EOF
# avoid meson exit code 125; https://github.com/containers/podman/issues/11540
trap '[ \$? -eq 0 ] || exit 1' EXIT
# install build dependencies
apk add --no-cache meson git gcc musl-dev glib-dev eudev eudev-dev libpcap-dev make vala linux-headers xz usbutils ${EXTRA_PACKAGES:-}
# run build as user
adduser -D 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 --werror
meson test -C /tmp/dbg -v --num-processes=1
DESTDIR=/tmp/inst meson install -C /tmp/dbg
echo "===== tests done; install tree: ===="
ls -lR /tmp/inst
EOG
EOF
|