Build examples out-of-tree as part of CI process

This commit is contained in:
Angus Gratton 2016-09-26 17:13:32 +10:00
parent 8016e862e0
commit de76546227
3 changed files with 49 additions and 0 deletions

View file

@ -69,6 +69,23 @@ build_ssc:
- chmod +x gen_misc_ng.sh
- ./gen_misc_ng.sh
build_examples:
<<: *build_template
artifacts:
paths:
- build_examples/*/*/build/*.bin
- build_examples/*/*/build/*.elf
- build_examples/*/*/build/*.map
- build_examples/*/*/build/bootloader/*.bin
expire_in: 6 mos
script:
# it's not possible to build 100% out-of-tree and have the "artifacts"
# mechanism work, but this is the next best thing
- mkdir build_examples
- cd build_examples
- ${IDF_PATH}/make/build_examples.sh
test_nvs_on_host:
stage: test
image: espressif/esp32-ci-env

View file

@ -13,3 +13,4 @@ sdkconfig: sdkconfig.defaults
$(Q) cp $< $@
menuconfig: sdkconfig
defconfig: sdkconfig

31
make/build_examples.sh Executable file
View file

@ -0,0 +1,31 @@
#!/bin/bash
#
# Build all examples from the examples directory, out of tree to
# ensure they can run when copied to a new directory.
#
# Runs as part of CI process.
#
# Assumes CWD is an out-of-tree build directory, and will copy examples to individual subdirectories, one by one.
#
[ -z ${IDF_PATH} ] && echo "IDF_PATH is not set" && exit 1
EXAMPLE_NUM=1
RESULT=0
set -e
for example in ${IDF_PATH}/examples/*; do
[ -f ${example}/Makefile ] || continue
echo "Building ${example} as ${EXAMPLE_NUM}..."
mkdir ${EXAMPLE_NUM}
cp -r ${example} ${EXAMPLE_NUM}
pushd ${EXAMPLE_NUM}/`basename ${example}`
# can't do "make defconfig all" as this will trip menuconfig
# sometimes
make defconfig && make || RESULT=$?
popd
EXAMPLE_NUM=$(( $EXAMPLE_NUM + 1 ))
done
exit $RESULT