configure_ci_environment.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # This file is sourced in to the CI environment
  2. # in .gitlab-ci.yml
  3. #
  4. # Sets the error behaviour options for shell throughout the CI environment
  5. #
  6. set -o errexit # Exit if command failed.
  7. set -o pipefail # Exit if pipe failed.
  8. # We can use the appropriate CI variable for debugging
  9. DEBUG_SHELL=${DEBUG_SHELL:-"0"}
  10. [ "${DEBUG_SHELL}" = "1" ] && set -x
  11. [ -z $CI_COMMIT_REF_NAME ] && echo "This internal script should only be run by a Gitlab CI runner." && exit 1
  12. # Compiler flags to thoroughly check the IDF code in some CI jobs
  13. # (Depends on default options '-Wno-error=XXX' used in the IDF build system)
  14. if [ "$IDF_TOOLCHAIN" != "clang" ]; then
  15. PEDANTIC_FLAGS="-Werror -Werror=deprecated-declarations -Werror=unused-variable -Werror=unused-but-set-variable -Werror=unused-function"
  16. export PEDANTIC_CFLAGS="${PEDANTIC_FLAGS} -Wstrict-prototypes"
  17. else
  18. export PEDANTIC_CFLAGS="-Werror"
  19. fi
  20. export PEDANTIC_CXXFLAGS="${PEDANTIC_FLAGS}"
  21. # ccache related settings.
  22. # IDF_CCACHE_ENABLE may be enabled at job level (see build.yml). However it is possible to override it
  23. # globally via CI_CCACHE_DISABLE, in case there are any ccache related issues.
  24. if [ "$CI_CCACHE_DISABLE" = 1 ]; then
  25. export IDF_CCACHE_ENABLE=0
  26. echo "INFO: ccache disabled globally using CI_CCACHE_DISABLE=0"
  27. fi
  28. # Set ccache base directory to the project checkout path, to cancel out differences between runners
  29. export CCACHE_BASEDIR="${CI_PROJECT_DIR}"
  30. # 'CI_CCACHE_DISABLE_NOHASHDIR' variable can be used at project level to revert to hash_dir=true, in
  31. # case we start seeing failures due to false cache hits.
  32. if [ "${CI_CCACHE_DISABLE_NOHASHDIR}" != "1" ]; then
  33. export CCACHE_NOHASHDIR="1"
  34. echo "INFO: ccache CCACHE_NOHASHDIR option is enabled"
  35. fi
  36. # If 'REDIS_CACHE' variable is set at runner (or project) level, use that as secondary ccache storage.
  37. # This can be disabled at project level using 'CI_CCACHE_DISABLE_SECONDARY', in case of issues.
  38. if [ "${CI_CCACHE_DISABLE_SECONDARY}" != "1" ] && [ -n "${REDIS_CACHE}" ]; then
  39. export CCACHE_SECONDARY_STORAGE="redis://${REDIS_CACHE}"
  40. echo "INFO: Using CCACHE_SECONDARY_STORAGE=${CCACHE_SECONDARY_STORAGE}"
  41. fi
  42. export LDGEN_CHECK_MAPPING="1"