Last active
August 29, 2015 14:12
-
-
Save tednaleid/97bbe03d877a3da765a0 to your computer and use it in GitHub Desktop.
run grails tests in parallel
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
#! /usr/bin/env bash | |
command -v parallel >/dev/null 2>&1 || { echo >&2 "Please install parallel via brew: brew install parallel"; exit 1; } | |
BASE_DIR=$(cd "$(dirname "$0")"; pwd -P)/.. | |
PARALLEL_WORKERS=2 | |
export GRAILS_OPTS="-Xmx2G -Xms2g -XX:MaxPermSize=500m" | |
OPEN_TESTLOG_AND_FAIL="( open target/test-reports/html/index.html && exit 1 )" | |
TEST_APP="( grails test-app --non-interactive || $OPEN_TESTLOG_AND_FAIL )" | |
# run all commands in the heredoc in parallel, echo out full lines as they're collected with no more than $PARALLEL_WORKERS at at time | |
SHELL=/bin/bash parallel --ungroup --line-buffer -j $PARALLEL_WORKERS --no-notice << $EOF | |
$BASE_DIR/bin/testAllKarma.sh # script in same directory to run karma tests | |
echo "running test-app" && $TEST_APP | |
$EOF | |
PARALLEL_EXIT_CODE=$? | |
if [[ $PARALLEL_EXIT_CODE != 0 ]]; then | |
echo "Error running tests" | |
exit $PARALLEL_EXIT_CODE | |
else | |
echo "All tests passed successfully" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to run unit/integration/functional also in parallel, you can by making new lines for those in the parallel EOF heredoc, but you'll want to make sure that you're setting up unique working directories for each of them so they don't collide.