Last active
April 19, 2016 19:14
-
-
Save adamrneary/f5281e30df16b8466426af0f16e44cd5 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 -x | |
| if [ $CIRCLE_NODE_TOTAL -gt 1 ] | |
| then | |
| echo $CIRCLE_NODE_TOTAL 'Circle CI nodes. Running tests in parallel.' | |
| echo 'This is Circle CI node' $CIRCLE_NODE_INDEX'.' | |
| # First worker should just run unit tests | |
| if [ $CIRCLE_NODE_INDEX -eq 0 ] | |
| then | |
| # ESLint | |
| ./node_modules/eslint/bin/eslint.js src/ | |
| if [ $? -gt 0 ] ; then exit 1; fi | |
| # Mocha | |
| mocha | |
| if [ $? -gt 0 ] ; then exit 1; fi | |
| fi | |
| # Other workers should divy up the integration tests | |
| if [ $CIRCLE_NODE_INDEX -gt 0 ] | |
| then | |
| ./script/wait-for-dependencies.sh | |
| i=0 | |
| for testfile in $(find ./integrationTests/tests -name "*.js" | sort); do | |
| if [ $(expr $i % $(expr $CIRCLE_NODE_TOTAL - 1)) -eq $(expr $CIRCLE_NODE_INDEX - 1) ] | |
| then | |
| echo ${testfile} | |
| ./script/running-or-rerun.sh "log-`date '+%s%N'`.log" nightwatch --env localChrome --test ${testfile} --output $CIRCLE_TEST_REPORTS/nightwatch | |
| if [ $? -gt 0 ] ; then exit 1; fi | |
| fi | |
| ((i=i+1)) | |
| done | |
| fi | |
| fi | |
| if [ $CIRCLE_NODE_TOTAL -eq 1 ] | |
| then | |
| echo $CIRCLE_NODE_TOTAL 'Circle CI nodes. Running tests in series.' | |
| ./node_modules/eslint/bin/eslint.js src/ | |
| if [ $? -gt 0 ] ; then exit 1; fi | |
| mocha | |
| if [ $? -gt 0 ] ; then exit 1; fi | |
| ./script/wait-for-dependencies.sh | |
| nightwatch --env localChrome | |
| fi | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment