Created
November 4, 2014 13:05
-
-
Save kamaulynder/7e9fa06d2165b1a3275c to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| cd . | |
| START_TIME=$(date +%s) | |
| # Check if behat, phpunit and phpspec is installed | |
| if [ ! -f "bin/phpspec" ] || [ ! -f "bin/behat" ] || [ ! -f "bin/phpunit" ]; then | |
| # Install behat | |
| echo "Installing testing tools..." | |
| curl http://getcomposer.org/installer | php | |
| php composer.phar install | |
| fi | |
| # Check if the jenkins directory exists | |
| if [ ! -d jenkins ]; then | |
| mkdir -p jenkins | |
| fi | |
| # Remove all previous files in the jenkins directory | |
| rm -f jenkins/*.* | |
| # Run phpspec | |
| echo "Running phpspec tests..." | |
| bin/phpspec run --format=pretty | |
| PHPSPEC_STATUS=$? | |
| # Run behat | |
| echo "Running behat tests..." | |
| bin/behat --colors --format=pretty --strict | |
| BEHAT_STATUS=$? | |
| # Run PHPUnit | |
| echo "Running phpunit tests..." | |
| bin/phpunit --strict --colors | |
| PHPUNIT_STATUS=$? | |
| END_TIME=$(date +%s) | |
| ELAPSED_TIME=$((END_TIME - START_TIME)) | |
| if [[ $PHPSPEC_STATUS == 0 && $BEHAT_STATUS == 0 && $PHPUNIT_STATUS == 0 ]]; then | |
| echo "All tests run successfully (${ELAPSED_TIME} seconds)" | |
| else | |
| echo "Some tests failed (${ELAPSED_TIME} seconds)" | |
| exit 1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment