cibuild.sh 636 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. # Exit code starts at 0 but is modified if any checks fail
  3. EXIT=0
  4. # Output a line prefixed with a timestamp
  5. info()
  6. {
  7. echo "$(date +'%F %T') |"
  8. }
  9. # Track number of seconds required to run script
  10. START=$(date +%s)
  11. echo "$(info) starting build checks."
  12. # Syntax check all python source files
  13. SYNTAX=$(find . -name "*.py" -type f -exec python -m py_compile {} \; 2>&1)
  14. if [[ ! -z $SYNTAX ]]; then
  15. echo -e "$SYNTAX"
  16. echo -e "\n$(info) detected one or more syntax errors, failing build."
  17. EXIT=1
  18. fi
  19. # Show build duration
  20. END=$(date +%s)
  21. echo "$(info) exiting with code $EXIT after $(($END - $START)) seconds."
  22. exit $EXIT