Merge branch 'ci/cmake_examples_multichip_support' into 'master'
ci: multichip build support for examples See merge request espressif/esp-idf!5384
This commit is contained in:
commit
c3cc096af0
5 changed files with 56 additions and 15 deletions
|
@ -34,7 +34,7 @@ set -o pipefail # Exit if pipe failed.
|
|||
# Remove the initial space and instead use '\n'.
|
||||
IFS=$'\n\t'
|
||||
|
||||
export PATH="$IDF_PATH/tools:$PATH" # for idf.py
|
||||
export PATH="$IDF_PATH/tools/ci:$IDF_PATH/tools:$PATH"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
|
@ -49,7 +49,7 @@ die() {
|
|||
|
||||
set -o nounset # Exit if variable not set.
|
||||
|
||||
echo "build_examples running in ${PWD}"
|
||||
echo "build_examples running in ${PWD} for target $IDF_TARGET"
|
||||
|
||||
# only 0 or 1 arguments
|
||||
[ $# -le 1 ] || die "Have to run as $(basename $0) [<JOB_NAME>]"
|
||||
|
@ -66,7 +66,9 @@ LOG_SUSPECTED=${LOG_PATH}/common_log.txt
|
|||
touch ${LOG_SUSPECTED}
|
||||
SDKCONFIG_DEFAULTS_CI=sdkconfig.ci
|
||||
|
||||
EXAMPLE_PATHS=$( find ${IDF_PATH}/examples/ -type f -name CMakeLists.txt | grep -v "/components/" | grep -v "/common_components/" | grep -v "/main/" | grep -v "/idf_as_lib/stubs/" | sort )
|
||||
EXAMPLE_PATHS=$( get_supported_examples.sh $IDF_TARGET | sed "s#^#${IDF_PATH}\/examples\/#g" | awk '{print $0"/CmakeLists.txt"}' )
|
||||
echo "All examples found for target $IDF_TARGET:"
|
||||
echo $EXAMPLE_PATHS
|
||||
|
||||
if [ -z {CI_NODE_TOTAL} ]
|
||||
then
|
||||
|
@ -103,10 +105,10 @@ build_example () {
|
|||
local EXAMPLE_DIR=$(dirname "${CMAKELISTS}")
|
||||
local EXAMPLE_NAME=$(basename "${EXAMPLE_DIR}")
|
||||
|
||||
echo "Building ${EXAMPLE_NAME} as ${ID}..."
|
||||
mkdir -p "example_builds/${ID}"
|
||||
cp -r "${EXAMPLE_DIR}" "example_builds/${ID}"
|
||||
pushd "example_builds/${ID}/${EXAMPLE_NAME}"
|
||||
echo "Building ${EXAMPLE_NAME} for ${IDF_TARGET} as ${ID}..."
|
||||
mkdir -p "example_builds/${IDF_TARGET}/${ID}"
|
||||
cp -r "${EXAMPLE_DIR}" "example_builds/${IDF_TARGET}/${ID}"
|
||||
pushd "example_builds/${IDF_TARGET}/${ID}/${EXAMPLE_NAME}"
|
||||
# be stricter in the CI build than the default IDF settings
|
||||
export EXTRA_CFLAGS=${PEDANTIC_CFLAGS}
|
||||
export EXTRA_CXXFLAGS=${EXTRA_CFLAGS}
|
||||
|
|
|
@ -144,18 +144,18 @@ build_examples_make:
|
|||
- ${IDF_PATH}/tools/ci/build_examples.sh
|
||||
|
||||
# same as above, but for CMake
|
||||
build_examples_cmake:
|
||||
.build_examples_cmake: &build_examples_cmake
|
||||
extends: .build_template
|
||||
parallel: 5
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- build_examples_cmake/*/*/*/build/*.bin
|
||||
- build_examples_cmake/*/*/*/sdkconfig
|
||||
- build_examples_cmake/*/*/*/build/*.elf
|
||||
- build_examples_cmake/*/*/*/build/*.map
|
||||
- build_examples_cmake/*/*/*/build/flasher_args.json
|
||||
- build_examples_cmake/*/*/*/build/bootloader/*.bin
|
||||
- build_examples_cmake/*/*/*/*/build/*.bin
|
||||
- build_examples_cmake/*/*/*/*/sdkconfig
|
||||
- build_examples_cmake/*/*/*/*/build/*.elf
|
||||
- build_examples_cmake/*/*/*/*/build/*.map
|
||||
- build_examples_cmake/*/*/*/*/build/flasher_args.json
|
||||
- build_examples_cmake/*/*/*/*/build/bootloader/*.bin
|
||||
- $LOG_PATH
|
||||
expire_in: 3 days
|
||||
variables:
|
||||
|
@ -177,6 +177,11 @@ build_examples_cmake:
|
|||
- mkdir -p ${LOG_PATH}
|
||||
- ${IDF_PATH}/tools/ci/build_examples_cmake.sh
|
||||
|
||||
build_examples_cmake_esp32:
|
||||
extends: .build_examples_cmake
|
||||
variables:
|
||||
IDF_TARGET: esp32
|
||||
|
||||
# If you want to add new build example jobs, please add it into dependencies of `.example_test_template`
|
||||
|
||||
build_docs:
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
dependencies:
|
||||
- assign_test
|
||||
- build_examples_make
|
||||
- build_examples_cmake
|
||||
- build_examples_cmake_esp32
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
|
|
|
@ -40,6 +40,7 @@ tools/ci/check_ut_cmake_make.sh
|
|||
tools/ci/checkout_project_ref.py
|
||||
tools/ci/envsubst.py
|
||||
tools/ci/get-full-sources.sh
|
||||
tools/ci/get_supported_examples.sh
|
||||
tools/ci/mirror-submodule-update.sh
|
||||
tools/ci/multirun_with_pyenv.sh
|
||||
tools/ci/push_to_github.sh
|
||||
|
|
33
tools/ci/get_supported_examples.sh
Executable file
33
tools/ci/get_supported_examples.sh
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
set -o nounset
|
||||
|
||||
DEBUG_SHELL=${DEBUG_SHELL:-"0"}
|
||||
[ "${DEBUG_SHELL}" = "1" ] && set -x
|
||||
|
||||
if [[ $# < 1 ]]; then
|
||||
echo "no target specified!" >&2
|
||||
exit -1
|
||||
fi
|
||||
|
||||
cd $IDF_PATH/examples
|
||||
ALL_EXAMPLES=$( find . -type f -name CMakeLists.txt | grep -v "/components/" | grep -v "/common_components/" | grep -v "/main/" | grep -v "/idf_as_lib/stubs/" | sed "s/\/CMakeLists.txt//g" | sort )
|
||||
EXAMPLE_LIST=$( realpath --relative-to=. $ALL_EXAMPLES )
|
||||
|
||||
for EXAMPLE in $EXAMPLE_LIST
|
||||
do
|
||||
SEARCHED=$( grep -E "SUPPORTED_TARGETS" $EXAMPLE/CMakeLists.txt | sed "s/set\s*(\s*SUPPORTED_TARGETS//g" | sed "s/)//g" ) || true
|
||||
if [[ $SEARCHED == "" ]]; then
|
||||
#when SUPPORTED_TARGETS not set, allow all targets implicitly
|
||||
echo "$EXAMPLE"
|
||||
else
|
||||
for TARGET in $SEARCHED
|
||||
do
|
||||
if [[ $TARGET == $1 ]]; then
|
||||
echo "$EXAMPLE"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
Loading…
Reference in a new issue