Skip to content

Commit

Permalink
🐳
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Mar 9, 2019
1 parent 0993d6c commit 2777381
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 26 deletions.
2 changes: 0 additions & 2 deletions .ci/travis/linux/docker-compose.travis.yml
Expand Up @@ -16,8 +16,6 @@ services:
image: qgis_image
volumes:
- ${TRAVIS_BUILD_DIR}:/root/QGIS
- ${TRAVIS_BUILD_DIR}/.docker/qgis_resources/supervisor:/etc/supervisor
- ${TRAVIS_BUILD_DIR}/.docker/qgis_resources/test_runner:/usr/bin/test_runner
links:
- postgres
- mssql
Expand Down
20 changes: 13 additions & 7 deletions .ci/travis/linux/script.sh
Expand Up @@ -39,15 +39,21 @@ echo "travis_fold:end:docker_test_qgis"
# running tests for the python test runner
echo "travis_fold:start:docker_test_runners"
echo "${bold}Docker test QGIS runners${endbold}"
docker run -d --name qgis-testing-environment -v ${TRAVIS_BUILD_DIR}/tests/src/python:/tests_directory -e DISPLAY=:99 qgis_image /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
docker run -d --name qgis-testing-environment \
-v ${TRAVIS_BUILD_DIR}:/root/QGIS \
-v ${TRAVIS_BUILD_DIR}/tests/src/python:/tests_directory \
-v ${TRAVIS_BUILD_DIR}/.docker/qgis_resources/test_runner:/usr/bin/test_runner \
-v ${TRAVIS_BUILD_DIR}/.docker/qgis_resources/supervisor:/etc/supervisor \
-e QGIS_BUILD_PATH=/root/QGIS/build/output/bin/qgis \
-e TEST_RUNNER_PATH=/usr/bin/test_runner/qgis_testrunner.py \
-e DISPLAY=:99 \
qgis_image \
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf

echo "Waiting for the docker..."
until [ "`/usr/bin/docker inspect -f {{.State.Running}} qgis-testing-environment`"=="true" ]; do
printf '🐳'
sleep 0.5;
done;
# Wait for xvfb to finish starting
printf "Waiting for the docker...🐳..."
sleep 10
echo " done 🥩"
sleep 1 # Wait for xvfb to finish starting

declare -A testrunners
# Passing cases:
Expand Down
2 changes: 1 addition & 1 deletion .docker/qgis.dockerfile
Expand Up @@ -53,7 +53,7 @@ RUN cmake \
# Python testing environment setup

# Add QGIS test runner
COPY .docker/qgis_resources/test_runner/qgis_* /usr/bin/
COPY .docker/qgis_resources/test_runner/qgis_* /usr/bin

# Make all scripts executable
RUN chmod +x /usr/bin/qgis_*
Expand Down
6 changes: 5 additions & 1 deletion .docker/qgis_resources/test_runner/qgis_testrunner.sh
Expand Up @@ -10,8 +10,12 @@

TEST_NAME=$1

TEST_RUNNER_PATH=${TEST_RUNNER_PATH:-/usr/bin/qgis_testrunner.py}
QGIS_BUILD_PATH=${QGIS_BUILD_PATH:-qgis}

echo "Running test $1 ..."
OUTPUT=$(QGIS_TEST_MODULE=${TEST_NAME} unbuffer qgis --version-migration --nologo --code /usr/bin/qgis_testrunner.py "$TEST_NAME" 2>/dev/null | tee /dev/tty)
OUTPUT=$(QGIS_TEST_MODULE=${TEST_NAME} unbuffer ${QGIS_BUILD_PATH} --version-migration --nologo --code ${TEST_RUNNER_PATH} "$TEST_NAME" 2>/dev/null | tee /dev/tty)

EXIT_CODE="$?"
if [ -z "$OUTPUT" ]; then
echo "ERROR: no output from the test runner! (exit code: ${EXIT_CODE})"
Expand Down
64 changes: 49 additions & 15 deletions docker.sh
@@ -1,6 +1,7 @@
#!/usr/bin/env bash



export TRAVIS_AVAILABLE_TIME=1000000000000000000
export TRAVIS_TIMESTAMP=100000
export TRAVIS_UPLOAD_TIME=0
Expand All @@ -13,24 +14,52 @@ export TRAVIS
export DOCKER_TAG=latest
export CCACHE_DIR=/tmp/ccache

export TRAVIS_BUILD_DIR=~/opt/qgis/QGIS
export TRAVIS_BUILD_DIR=~/opt/qgis/docker_tree

#docker rm -f qgis_container || true

## build QGIS in docker
#echo "travis_fold:start:docker_build_qgis"
#echo "${bold}Docker build QGIS${endbold}"
#docker run -t --name qgis_container \
# -v ${TRAVIS_BUILD_DIR}:/root/QGIS \
# -v ${CCACHE_DIR}:/root/.ccache \
# --env-file ${TRAVIS_BUILD_DIR}/.ci/travis/linux/docker-variables.env \
# qgis/qgis3-build-deps:${DOCKER_TAG} \
# /root/QGIS/.ci/travis/linux/scripts/docker-qgis-build.sh

#docker commit qgis_container qgis_image

docker stop qgis-testing-environment || true
docker rm -f qgis-testing-environment || true

echo "hello"

docker run -d --name qgis-testing-environment -v ${TRAVIS_BUILD_DIR}/tests/src/python:/tests_directory -e DISPLAY=:99 qgis/qgis /usr/bin/supervisord -c /etc/supervisor/supervisord.conf
# -v ${TRAVIS_BUILD_DIR}/.docker/qgis_resources/supervisor:/etc/supervisor \

docker cp ${TRAVIS_BUILD_DIR}/.docker/qgis_resources/test_runner/. qgis-testing-environment:/usr/bin/
docker exec
docker cp ${TRAVIS_BUILD_DIR}/.docker/qgis_resources/supervisor/supervisord.conf qgis-testing-environment:/etc/supervisor2/
docker cp ${TRAVIS_BUILD_DIR}/.docker/qgis_resources/supervisor/supervisor.xvfb.conf qgis-testing-environment:/etc/supervisor2/supervisor.d/
docker run -d --name qgis-testing-environment \
-v ${TRAVIS_BUILD_DIR}:/root/QGIS \
-v ${TRAVIS_BUILD_DIR}/tests/src/python:/tests_directory \
-v ${TRAVIS_BUILD_DIR}/.docker/qgis_resources/test_runner:/usr/bin/test_runner \
-v ${TRAVIS_BUILD_DIR}/.docker/qgis_resources/supervisor:/etc/supervisor \
-e QGIS_BUILD_PATH=/root/QGIS/build/output/bin/qgis \
-e TEST_RUNNER_PATH=/usr/bin/test_runner/qgis_testrunner.py \
-e DISPLAY=:99 \
qgis_image \
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf


echo "Waiting for the docker..."
until [ "`docker inspect -f {{.State.Running}} qgis-testing-environment`"=="true" ]; do
printf '🐳'
sleep 0.5;
done;
echo "lol"


#docker cp ${TRAVIS_BUILD_DIR}/.docker/qgis_resources/supervisor/. qgis-testing-environment:/etc/supervisor/
#docker cp ${TRAVIS_BUILD_DIR}/.docker/qgis_resources/supervisor/supervisor.xvfb.conf qgis-testing-environment:/etc/supervisor/supervisor.d/


printf "Waiting for the docker...🐳..."
sleep 10 # Wait for xvfb to finish starting
echo " done 🥩"
sleep 1 # Wait for xvfb to finish starting


declare -A testrunners
# Passing cases:
Expand All @@ -45,9 +74,14 @@ for i in "${!testrunners[@]}"
do
echo "travis_fold:start:docker_test_runner_${i}"
echo "test ${i}..."
docker exec -it qgis-testing-environment sh -c "cd /tests_directory && qgis_testrunner.sh ${i}"
[[ $? -eq "${testrunners[$i]}" ]] && echo "success" || exit 1
docker exec -it qgis-testing-environment sh -c "cd /tests_directory && /usr/bin/test_runner/qgis_testrunner.sh ${i}"
if [[ $? -eq "${testrunners[$i]}" ]]; then
echo "success"
else
echo "exiting"
exit 1
fi
echo "travis_fold:end:docker_test_runner_${i}"
done
docker stop qgis-testing-environment
#docker stop qgis-testing-environment
echo "travis_fold:end:docker_test_runners"

0 comments on commit 2777381

Please sign in to comment.