-
-
Save dfeyer/8c0f18a47a72e81e1afa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
EXIT_STATUS=0 | |
echo "#!/bin/bash" > ./docker-travis-test.sh | |
cat .travis.yml | shyaml get-values before_script >> ./docker-travis-test.sh | |
cat .travis.yml | shyaml get-values script >> ./docker-travis-test.sh | |
PHP_VERSIONS=`cat .travis.yml | shyaml get-values php` | |
for PHP_VERSION in $PHP_VERSIONS | |
do | |
echo | |
echo "Running tests for PHP $PHP_VERSION" | |
echo "===================================" | |
DOCKER_IMG=debian/$PHP_VERSION | |
DOCKER_ID=$(docker run -d -t $DOCKER_IMG /bin/bash) | |
docker run -v `pwd`:/project -w "/project" -t $DOCKER_IMG /bin/bash ./docker-travis-test.sh | |
CODE=$? | |
case "$CODE" in | |
0) RESULT="OK" | |
OUTPUT="${OUTPUT}PHP ${PHP_VERSION}: OK \n" | |
;; | |
*) | |
RESULT="ERROR ($CODE)" | |
OUTPUT="${OUTPUT}PHP ${PHP_VERSION}: Error (code ${CODE}) \n" | |
EXIT_STATUS=1 | |
;; | |
esac | |
DOCKER_IDS="${DOCKER_IDS} ${DOCKER_ID}" | |
done | |
docker restart $DOCKER_ID | |
$(docker wait ${DOCKER_IDS}) | |
echo | |
echo "Results" | |
echo "===================================" | |
echo -e $OUTPUT; | |
exit $EXIT_STATUS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment