Skip to content

Commit

Permalink
chore(travis): fix travis to fail on single step failure
Browse files Browse the repository at this point in the history
  • Loading branch information
kopach authored Jun 23, 2020
1 parent eaa02bd commit c9714b6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
23 changes: 3 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,9 @@ node_js:
- 12
- 13
script:
- |
start_lint=$(date +%s)
npm run lint
duration_lint=$(echo "$(date +%s) - $start_lint" | bc)
echo "Lint time: ${duration_lint}s"
echo "${duration_lint}s" > lint-execution-time.log
- |
start_build=$(date +%s)
npm run build
duration_build=$(echo "$(date +%s) - $start_build" | bc)
echo "Build time ${duration_build}s"
echo "${duration_build}s" > build-execution-time.log
- |
start_test=$(date +%s)
npm run test:ci
duration_test=$(echo "$(date +%s) - $start_test" | bc)
echo "Test time ${duration_test}s"
echo "${duration_test}s" > test-execution-time.log
- ./scripts/npm_run_time.sh lint
- ./scripts/npm_run_time.sh build
- ./scripts/npm_run_time.sh test:ci

after_success:
- scripts/seriesci.sh
17 changes: 17 additions & 0 deletions scripts/npm_run_time.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

script_name=$1

startTime=$(date +%s)

cmd="npm run ${script_name}"
$cmd
cmdExitCode=$(echo $? | bc -l)

if [ $cmdExitCode -ne 0 ]; then
exit ${cmdExitCode}
else
duration=$(echo "$(date +%s) - $startTime" | bc)
echo "${script_name} time: ${duration}s"
echo "${duration}s" > ${script_name}-execution-time.log
fi

0 comments on commit c9714b6

Please sign in to comment.