Jenkins shell command for continues delivery on angularjs

Posted: March 13, 2015 in web

npm cache clean
npm install
grunt build
grunt test

webdriver-manager update
webdriver-manager start > /dev/null 2>&1 &
while ! curl http://localhost:4444/wd/hub/status &>/dev/null; do :; done
grunt test-e2e

numUnit=$(cat coverage/index.html | grep ‘.’ | awk ‘FNR == 3 {print}’ | awk -F'[^0-9]*’ ‘$0=$2’)

num=$(cat coverage-e2e/lcov-report/index.html | grep ‘.’ | awk ‘FNR == 3 {print}’ | awk -F'[^0-9]*’ ‘$0=$2’)

limit=63
deploy=0

if (( “$numUnit” <= $limit )); then
deploy=1
echo "Unit test code coverage of $numUnit% too low to deploy. It needs to be at least $limit% please add more unit test"
fi
if (( "$num" <= $limit )); then
deploy=1
echo "e2e test code coverage of $num% too low to deploy. It needs to be at least $limit% please add more e2e test"
fi
if (( "$deploy" != 0 )); then
exit 1
fi

After if success:

Exec Windows Batch Command to deploy:

xcopy www \\somedevserver\c$\htdocs\demo\ /s /i /Y

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s