mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
Rework CI workflows (#8688)
- split workflows into separate files to trigger by path this should help out documentation and boards / eboot / pkg files updates, since those *wont* trigger usual build stuff anymore - build*.sh whatever merged into just common.sh and build.sh trigger different parity builds, mod % rem and allow to set .ino list through the environment variable - removes unnecessary temporary files, try to use more pipes move remaining ones into cache dir instead of PWD - remove legacy TRAVIS env vars, use ESP8266_ARDUINO prefix for config - remove Windows path workarounds - hardware/ and ide/ directories are set through envionment do not force specific paths, simplify builds on local machine - sketch list is set through environment. expicit paths for Windows and macOS builders. platformio also gets a real shuffled list instead of mod and rem magic numbers - detect root of the repo through git cli, not base{name,dir} or relative paths
This commit is contained in:
@ -1,21 +1,85 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cache_dir=$(mktemp -d)
|
||||
root=$(git rev-parse --show-toplevel)
|
||||
|
||||
source "$TRAVIS_BUILD_DIR"/tests/common.sh
|
||||
ESP8266_ARDUINO_BUILD_DIR=${ESP8266_ARDUINO_BUILD_DIR:-$root}
|
||||
ESP8266_ARDUINO_BUILDER=${ESP8266_ARDUINO_BUILDER:-arduino}
|
||||
ESP8266_ARDUINO_PRESERVE_CACHE=${ESP8266_ARDUINO_PRESERVE_CACHE:-}
|
||||
|
||||
if [ -z "$BUILD_PARITY" ]; then
|
||||
mod=1
|
||||
rem=0
|
||||
elif [ "$BUILD_PARITY" = "even" ]; then
|
||||
mod=2
|
||||
rem=0
|
||||
elif [ "$BUILD_PARITY" = "odd" ]; then
|
||||
mod=2
|
||||
rem=1
|
||||
ESP8266_ARDUINO_IDE=${ESP8266_ARDUINO_IDE:-$HOME/arduino_ide}
|
||||
ESP8266_ARDUINO_HARDWARE=${ESP8266_ARDUINO_HARDWARE:-$HOME/Arduino/hardware}
|
||||
ESP8266_ARDUINO_LIBRARIES=${ESP8266_ARDUINO_LIBRARIES:-$HOME/Arduino/libraries}
|
||||
|
||||
ESP8266_ARDUINO_DEBUG=${ESP8266_ARDUINO_DEBUG:-nodebug}
|
||||
ESP8266_ARDUINO_LWIP=${ESP8266_ARDUINO_LWIP:-default}
|
||||
ESP8266_ARDUINO_SKETCHES=${ESP8266_ARDUINO_SKETCHES:-}
|
||||
|
||||
source "$root/tests/common.sh"
|
||||
|
||||
cmd=${0##*/}
|
||||
usage="
|
||||
ENVIRONMENT:
|
||||
ESP8266_ARDUINO_SKETCHES - list of .ino files; defaults to **all available examples**
|
||||
ESP8266_ARDUINO_BUILDER - arduino or platformio
|
||||
|
||||
For Arduino IDE:
|
||||
ESP8266_ARDUINO_IDE - path to the IDE (portable)
|
||||
ESP8266_ARDUINO_HARDWARE - path to the hardware directory (usually, containing our repo)
|
||||
ESP8266_ARDUINO_LIBRATIES - path to the libraries directory (external dependencies)
|
||||
ESP8266_ARDUINO_DEBUG - debug or nodebug
|
||||
ESP8266_ARDUINO_LWIP - v4 or v6
|
||||
|
||||
USAGE:
|
||||
$cmd <[even | odd]> - build every Nth, when '<N> % 2' is either even or odd
|
||||
$cmd <mod> <rem> - build every Nth, when '<N> % <mod>' is equal to 'rem'
|
||||
$cmd - build every .ino file from ESP8266_ARDUINO_SKETCHES
|
||||
"
|
||||
|
||||
mod=1
|
||||
rem=0
|
||||
|
||||
if [ "$#" -eq 1 ] ; then
|
||||
case "$1" in
|
||||
"-h")
|
||||
echo "$usage"
|
||||
exit 0
|
||||
;;
|
||||
"even")
|
||||
mod=2
|
||||
rem=0
|
||||
;;
|
||||
"odd")
|
||||
mod=2
|
||||
rem=1
|
||||
;;
|
||||
*)
|
||||
echo 'Can either be even or odd'
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
elif [ "$#" -eq 2 ] ; then
|
||||
mod=$1
|
||||
rem=$2
|
||||
elif [ "$#" -gt 2 ] ; then
|
||||
echo "$usage"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
install_arduino nodebug
|
||||
build_sketches_with_arduino "$mod" "$rem" lm2f
|
||||
if [ -z "$ESP8266_ARDUINO_SKETCHES" ] ; then
|
||||
ESP8266_ARDUINO_SKETCHES=$(find $root/libraries -name *.ino | sort)
|
||||
fi
|
||||
|
||||
rm -rf "$cache_dir"
|
||||
case "$ESP8266_ARDUINO_BUILDER" in
|
||||
"arduino")
|
||||
install_arduino "$ESP8266_ARDUINO_DEBUG"
|
||||
build_sketches_with_arduino "$mod" "$rem" "$ESP8266_ARDUINO_LWIP"
|
||||
;;
|
||||
"platformio")
|
||||
install_platformio nodemcuv2
|
||||
build_sketches_with_platformio "$mod" "$rem"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown builder! Must be either arduino or platformio"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cache_dir=$(mktemp -d)
|
||||
|
||||
source "$TRAVIS_BUILD_DIR"/tests/common.sh
|
||||
|
||||
if [ -z "$BUILD_PARITY" ]; then
|
||||
mod=1
|
||||
rem=0
|
||||
elif [ "$BUILD_PARITY" = "even" ]; then
|
||||
mod=2
|
||||
rem=0
|
||||
elif [ "$BUILD_PARITY" = "odd" ]; then
|
||||
mod=2
|
||||
rem=1
|
||||
fi
|
||||
|
||||
install_arduino nodebug
|
||||
build_sketches_with_arduino "$mod" "$rem" lm6f
|
||||
|
||||
rm -rf "$cache_dir"
|
||||
|
@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
cd $(cd ${0%/*}; pwd)/host
|
||||
|
||||
make -j ../../libraries/ESP8266WebServer/examples/FSBrowser/FSBrowser
|
@ -4,11 +4,14 @@
|
||||
|
||||
set -ev
|
||||
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
root=$(git rev-parse --show-toplevel)
|
||||
|
||||
cd $root
|
||||
tools/boards.txt.py --boardsgen --ldgen --packagegen --docgen
|
||||
|
||||
git diff --exit-code -- boards.txt \
|
||||
doc/boards.rst \
|
||||
tools/sdk/ld/
|
||||
git diff --exit-code -w -- package/package_esp8266com_index.template.json
|
||||
git diff --exit-code -- \
|
||||
boards.txt \
|
||||
doc/boards.rst \
|
||||
tools/sdk/ld/
|
||||
git diff --exit-code --ignore-all-space -- \
|
||||
package/package_esp8266com_index.template.json
|
||||
|
@ -4,6 +4,5 @@
|
||||
|
||||
set -ev
|
||||
|
||||
cd $TRAVIS_BUILD_DIR/doc
|
||||
|
||||
SPHINXOPTS="-W" make html
|
||||
root=$(git rev-parse --show-toplevel)
|
||||
env SPHINXOPTS="-W" make -C $root/doc html
|
||||
|
@ -4,13 +4,16 @@
|
||||
|
||||
set -ev
|
||||
|
||||
export PKG_URL=https://github.com/esp8266/Arduino/releases/download/$TRAVIS_TAG/esp8266-$TRAVIS_TAG.zip
|
||||
export DOC_URL=https://arduino-esp8266.readthedocs.io/en/$TRAVIS_TAG/
|
||||
root=$(git rev-parse --show-toplevel)
|
||||
tag=$ESP8266_ARDUINO_RELEASE_TAG
|
||||
|
||||
export PKG_URL=https://github.com/esp8266/Arduino/releases/download/$tag/esp8266-$tag.zip
|
||||
export DOC_URL=https://arduino-esp8266.readthedocs.io/en/$tag/
|
||||
|
||||
if [ -z "$CI_GITHUB_API_KEY" ]; then
|
||||
echo "Github API key not set. Skip building the package."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
cd $TRAVIS_BUILD_DIR/package
|
||||
cd $root/package
|
||||
./build_boards_manager_package.sh
|
||||
|
@ -1,13 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
READELF="$TRAVIS_BUILD_DIR/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-readelf"
|
||||
|
||||
set -ev
|
||||
|
||||
cd $TRAVIS_BUILD_DIR/tools
|
||||
root=$(git rev-parse --show-toplevel)
|
||||
READELF="$root/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-readelf"
|
||||
|
||||
cd $root/tools
|
||||
python3 get.py -q
|
||||
|
||||
cd $TRAVIS_BUILD_DIR/bootloaders/eboot
|
||||
cd $root/bootloaders/eboot
|
||||
|
||||
"$READELF" -x .data -x .text eboot.elf > git.txt
|
||||
make clean
|
||||
|
@ -4,12 +4,8 @@
|
||||
|
||||
set -ev
|
||||
|
||||
if [ -z "$TRAVIS_BUILD_DIR" ]; then
|
||||
export TRAVIS_BUILD_DIR=$(cd ${PWD%/*}/..; pwd)
|
||||
fi
|
||||
|
||||
cd $TRAVIS_BUILD_DIR/tests/host
|
||||
|
||||
root=$(git rev-parse --show-toplevel)
|
||||
cd $root/tests/host
|
||||
|
||||
make -j2 FORCE32=0 ssl
|
||||
for i in ../../libraries/ESP8266WiFi/examples/WiFiClient/WiFiClient \
|
||||
|
@ -2,8 +2,10 @@
|
||||
|
||||
set -ev
|
||||
|
||||
root=$(git rev-parse --show-toplevel)
|
||||
|
||||
fail=0
|
||||
for i in $(cat "$TRAVIS_BUILD_DIR/package/package_esp8266com_index.template.json" | jq '.packages[0]."tools" | .[] | .systems[] | "\(.url) \(.checksum)"' | sort -u | sed 's/ /@/'); do
|
||||
for i in $(cat "$root/package/package_esp8266com_index.template.json" | jq '.packages[0]."tools" | .[] | .systems[] | "\(.url) \(.checksum)"' | sort -u | sed 's/ /@/'); do
|
||||
url=$(echo $i | sed 's/@/ /' | cut -f2 -d\" | cut -f1 -d' ')
|
||||
sha=$(echo $i | sed 's/@/ /' | cut -f2 -d\" | cut -f2 -d' ' | cut -f2 -d:)
|
||||
echo "INFO: Checking $url"
|
||||
|
@ -4,12 +4,15 @@
|
||||
|
||||
set -e -x
|
||||
|
||||
root=$(git rev-parse --show-toplevel)
|
||||
${root}/tests/restyle.sh
|
||||
|
||||
# Revert changes which formatter might have done to the submodules,
|
||||
# as we don't want to fail the build because of the 3rd party libraries
|
||||
git --version || true
|
||||
git submodule foreach --recursive 'git reset --hard'
|
||||
root=$(git rev-parse --show-toplevel)
|
||||
|
||||
git diff --exit-code -- $TRAVIS_BUILD_DIR
|
||||
# Run formatter and compare what changed in the git tree.
|
||||
# Also revert changes which formatter might have done to the submodules,
|
||||
# as we don't want to fail the build because of the 3rd party libraries
|
||||
|
||||
cd $root
|
||||
./tests/restyle.sh
|
||||
|
||||
git submodule foreach --recursive 'git reset --hard'
|
||||
git diff --exit-code
|
||||
|
576
tests/common.sh
576
tests/common.sh
@ -1,78 +1,145 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# return 1 if this test should not be built in CI (for other archs, not needed, etc.)
|
||||
set -u -e -E -o pipefail
|
||||
|
||||
cache_dir=$(mktemp -d)
|
||||
trap 'trap_exit' EXIT
|
||||
|
||||
function trap_exit()
|
||||
{
|
||||
# workaround for macOS shipping with broken bash
|
||||
local exit_code=$?
|
||||
if [ -z "${ESP8266_ARDUINO_PRESERVE_CACHE-}" ]; then
|
||||
rm -rf "$cache_dir"
|
||||
fi
|
||||
|
||||
exit $exit_code
|
||||
}
|
||||
|
||||
function step_summary()
|
||||
{
|
||||
local header=$1
|
||||
local contents=$2
|
||||
|
||||
# ref. https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary
|
||||
if [ -n "${GITHUB_STEP_SUMMARY-}" ]; then
|
||||
{ echo "# $header"; echo '```console'; cat "$contents"; echo '```'; } \
|
||||
>> $GITHUB_STEP_SUMMARY
|
||||
else
|
||||
echo "# $header"
|
||||
cat "$contents"
|
||||
fi
|
||||
}
|
||||
|
||||
# return 0 if this sketch should not be built in CI (for other archs, not needed, etc.)
|
||||
function skip_ino()
|
||||
{
|
||||
local ino=$1
|
||||
local skiplist=""
|
||||
# Add items to the following list with "\n" netween them to skip running. No spaces, tabs, etc. allowed
|
||||
read -d '' skiplist << EOL || true
|
||||
/#attic/
|
||||
/AvrAdcLogger/
|
||||
/examplesV1/
|
||||
/RtcTimestampTest/
|
||||
/SoftwareSpi/
|
||||
/TeensyDmaAdcLogger/
|
||||
/TeensyRtcTimestamp/
|
||||
/TeensySdioDemo/
|
||||
/TeensySdioLogger/
|
||||
/UserChipSelectFunction/
|
||||
/UserSPIDriver/
|
||||
EOL
|
||||
echo $ino | grep -q -F "$skiplist"
|
||||
echo $(( 1 - $? ))
|
||||
case $1 in
|
||||
*"/#attic/"* | \
|
||||
*"/AvrAdcLogger/"* | \
|
||||
*"/examplesV1/"* | \
|
||||
*"/RtcTimestampTest/"* | \
|
||||
*"/SoftwareSpi/"* | \
|
||||
*"/TeensyDmaAdcLogger/"* | \
|
||||
*"/TeensyRtcTimestamp/"* | \
|
||||
*"/TeensySdioDemo/"* | \
|
||||
*"/TeensySdioLogger/"* | \
|
||||
*"/UserChipSelectFunction/"* | \
|
||||
*"/UserSPIDriver/"*)
|
||||
return 0
|
||||
;;
|
||||
*"Teensy"*)
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# return reason if this sketch is not the main one or it is explicitly disabled with .test.skip in its directory
|
||||
function skip_sketch()
|
||||
{
|
||||
local sketch=$1
|
||||
local sketchname=$2
|
||||
local sketchdir=$3
|
||||
local sketchdirname=$4
|
||||
|
||||
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
|
||||
echo "Skipping $sketch (not the main sketch file)"
|
||||
fi
|
||||
if skip_ino "$sketch" || [[ -f "$sketchdir/.test.skip" ]]; then
|
||||
echo "Skipping $sketch"
|
||||
fi
|
||||
}
|
||||
|
||||
function print_size_info_header()
|
||||
{
|
||||
printf "%-28s %-8s %-8s %-8s %-8s %-10s %-8s %-8s\n" sketch data rodata bss text irom0.text dram flash
|
||||
}
|
||||
|
||||
function print_size_info()
|
||||
{
|
||||
elf_file=$1
|
||||
local awk_script='
|
||||
/^\.data/ || /^\.rodata/ || /^\.bss/ || /^\.text/ || /^\.irom0\.text/{
|
||||
size[$1] = $2
|
||||
}
|
||||
|
||||
if [ -z "$elf_file" ]; then
|
||||
printf "sketch data rodata bss text irom0.text dram flash\n"
|
||||
return 0
|
||||
fi
|
||||
END {
|
||||
total_ram = size[".data"] + size[".rodata"] + size[".bss"]
|
||||
total_flash = size[".data"] + size[".rodata"] + size[".text"] + size[".irom0.text"]
|
||||
|
||||
printf "%-28s %-8d %-8d %-8d %-8d %-10d %-8d %-8d\n",
|
||||
sketch_name,
|
||||
size[".data"], size[".rodata"], size[".bss"], size[".text"], size[".irom0.text"],
|
||||
total_ram, total_flash
|
||||
}
|
||||
'
|
||||
local size=$1
|
||||
local elf_file=$2
|
||||
|
||||
local elf_name
|
||||
elf_name=$(basename $elf_file)
|
||||
sketch_name="${elf_name%.*}"
|
||||
# echo $sketch_name
|
||||
xtensa-lx106-elf-size --format=sysv $elf_file | sed s/irom0.text/irom0text/g > size.txt
|
||||
declare -A segments
|
||||
for seg in data rodata bss text irom0text; do
|
||||
segments[$seg]=$(grep ^.$seg size.txt | awk '{sum += $2} END {print sum}')
|
||||
done
|
||||
|
||||
total_ram=$((${segments[data]} + ${segments[rodata]} + ${segments[bss]}))
|
||||
total_flash=$((${segments[data]} + ${segments[rodata]} + ${segments[text]} + ${segments[irom0text]}))
|
||||
|
||||
printf "%-28s %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n" $sketch_name ${segments[data]} ${segments[rodata]} ${segments[bss]} ${segments[text]} ${segments[irom0text]} $total_ram $total_flash
|
||||
return 0
|
||||
$size --format=sysv "$elf_file" | \
|
||||
awk -v sketch_name="${elf_name%.*}" "$awk_script" -
|
||||
}
|
||||
|
||||
function build_sketches()
|
||||
{
|
||||
set +e
|
||||
local arduino=$1
|
||||
local srcpath=$2
|
||||
local build_arg=$3
|
||||
local build_dir=build.tmp
|
||||
local build_mod=$4
|
||||
local build_rem=$5
|
||||
local lwip=$6
|
||||
mkdir -p $build_dir
|
||||
local build_cmd="python3 tools/build.py -b generic -v -w all -s 4M1M -v -k --build_cache $cache_dir -p ./$build_dir -n $lwip $build_arg "
|
||||
if [ "$WINDOWS" = "1" ]; then
|
||||
# Paths to the arduino builder need to be / referenced, not our native ones
|
||||
build_cmd=$(echo $build_cmd --ide_path $arduino | sed 's/ \/c\// \//g' ) # replace '/c/' with '/'
|
||||
fi
|
||||
local sketches=$(find $srcpath -name *.ino | sort)
|
||||
print_size_info >size.log
|
||||
export ARDUINO_IDE_PATH=$arduino
|
||||
local k_partial_core_cleanup=("build.opt" "*.ino.globals.h")
|
||||
local core_path=$1
|
||||
local ide_path=$2
|
||||
local hardware_path=$3
|
||||
local library_path=$4
|
||||
local build_mod=$5
|
||||
local build_rem=$6
|
||||
local lwip=$7
|
||||
|
||||
local build_dir="$cache_dir"/build
|
||||
mkdir -p "$build_dir"
|
||||
|
||||
local build_cache="$cache_dir"/cache
|
||||
mkdir -p "$build_cache"
|
||||
|
||||
local build_cmd
|
||||
build_cmd="python3 tools/build.py"\
|
||||
" --build_cache $build_cache"\
|
||||
" --build_path $build_dir"\
|
||||
" --hardware_path $hardware_path"\
|
||||
" --ide_path $ide_path"\
|
||||
" --library_path $library_path"\
|
||||
" --lwIP $lwip"\
|
||||
" --board_name generic --verbose --warnings all"\
|
||||
" --flash_size 4M1M --keep"
|
||||
|
||||
print_size_info_header >"$cache_dir"/size.log
|
||||
|
||||
local mk_clean_core=1
|
||||
local testcnt=0
|
||||
for sketch in $sketches; do
|
||||
|
||||
for sketch in $ESP8266_ARDUINO_SKETCHES; do
|
||||
testcnt=$(( ($testcnt + 1) % $build_mod ))
|
||||
if [ $testcnt -ne $build_rem ]; then
|
||||
if [ $testcnt -ne "$build_rem" ]; then
|
||||
continue # Not ours to do
|
||||
fi
|
||||
|
||||
@ -90,20 +157,18 @@ function build_sketches()
|
||||
mk_clean_core=1
|
||||
fi
|
||||
if [ $mk_clean_core -ne 0 ]; then
|
||||
rm -rf rm $build_dir/core/*
|
||||
rm -rf "$build_dir"/core/*
|
||||
else
|
||||
# Remove sketch specific files from ./core/ between builds.
|
||||
rm -rf $build_dir/core/build.opt $build_dir/core/*.ino.globals.h
|
||||
rm -rf "$build_dir/core/build.opt" "$build_dir"/core/*.ino.globals.h
|
||||
fi
|
||||
|
||||
if [ -e $cache_dir/core/*.a ]; then
|
||||
# We need to preserve the build.options.json file and replace the last .ino
|
||||
# with this sketch's ino file, or builder will throw everything away.
|
||||
jq '."sketchLocation" = "'$sketch'"' $build_dir/build.options.json > $build_dir/build.options.json.tmp
|
||||
mv $build_dir/build.options.json.tmp $build_dir/build.options.json
|
||||
# Set the time of the cached core.a file to the future so the GIT header
|
||||
# we regen won't cause the builder to throw it out and rebuild from scratch.
|
||||
touch -d 'now + 1 day' $cache_dir/core/*.a
|
||||
jq '."sketchLocation" = "'$sketch'"' $build_dir/build.options.json \
|
||||
> "$build_dir"/build.options.json.tmp
|
||||
mv "$build_dir"/build.options.json.tmp "$build_dir"/build.options.json
|
||||
if [ $mk_clean_core -ne 0 ]; then
|
||||
# Hack workaround for CI not handling core rebuild for global options
|
||||
rm $cache_dir/core/*.a
|
||||
@ -120,167 +185,332 @@ function build_sketches()
|
||||
# Clear out the last built sketch, map, elf, bin files, but leave the compiled
|
||||
# objects in the core and libraries available for use so we don't need to rebuild
|
||||
# them each sketch.
|
||||
rm -rf $build_dir/sketch $build_dir/*.bin $build_dir/*.map $build_dir/*.elf
|
||||
rm -rf "$build_dir"/sketch \
|
||||
"$build_dir"/*.bin \
|
||||
"$build_dir"/*.map \
|
||||
"$build_dir"/*.elf
|
||||
|
||||
local sketchdir=$(dirname $sketch)
|
||||
local sketchdirname=$(basename $sketchdir)
|
||||
local sketchname=$(basename $sketch)
|
||||
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
|
||||
echo "Skipping $sketch, because it is not the main sketch file";
|
||||
continue
|
||||
fi;
|
||||
if [[ -f "$sketchdir/.test.skip" ]]; then
|
||||
echo -e "\n ------------ Skipping $sketch ------------ \n";
|
||||
local sketchdir
|
||||
sketchdir=$(dirname $sketch)
|
||||
|
||||
local sketchdirname
|
||||
sketchdirname=$(basename $sketchdir)
|
||||
|
||||
local sketchname
|
||||
sketchname=$(basename $sketch)
|
||||
|
||||
local skip
|
||||
skip=$(skip_sketch "$sketch" "$sketchname" "$sketchdir" "$sketchdirname")
|
||||
if [ -n "$skip" ]; then
|
||||
echo "$skip"
|
||||
continue
|
||||
fi
|
||||
if [[ $(skip_ino $sketch) = 1 ]]; then
|
||||
echo -e "\n ------------ Skipping $sketch ------------ \n";
|
||||
continue
|
||||
fi
|
||||
echo -e "\n ------------ Building $sketch ------------ \n";
|
||||
# $arduino --verify $sketch;
|
||||
if [ "$WINDOWS" == "1" ]; then
|
||||
sketch=$(echo $sketch | sed 's/^\/c//')
|
||||
# MINGW will try to be helpful and silently convert args that look like paths to point to a spot inside the MinGW dir. This breaks everything.
|
||||
# http://www.mingw.org/wiki/Posix_path_conversion
|
||||
# https://stackoverflow.com/questions/7250130/how-to-stop-mingw-and-msys-from-mangling-path-names-given-at-the-command-line#34386471
|
||||
export MSYS2_ARG_CONV_EXC="*"
|
||||
export MSYS_NO_PATHCONV=1
|
||||
fi
|
||||
|
||||
echo ::group::Building $sketch
|
||||
echo "$build_cmd $sketch"
|
||||
time ($build_cmd $sketch >build.log)
|
||||
local result=$?
|
||||
|
||||
local result
|
||||
time $build_cmd $sketch >"$cache_dir"/build.log \
|
||||
&& result=0 || result=1
|
||||
|
||||
if [ $result -ne 0 ]; then
|
||||
echo "Build failed ($1)"
|
||||
echo "Build log:"
|
||||
cat build.log
|
||||
set -e
|
||||
echo ::error::Build failed for $sketch
|
||||
cat "$cache_dir/build.log"
|
||||
echo ::endgroup::
|
||||
return $result
|
||||
else
|
||||
local warns=$( grep -c warning: build.log )
|
||||
if [ $warns -ne 0 ]; then
|
||||
echo "Warnings detected, log follows:"
|
||||
cat build.log
|
||||
fi
|
||||
grep -s -c warning: "$cache_dir"/build.log \
|
||||
&& step_summary "$sketch warnings" "$cache_dir/build.log"
|
||||
fi
|
||||
rm build.log
|
||||
print_size_info $build_dir/*.elf >>size.log
|
||||
|
||||
print_size_info "$core_path"/tools/xtensa-lx106-elf/bin/xtensa-lx106-elf-size \
|
||||
$build_dir/*.elf >>$cache_dir/size.log
|
||||
|
||||
echo ::endgroup::
|
||||
done
|
||||
set -e
|
||||
}
|
||||
|
||||
function check_hash()
|
||||
{
|
||||
local file=$1
|
||||
local hash=$2
|
||||
|
||||
local shasum
|
||||
case ${RUNNER_OS-} in
|
||||
"macOS")
|
||||
shasum="shasum -a 512"
|
||||
;;
|
||||
*)
|
||||
shasum="sha512sum"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$hash $file" | $shasum -c -
|
||||
}
|
||||
|
||||
function fetch_and_unpack()
|
||||
{
|
||||
local archive=$1
|
||||
local hash=$2
|
||||
local url=$3
|
||||
|
||||
test -r "$archive" \
|
||||
&& check_hash "$archive" "$hash" \
|
||||
|| { pushd "$cache_dir"
|
||||
curl --output "$archive" --location "$url";
|
||||
check_hash "$archive" "$hash";
|
||||
popd;
|
||||
mv "$cache_dir/$archive" ./"$archive"; }
|
||||
|
||||
case $archive in
|
||||
*".zip")
|
||||
unzip -q "$archive"
|
||||
;;
|
||||
*)
|
||||
tar xf "$archive"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function install_library()
|
||||
{
|
||||
local lib_path=$1
|
||||
local name=$2
|
||||
local archive=$3
|
||||
local hash=$4
|
||||
local url=$5
|
||||
|
||||
fetch_and_unpack "$archive" "$hash" "$url"
|
||||
mkdir -p "$lib_path"
|
||||
rm -rf "$lib_path/$name"
|
||||
mv "$name" "$lib_path/$name"
|
||||
}
|
||||
|
||||
function install_libraries()
|
||||
{
|
||||
mkdir -p $HOME/Arduino/libraries
|
||||
pushd $HOME/Arduino/libraries
|
||||
local core_path=$1
|
||||
local lib_path=$2
|
||||
|
||||
# install ArduinoJson library
|
||||
{ test -r ArduinoJson-v6.11.0.zip || curl --output ArduinoJson-v6.11.0.zip -L https://github.com/bblanchon/ArduinoJson/releases/download/v6.11.0/ArduinoJson-v6.11.0.zip; } && unzip -q ArduinoJson-v6.11.0.zip
|
||||
mkdir -p "$core_path"/tools/dist
|
||||
pushd "$core_path"/tools/dist
|
||||
|
||||
install_library "$lib_path" \
|
||||
"ArduinoJson" \
|
||||
"ArduinoJson-v6.11.5.zip" \
|
||||
"8b836c862e69e60c4357a5ed7cbcf1310a3bb1c6bd284fe028faaa3d9d7eed319d10febc8a6a3e06040d1c73aaba5ca487aeffe87ae9388dc4ae1677a64d602c" \
|
||||
"https://github.com/bblanchon/ArduinoJson/releases/download/v6.11.5/ArduinoJson-v6.11.5.zip"
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
function install_ide()
|
||||
{
|
||||
local idever='nightly'
|
||||
#local idever='1.8.10'
|
||||
|
||||
#local ideurl='https://www.arduino.cc/download.php?f=/arduino-nightly'
|
||||
# TODO replace ide distribution + arduino-builder with arduino-cli
|
||||
local idever='1.8.19'
|
||||
local ideurl="https://downloads.arduino.cc/arduino-$idever"
|
||||
|
||||
echo "using Arduino IDE distribution ${idever}"
|
||||
echo "Arduino IDE ${idever}"
|
||||
|
||||
local core_path=$1
|
||||
local ide_path=$2
|
||||
|
||||
local ide_path=$1
|
||||
local core_path=$2
|
||||
local debug=$3
|
||||
mkdir -p ${core_path}/tools/dist
|
||||
if [ "$WINDOWS" = "1" ]; then
|
||||
test -r ${core_path}/tools/dist/arduino-windows.zip || curl --output ${core_path}/tools/dist/arduino-windows.zip -L "${ideurl}-windows.zip"
|
||||
unzip -q ${core_path}/tools/dist/arduino-windows.zip
|
||||
mv arduino-${idever} arduino-distrib
|
||||
elif [ "$MACOSX" = "1" ]; then
|
||||
# MACOS only has next-to-obsolete Python2 installed. Install Python 3 from python.org
|
||||
wget -q https://www.python.org/ftp/python/3.7.4/python-3.7.4-macosx10.9.pkg
|
||||
sudo installer -pkg python-3.7.4-macosx10.9.pkg -target /
|
||||
# Install the Python3 certificates, because SSL connections fail w/o them and of course they aren't installed by default.
|
||||
( cd "/Applications/Python 3.7/" && sudo "./Install Certificates.command" )
|
||||
pushd ${core_path}/tools/dist
|
||||
|
||||
if [ "${RUNNER_OS-}" = "Windows" ]; then
|
||||
fetch_and_unpack "arduino-windows.zip" \
|
||||
"c4072d808aea3848bceff5772f9d1e56a0fde02366b5aa523d10975c54eee2ca8def25ee466abbc88995aa323d475065ad8eb30bf35a2aaf07f9473f9168e2da" \
|
||||
"${ideurl}-windows.zip"
|
||||
mv arduino-$idever arduino-distrib
|
||||
elif [ "${RUNNER_OS-}" = "macOS" ]; then
|
||||
fetch_and_unpack "arduino-macos.zip" \
|
||||
"053b0c1e70da9176680264e40fcb9502f45ca5a879aeb8b6f71282b38bfdb87c63ebc6b88e35ea70a73720ad439d828cc8cb110e4c6ab07357126a36ee396325" \
|
||||
"${ideurl}-macosx.zip"
|
||||
# Hack to place arduino-builder in the same spot as sane OSes
|
||||
test -r ${core_path}/tools/dist/arduino-macos.zip || wget -q -O ${core_path}/tools/dist/arduino-macos.zip "${ideurl}-macosx.zip"
|
||||
unzip -q ${core_path}/tools/dist/arduino-macos.zip
|
||||
mv Arduino.app arduino-distrib
|
||||
mv arduino-distrib/Contents/Java/* arduino-distrib/.
|
||||
else
|
||||
test -r ${core_path}/tools/dist/arduino-linux.tar.xz || wget -q -O ${core_path}/tools/dist/arduino-linux.tar.xz "${ideurl}-linux64.tar.xz"
|
||||
tar xf ${core_path}/tools/dist/arduino-linux.tar.xz
|
||||
mv arduino-${idever} arduino-distrib
|
||||
fi
|
||||
mv arduino-distrib $ide_path
|
||||
cd $ide_path/hardware
|
||||
mkdir esp8266com
|
||||
cd esp8266com
|
||||
if [ "$WINDOWS" = "1" ]; then
|
||||
cp -a $core_path esp8266
|
||||
else
|
||||
ln -s $core_path esp8266
|
||||
fetch_and_unpack "arduino-linux.tar.xz" \
|
||||
"9328abf8778200019ed40d4fc0e6afb03a4cee8baaffbcea7dd3626477e14243f779eaa946c809fb153a542bf2ed60cf11a5f135c91ecccb1243c1387be95328" \
|
||||
"${ideurl}-linux64.tar.xz"
|
||||
mv arduino-$idever arduino-distrib
|
||||
fi
|
||||
|
||||
mv arduino-distrib "$ide_path"
|
||||
popd
|
||||
}
|
||||
|
||||
function install_core()
|
||||
{
|
||||
local core_path=$1
|
||||
local hardware_core_path=$2
|
||||
local debug=$3
|
||||
|
||||
pushd "${core_path}"
|
||||
|
||||
local debug_flags=""
|
||||
if [ "$debug" = "debug" ]; then
|
||||
debug_flags="-DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM"
|
||||
debug_flags="-DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM"\
|
||||
" -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI"\
|
||||
" -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM"
|
||||
fi
|
||||
# Set custom warnings for all builds (i.e. could add -Wextra at some point)
|
||||
echo "compiler.c.extra_flags=-Wall -Wextra -Werror $debug_flags" > esp8266/platform.local.txt
|
||||
echo "compiler.cpp.extra_flags=-Wall -Wextra -Werror $debug_flags" >> esp8266/platform.local.txt
|
||||
echo "mkbuildoptglobals.extra_flags=--ci --cache_core" >> esp8266/platform.local.txt
|
||||
|
||||
# Set our custom warnings for all builds
|
||||
{ echo "compiler.c.extra_flags=-Wall -Wextra -Werror $debug_flags";
|
||||
echo "compiler.cpp.extra_flags=-Wall -Wextra -Werror $debug_flags";
|
||||
echo "mkbuildoptglobals.extra_flags=--ci --cache_core"; } \
|
||||
> platform.local.txt
|
||||
echo -e "\n----platform.local.txt----"
|
||||
cat esp8266/platform.local.txt
|
||||
cat platform.local.txt
|
||||
echo -e "\n----\n"
|
||||
cd esp8266/tools
|
||||
|
||||
pushd tools
|
||||
python3 get.py -q
|
||||
if [ "$WINDOWS" = "1" ]; then
|
||||
# Because the symlinks don't work well under Win32, we need to add the path to this copy, not the original...
|
||||
relbin=$(realpath $PWD/xtensa-lx106-elf/bin)
|
||||
export PATH="$ide_path:$relbin:$PATH"
|
||||
|
||||
popd
|
||||
popd
|
||||
|
||||
local core_dir
|
||||
core_dir=$(dirname "$hardware_core_path")
|
||||
mkdir -p "$core_dir"
|
||||
|
||||
if [ "${RUNNER_OS-}" = "Windows" ]; then
|
||||
cp -a "$core_path" "${core_dir}/esp8266"
|
||||
else
|
||||
export PATH="$ide_path:$core_path/tools/xtensa-lx106-elf/bin:$PATH"
|
||||
ln -s "$core_path" "$hardware_core_path"
|
||||
fi
|
||||
}
|
||||
|
||||
function install_arduino()
|
||||
{
|
||||
echo ::group::Install arduino
|
||||
local debug=$1
|
||||
# Install Arduino IDE and required libraries
|
||||
echo -e "travis_fold:start:sketch_test_env_prepare"
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
install_ide $HOME/arduino_ide $TRAVIS_BUILD_DIR $debug
|
||||
cd $TRAVIS_BUILD_DIR
|
||||
install_libraries
|
||||
echo -e "travis_fold:end:sketch_test_env_prepare"
|
||||
|
||||
test -d "$ESP8266_ARDUINO_IDE" \
|
||||
|| install_ide "$ESP8266_ARDUINO_BUILD_DIR" "$ESP8266_ARDUINO_IDE"
|
||||
|
||||
local hardware_core_path="$ESP8266_ARDUINO_HARDWARE/esp8266com/esp8266"
|
||||
test -d "$hardware_core_path" \
|
||||
|| install_core "$ESP8266_ARDUINO_BUILD_DIR" "$hardware_core_path" "$debug"
|
||||
|
||||
install_libraries "$ESP8266_ARDUINO_BUILD_DIR" "$ESP8266_ARDUINO_LIBRARIES"
|
||||
|
||||
echo ::endgroup::
|
||||
}
|
||||
|
||||
function arduino_lwip_menu_option()
|
||||
{
|
||||
case $1 in
|
||||
"default")
|
||||
echo "lm2f"
|
||||
;;
|
||||
"IPv6")
|
||||
echo "lm6f"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function build_sketches_with_arduino()
|
||||
{
|
||||
local build_mod=$1
|
||||
local build_rem=$2
|
||||
local lwip=$3
|
||||
|
||||
# Compile sketches
|
||||
echo -e "travis_fold:start:sketch_test"
|
||||
build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries" $build_mod $build_rem $lwip
|
||||
echo -e "travis_fold:end:sketch_test"
|
||||
local lwip
|
||||
lwip=$(arduino_lwip_menu_option $3)
|
||||
|
||||
# Generate size report
|
||||
echo -e "travis_fold:start:size_report"
|
||||
cat size.log
|
||||
echo -e "travis_fold:end:size_report"
|
||||
build_sketches "$ESP8266_ARDUINO_BUILD_DIR" \
|
||||
"$ESP8266_ARDUINO_IDE" \
|
||||
"$ESP8266_ARDUINO_HARDWARE" \
|
||||
"$ESP8266_ARDUINO_LIBRARIES" \
|
||||
"$build_mod" "$build_rem" "$lwip"
|
||||
step_summary "Size report" "$cache_dir/size.log"
|
||||
}
|
||||
|
||||
function install_platformio()
|
||||
{
|
||||
echo ::group::Install PlatformIO
|
||||
|
||||
set -e
|
||||
local board=$1
|
||||
|
||||
if [ -z "$TRAVIS_BUILD_DIR" ]; then
|
||||
echo "TRAVIS_BUILD_DIR is not set, trying to guess:"
|
||||
pushd $(dirname $0)/../ > /dev/null
|
||||
TRAVIS_BUILD_DIR=$PWD
|
||||
popd > /dev/null
|
||||
echo "TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR"
|
||||
pushd $ESP8266_ARDUINO_BUILD_DIR/tools
|
||||
python3 get.py -q
|
||||
popd
|
||||
|
||||
# we should reference our up-to-date build tools
|
||||
# ref. https://docs.platformio.org/en/latest/core/userguide/pkg/cmd_install.html
|
||||
pio pkg install --global --skip-dependencies --platform "https://github.com/platformio/platform-espressif8266.git"
|
||||
|
||||
local framework_symlink="framework-arduinoespressif8266 @ symlink://${ESP8266_ARDUINO_BUILD_DIR}"
|
||||
local toolchain_symlink="toolchain-xtensa @ symlink://${ESP8266_ARDUINO_BUILD_DIR}/tools/xtensa-lx106-elf/"
|
||||
|
||||
# pre-generate config; pio-ci with multiple '-O' replace each other instead of appending to the same named list
|
||||
# (and, it is much nicer to write this instead of a multi-line cmdline with several large strings)
|
||||
cat <<EOF > $cache_dir/platformio.ini
|
||||
[env:$board]
|
||||
platform = espressif8266
|
||||
board = $board
|
||||
framework = arduino
|
||||
platform_packages =
|
||||
${framework_symlink}
|
||||
${toolchain_symlink}
|
||||
EOF
|
||||
|
||||
# Install dependencies:
|
||||
# - esp8266/examples/ConfigFile
|
||||
pio pkg install --global --library "ArduinoJson@^6.11.0"
|
||||
|
||||
echo ::endgroup::
|
||||
}
|
||||
|
||||
function build_sketches_with_platformio()
|
||||
{
|
||||
local build_mod=$1
|
||||
local build_rem=$2
|
||||
local testcnt=0
|
||||
|
||||
for sketch in $ESP8266_ARDUINO_SKETCHES; do
|
||||
testcnt=$(( ($testcnt + 1) % $build_mod ))
|
||||
if [ $testcnt -ne $build_rem ]; then
|
||||
continue # Not ours to do
|
||||
fi
|
||||
|
||||
local sketchdir
|
||||
sketchdir=$(dirname $sketch)
|
||||
|
||||
local sketchdirname
|
||||
sketchdirname=$(basename $sketchdir)
|
||||
|
||||
local sketchname
|
||||
sketchname=$(basename $sketch)
|
||||
|
||||
local skip
|
||||
skip=$(skip_sketch "$sketch" "$sketchname" "$sketchdir" "$sketchdirname")
|
||||
if [ -n "$skip" ]; then
|
||||
echo "$skip"
|
||||
continue
|
||||
fi
|
||||
|
||||
echo ::group::Building $sketch
|
||||
|
||||
local result
|
||||
time pio ci \
|
||||
--verbose \
|
||||
--project-conf $cache_dir/platformio.ini \
|
||||
$sketchdir >$cache_dir/build.log 2>&1 \
|
||||
&& result=0 || result=1
|
||||
|
||||
if [ $result -ne 0 ]; then
|
||||
echo ::error::Build failed for $sketch
|
||||
cat "$cache_dir/build.log"
|
||||
echo ::endgroup::
|
||||
return $result
|
||||
fi
|
||||
|
||||
echo ::endgroup::
|
||||
done
|
||||
}
|
||||
|
||||
if [ -z "${ESP8266_ARDUINO_BUILD_DIR-}" ]; then
|
||||
ESP8266_ARDUINO_BUILD_DIR=$(git rev-parse --show-toplevel)
|
||||
echo "Using ESP8266_ARDUINO_BUILD_DIR=$ESP8266_ARDUINO_BUILD_DIR"
|
||||
fi
|
||||
|
@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cache_dir=$(mktemp -d)
|
||||
|
||||
source "$TRAVIS_BUILD_DIR"/tests/common.sh
|
||||
|
||||
if [ "$BUILD_PARITY" = "even" ]; then
|
||||
mod=2
|
||||
rem=0
|
||||
elif [ "$BUILD_PARITY" = "odd" ]; then
|
||||
mod=2
|
||||
rem=1
|
||||
fi
|
||||
|
||||
install_arduino debug
|
||||
build_sketches_with_arduino "$mod" "$rem" lm2f
|
||||
|
||||
rm -rf "$cache_dir"
|
@ -1,21 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cache_dir=$(mktemp -d)
|
||||
|
||||
source "$TRAVIS_BUILD_DIR"/tests/common.sh
|
||||
|
||||
if [ -z "$BUILD_PARITY" ]; then
|
||||
mod=1
|
||||
rem=0
|
||||
elif [ "$BUILD_PARITY" = "even" ]; then
|
||||
mod=2
|
||||
rem=0
|
||||
elif [ "$BUILD_PARITY" = "odd" ]; then
|
||||
mod=2
|
||||
rem=1
|
||||
fi
|
||||
|
||||
install_arduino debug
|
||||
build_sketches_with_arduino "$mod" "$rem" lm6f
|
||||
|
||||
rm -rf "$cache_dir"
|
@ -1,83 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cache_dir=$(mktemp -d)
|
||||
|
||||
source "$TRAVIS_BUILD_DIR"/tests/common.sh
|
||||
|
||||
function install_platformio()
|
||||
{
|
||||
pip3 install -U platformio
|
||||
platformio platform install "https://github.com/platformio/platform-espressif8266.git"
|
||||
# Overwrite toolchain with this PR's toolset. Probably better way to do this
|
||||
( cd $TRAVIS_BUILD_DIR/tools && python3 get.py -q )
|
||||
mv $TRAVIS_BUILD_DIR/tools/xtensa-lx106-elf ~/.platformio/packages/toolchain-xtensa-latest
|
||||
mv ~/.platformio/packages/toolchain-xtensa/package.json ~/.platformio/packages/toolchain-xtensa/.piopm ~/.platformio/packages/toolchain-xtensa-latest/
|
||||
python -c "import json; import os; fp=open(os.path.expanduser('~/.platformio/platforms/espressif8266/platform.json'), 'r+'); data=json.load(fp); data['packages']['framework-arduinoespressif8266']['version'] = '*'; del data['packages']['framework-arduinoespressif8266']['owner'];fp.seek(0); fp.truncate(); json.dump(data, fp); fp.close()"
|
||||
ln -sf $TRAVIS_BUILD_DIR ~/.platformio/packages/framework-arduinoespressif8266
|
||||
# Install dependencies:
|
||||
# - esp8266/examples/ConfigFile
|
||||
pio lib --global install "ArduinoJson@^6.11.0"
|
||||
}
|
||||
|
||||
function build_sketches_with_platformio()
|
||||
{
|
||||
set +e
|
||||
local srcpath=$1
|
||||
local build_arg=$2
|
||||
local build_mod=$3
|
||||
local build_rem=$4
|
||||
local sketches=$(find $srcpath -name *.ino | sort)
|
||||
local testcnt=0
|
||||
for sketch in $sketches; do
|
||||
testcnt=$(( ($testcnt + 1) % $build_mod ))
|
||||
if [ $testcnt -ne $build_rem ]; then
|
||||
continue # Not ours to do
|
||||
fi
|
||||
local sketchdir=$(dirname $sketch)
|
||||
local sketchdirname=$(basename $sketchdir)
|
||||
local sketchname=$(basename $sketch)
|
||||
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
|
||||
echo "Skipping $sketch, because it is not the main sketch file";
|
||||
continue
|
||||
fi;
|
||||
if [[ -f "$sketchdir/.test.skip" ]]; then
|
||||
echo -e "\n ------------ Skipping $sketch ------------ \n";
|
||||
continue
|
||||
fi
|
||||
if [[ $(skip_ino $sketch) = 1 ]]; then
|
||||
echo -e "\n ------------ Skipping $sketch ------------ \n";
|
||||
continue
|
||||
fi
|
||||
local build_cmd="pio ci $sketchdir $build_arg"
|
||||
echo -e "\n ------------ Building $sketch ------------ \n";
|
||||
echo "$build_cmd"
|
||||
time ($build_cmd >build.log)
|
||||
local result=$?
|
||||
if [ $result -ne 0 ]; then
|
||||
echo "Build failed ($1)"
|
||||
echo "Build log:"
|
||||
cat build.log
|
||||
set -e
|
||||
return $result
|
||||
fi
|
||||
rm build.log
|
||||
done
|
||||
set -e
|
||||
}
|
||||
|
||||
if [ -z "$BUILD_PARITY" ]; then
|
||||
mod=1
|
||||
rem=0
|
||||
elif [ "$BUILD_PARITY" = "even" ]; then
|
||||
mod=2
|
||||
rem=0
|
||||
elif [ "$BUILD_PARITY" = "odd" ]; then
|
||||
mod=2
|
||||
rem=1
|
||||
fi
|
||||
|
||||
install_platformio
|
||||
build_sketches_with_platformio "$TRAVIS_BUILD_DIR"/libraries "--board nodemcuv2 --verbose" "$mod" "$rem"
|
||||
|
||||
rm -rf "$cache_dir"
|
||||
|
@ -82,34 +82,41 @@ done
|
||||
git submodule update --init
|
||||
|
||||
export HOME="${TMPCI}"
|
||||
export TRAVIS_BUILD_DIR="${TMPCI}"
|
||||
export ESP8266_ARDUINO_BUILD_DIR="${TMPCI}"
|
||||
export BUILD_TYPE="$BUILD_TYPE"
|
||||
|
||||
if [ "$BUILD_TYPE" = "build" ]; then
|
||||
tests/build.sh
|
||||
|
||||
elif [ "$BUILD_TYPE" = "build_even" ]; then
|
||||
BUILD_PARITY=even tests/build.sh
|
||||
tests/build.sh even
|
||||
|
||||
elif [ "$BUILD_TYPE" = "build_odd" ]; then
|
||||
BUILD_PARITY=odd tests/build.sh
|
||||
tests/build.sh odd
|
||||
|
||||
elif [ "$BUILD_TYPE" = "debug_even" ]; then
|
||||
BUILD_PARITY=even tests/debug.sh
|
||||
env ESP8266_ARDUINO_DEBUG=debug tests/build.sh even
|
||||
|
||||
elif [ "$BUILD_TYPE" = "debug_odd" ]; then
|
||||
BUILD_PARITY=odd tests/debug.sh
|
||||
env ESP8266_ARDUINO_DEBUG=debug tests/build.sh odd
|
||||
|
||||
elif [ "$BUILD_TYPE" = "build6" ]; then
|
||||
tests/build6.sh
|
||||
env ESP8266_ARDUINO_LWIP=lm6f tests/build.sh
|
||||
|
||||
elif [ "$BUILD_TYPE" = "build6_even" ]; then
|
||||
BUILD_PARITY=even tests/build6.sh
|
||||
env ESP8266_ARDUINO_LWIP=lm6f tests/build.sh even
|
||||
|
||||
elif [ "$BUILD_TYPE" = "build6_odd" ]; then
|
||||
BUILD_PARITY=odd tests/build6.sh
|
||||
env ESP8266_ARDUINO_LWIP=lm6f tests/build.sh odd
|
||||
|
||||
elif [ "$BUILD_TYPE" = "platformio" ]; then
|
||||
tests/platformio.sh
|
||||
env ESP8266_ARDUINO_BUILDER=platformio tests/build.sh
|
||||
|
||||
elif [ "$BUILD_TYPE" = "platformio_even" ]; then
|
||||
BUILD_PARITY=even tests/platformio.sh
|
||||
env ESP8266_ARDUINO_BUILDER=platformio tests/build.sh even
|
||||
|
||||
elif [ "$BUILD_TYPE" = "platformio_odd" ]; then
|
||||
BUILD_PARITY=odd tests/platformio.sh
|
||||
env ESP8266_ARDUINO_BUILDER=platformio tests/build.sh odd
|
||||
|
||||
elif [ "$BUILD_TYPE" = host ]; then
|
||||
tests/ci/host_test.sh
|
||||
|
Reference in New Issue
Block a user