build_examples.sh 780 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. #
  3. # Build all examples from the examples directory, out of tree to
  4. # ensure they can run when copied to a new directory.
  5. #
  6. # Runs as part of CI process.
  7. #
  8. # Assumes CWD is an out-of-tree build directory, and will copy examples to individual subdirectories, one by one.
  9. #
  10. [ -z ${IDF_PATH} ] && echo "IDF_PATH is not set" && exit 1
  11. EXAMPLE_NUM=1
  12. RESULT=0
  13. set -e
  14. for example in ${IDF_PATH}/examples/*; do
  15. [ -f ${example}/Makefile ] || continue
  16. echo "Building ${example} as ${EXAMPLE_NUM}..."
  17. mkdir ${EXAMPLE_NUM}
  18. cp -r ${example} ${EXAMPLE_NUM}
  19. pushd ${EXAMPLE_NUM}/`basename ${example}`
  20. # can't do "make defconfig all" as this will trip menuconfig
  21. # sometimes
  22. make defconfig && make || RESULT=$?
  23. popd
  24. EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 ))
  25. done
  26. exit $RESULT