diff --git a/.travis.yml b/.travis.yml index 8f612c8d..4567f887 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,12 +4,12 @@ sudo: true services: - docker env: - - TEST=tests/run-ubuntu RELEASE=devel - - TEST=tests/run-ubuntu RELEASE=rolling - - TEST=tests/run-ubuntu RELEASE=latest - - TEST=tests/run-fedora RELEASE=latest - - TEST=tests/run-fedora RELEASE=rawhide -script: $TEST + - IMAGE=ubuntu:devel + - IMAGE=ubuntu:rolling + - IMAGE=ubuntu:latest + - IMAGE=fedora:latest + - IMAGE=fedora:rawhide +script: tests/run $IMAGE deploy: - provider: releases api_key: @@ -18,7 +18,7 @@ deploy: skip_cleanup: true on: tags: true - condition: "$RELEASE = devel" + condition: "$IMAGE = ubuntu:devel" - provider: pypi user: "Martin.Pitt" password: @@ -26,4 +26,4 @@ deploy: skip_cleanup: true on: tags: true - condition: "$RELEASE = devel" + condition: "$IMAGE = ubuntu:devel" diff --git a/tests/run b/tests/run new file mode 100755 index 00000000..830392a4 --- /dev/null +++ b/tests/run @@ -0,0 +1,11 @@ +#!/bin/sh +set -eux +IMAGE="$1" + +if type podman >/dev/null 2>&1; then + RUNC=podman +else + RUNC="sudo docker" +fi + +$RUNC run --interactive --rm --volume `pwd`:/source --workdir /source "$IMAGE" /bin/sh tests/run-${IMAGE%:*} diff --git a/tests/run-fedora b/tests/run-fedora old mode 100755 new mode 100644 index 3a7e791a..0380eecc --- a/tests/run-fedora +++ b/tests/run-fedora @@ -1,18 +1,5 @@ #!/bin/sh -set -eu - -if type podman >/dev/null 2>&1; then - RUNC=podman -else - RUNC="sudo docker" -fi - -$RUNC run --interactive --rm --volume `pwd`:/source fedora:${RELEASE:-latest} /bin/sh << EOF -set -ex -SUCCESS=0 - -trap "if [ \$SUCCESS -eq 0 ] && [ -n '${DEBUG:-}' ]; then echo sleeping indefinitely for debugging; sleep infinity; fi" EXIT INT QUIT PIPE - +set -eux # install build dependencies # FIXME: s/which/type in tests dnf -y install which python3-setuptools python3-nose python3-gobject-base \ @@ -24,11 +11,9 @@ mkdir -p /run/systemd/system # run build and test as user useradd build -su -s /bin/sh - build << EOG +su -s /bin/sh - build << EOF set -ex -cp -r /source /tmp +cp -r $(pwd) /tmp/source cd /tmp/source python3 setup.py test -EOG -SUCCESS=1 EOF diff --git a/tests/run-ubuntu b/tests/run-ubuntu old mode 100755 new mode 100644 index 38cac253..85993ce4 --- a/tests/run-ubuntu +++ b/tests/run-ubuntu @@ -1,17 +1,5 @@ #!/bin/sh -set -eu - -if type podman >/dev/null 2>&1; then - RUNC=podman -else - RUNC="sudo docker" -fi - -$RUNC run --interactive --rm --volume `pwd`:/source ${ARCH:-amd64}/ubuntu:${RELEASE:-rolling} /bin/sh << EOF -set -ex -SUCCESS=0 - -trap "if [ \$SUCCESS -eq 0 ] && [ -n '${DEBUG:-}' ]; then echo sleeping indefinitely for debugging; sleep infinity; fi" EXIT INT QUIT PIPE +set -eux # go-faster apt echo 'Acquire::Languages "none";' > /etc/apt/apt.conf.d/90nolanguages @@ -30,24 +18,22 @@ mkdir -p /run/systemd/system # run build and test as user useradd build -su -s /bin/sh - build << EOG +su -s /bin/sh - build << EOF set -ex -cp -r /source /tmp +cp -r $(pwd) /tmp/source cd /tmp/source python3 setup.py test python2 setup.py test # massively parallel test to check for races -for i in \\\$(seq 100); do +for i in \$(seq 100); do ( PYTHONPATH=. python3 tests/test_api.py TestTemplates || touch /tmp/fail ) & done wait [ ! -e /tmp/fail ] ./setup.py sdist -EOG - -# copy release tarball to outside -cp -r /tmp/source/dist /source/ -SUCCESS=1 EOF + +# copy release tarball to outside; for bind mounts only +[ ! -d /source ] || cp -r /tmp/source/dist /source/