diff --git a/.travis.yml b/.travis.yml index 1154194..3cfa573 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,20 @@ -sudo: required -dist: trusty language: generic -install: - - sudo add-apt-repository -y ppa:beineri/opt-qt56-trusty - - sudo apt-get update - - sudo apt-get -y install qt56declarative qt56quickcontrols qt56graphicaleffects qt56tools qt56svg - - sudo apt-get -y install xvfb +services: + - docker + +env: + - QT_VERSION=qt:5.6.1 + - QT_VERSION=qt:5.7.0 + +addons: + apt: + packages: + - xvfb script: - - source /opt/qt56/bin/qt56-env.sh - - qmake . && make && sudo make install - - xvfb-run -a -s "-screen 0 800x600x24" make check + - export PATH=$PWD/scripts:$PATH + - docker_exec.sh "qmake . && make && sudo make install && xvfb-run -a -s \\\"-screen 0 800x600x24\\\" make check" - git clean -xfd notifications: diff --git a/scripts/docker_exec.sh b/scripts/docker_exec.sh new file mode 100755 index 0000000..069c673 --- /dev/null +++ b/scripts/docker_exec.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +ENTRY_POINT="/tmp/dock_paper_entry_point.sh" +: ${QT_VERSION:="qt:5.7.0"} + +cat > ${ENTRY_POINT} << EOF +#!/bin/bash +echo "Preparing image with $QT_VERSION" +apt update &> /tmp/log && apt install sudo xvfb -y &> /tmp/log +groupadd -g $(getent group $USER | cut -d: -f3) $USER +useradd -g $USER -G sudo -N -u $UID $USER +echo "$USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers +echo "Command: $@" +/bin/su $USER -c "cd $PWD && qmake --version && $@" + +EOF +chmod +x ${ENTRY_POINT} + +VOLUMES="-v ${ENTRY_POINT}:${ENTRY_POINT}:ro" +VOLUMES="${VOLUMES} -v $PWD:$PWD" + +docker run --rm ${VOLUMES} --entrypoint=${ENTRY_POINT} approximator/$QT_VERSION +rm ${ENTRY_POINT}