mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Split common.sh into separate scripts for each job (#5569)
This commit is contained in:
parent
dc03293d82
commit
187f6a58b8
39
.travis.yml
39
.travis.yml
@ -20,49 +20,50 @@ stages:
|
|||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
# Build stage. To save time, run all kinds of builds and tests in parallel.
|
# Build stage. To save time, run all kinds of builds and tests in parallel.
|
||||||
# TODO: since we can now call different script for each job,
|
|
||||||
# split the do-it-all common.sh into separate scripts responsible
|
|
||||||
# for different types of jobs below:
|
|
||||||
- name: "Platformio (1)"
|
- name: "Platformio (1)"
|
||||||
stage: build
|
stage: build
|
||||||
script: $TRAVIS_BUILD_DIR/tests/common.sh
|
script: $TRAVIS_BUILD_DIR/tests/platformio.sh
|
||||||
env:
|
env:
|
||||||
- BUILD_TYPE=platformio_even
|
- BUILD_PARITY=even
|
||||||
- name: "Platformio (2)"
|
- name: "Platformio (2)"
|
||||||
stage: build
|
stage: build
|
||||||
script: $TRAVIS_BUILD_DIR/tests/common.sh
|
script: $TRAVIS_BUILD_DIR/tests/platformio.sh
|
||||||
env:
|
env:
|
||||||
- BUILD_TYPE=platformio_odd
|
- BUILD_PARITY=odd
|
||||||
|
|
||||||
- name: "Build (1)"
|
- name: "Build (1)"
|
||||||
stage: build
|
stage: build
|
||||||
script: $TRAVIS_BUILD_DIR/tests/common.sh
|
script: $TRAVIS_BUILD_DIR/tests/build.sh
|
||||||
env:
|
env:
|
||||||
- BUILD_TYPE=build_even
|
- BUILD_PARITY=even
|
||||||
- name: "Build (2)"
|
- name: "Build (2)"
|
||||||
stage: build
|
stage: build
|
||||||
script: $TRAVIS_BUILD_DIR/tests/common.sh
|
script: $TRAVIS_BUILD_DIR/tests/build.sh
|
||||||
env:
|
env:
|
||||||
- BUILD_TYPE=build_odd
|
- BUILD_PARITY=odd
|
||||||
|
|
||||||
- name: "Debug (1)"
|
- name: "Debug (1)"
|
||||||
stage: build
|
stage: build
|
||||||
script: $TRAVIS_BUILD_DIR/tests/common.sh
|
script: $TRAVIS_BUILD_DIR/tests/debug.sh
|
||||||
env:
|
env:
|
||||||
- BUILD_TYPE=debug_even
|
- BUILD_PARITY=even
|
||||||
- name: "Debug (2)"
|
- name: "Debug (2)"
|
||||||
stage: build
|
stage: build
|
||||||
script: $TRAVIS_BUILD_DIR/tests/common.sh
|
script: $TRAVIS_BUILD_DIR/tests/debug.sh
|
||||||
env:
|
env:
|
||||||
- BUILD_TYPE=debug_odd
|
- BUILD_PARITY=odd
|
||||||
|
|
||||||
- name: "Build IPv6 (1)"
|
- name: "Build IPv6 (1)"
|
||||||
stage: build
|
stage: build
|
||||||
script: $TRAVIS_BUILD_DIR/tests/common.sh
|
script: $TRAVIS_BUILD_DIR/tests/build6.sh
|
||||||
env:
|
env:
|
||||||
- BUILD_TYPE=build6_even
|
- BUILD_PARITY=even
|
||||||
- name: "Build IPv6 (2)"
|
- name: "Build IPv6 (2)"
|
||||||
stage: build
|
stage: build
|
||||||
script: $TRAVIS_BUILD_DIR/tests/common.sh
|
script: $TRAVIS_BUILD_DIR/tests/build6.sh
|
||||||
env:
|
env:
|
||||||
- BUILD_TYPE=build6_odd
|
- BUILD_PARITY=odd
|
||||||
|
|
||||||
- name: "Host tests"
|
- name: "Host tests"
|
||||||
stage: build
|
stage: build
|
||||||
|
22
tests/build.sh
Executable file
22
tests/build.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/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" lm2f
|
||||||
|
|
||||||
|
rm -rf "$cache_dir"
|
||||||
|
|
22
tests/build6.sh
Executable file
22
tests/build6.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/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"
|
||||||
|
|
@ -141,59 +141,6 @@ function install_ide()
|
|||||||
export PATH="$ide_path:$core_path/tools/xtensa-lx106-elf/bin:$PATH"
|
export PATH="$ide_path:$core_path/tools/xtensa-lx106-elf/bin:$PATH"
|
||||||
}
|
}
|
||||||
|
|
||||||
function install_platformio()
|
|
||||||
{
|
|
||||||
pip install --user -U https://github.com/platformio/platformio/archive/develop.zip
|
|
||||||
platformio platform install "https://github.com/platformio/platform-espressif8266.git#feature/stage"
|
|
||||||
sed -i 's/https:\/\/github\.com\/esp8266\/Arduino\.git/*/' ~/.platformio/platforms/espressif8266/platform.json
|
|
||||||
ln -s $TRAVIS_BUILD_DIR ~/.platformio/packages/framework-arduinoespressif8266
|
|
||||||
# Install dependencies:
|
|
||||||
# - esp8266/examples/ConfigFile
|
|
||||||
pio lib install ArduinoJson
|
|
||||||
}
|
|
||||||
|
|
||||||
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, beacause it is not the main sketch file";
|
|
||||||
continue
|
|
||||||
fi;
|
|
||||||
if [[ -f "$sketchdir/.test.skip" ]]; 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
|
|
||||||
}
|
|
||||||
|
|
||||||
function install_arduino()
|
function install_arduino()
|
||||||
{
|
{
|
||||||
local debug=$1
|
local debug=$1
|
||||||
@ -235,48 +182,3 @@ if [ -z "$TRAVIS_BUILD_DIR" ]; then
|
|||||||
echo "TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR"
|
echo "TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cache_dir=$(mktemp -d)
|
|
||||||
|
|
||||||
if [ "$BUILD_TYPE" = "build" ]; then
|
|
||||||
install_arduino nodebug
|
|
||||||
build_sketches_with_arduino 1 0 lm2f
|
|
||||||
elif [ "$BUILD_TYPE" = "build6" ]; then
|
|
||||||
install_arduino nodebug
|
|
||||||
build_sketches_with_arduino 1 0 lm6f
|
|
||||||
elif [ "$BUILD_TYPE" = "build_even" ]; then
|
|
||||||
install_arduino nodebug
|
|
||||||
build_sketches_with_arduino 2 0 lm2f
|
|
||||||
elif [ "$BUILD_TYPE" = "build_odd" ]; then
|
|
||||||
install_arduino nodebug
|
|
||||||
build_sketches_with_arduino 2 1 lm2f
|
|
||||||
elif [ "$BUILD_TYPE" = "debug_even" ]; then
|
|
||||||
install_arduino debug
|
|
||||||
build_sketches_with_arduino 2 0 lm2f
|
|
||||||
elif [ "$BUILD_TYPE" = "debug_odd" ]; then
|
|
||||||
install_arduino debug
|
|
||||||
build_sketches_with_arduino 2 1 lm2f
|
|
||||||
elif [ "$BUILD_TYPE" = "build6_even" ]; then
|
|
||||||
install_arduino nodebug
|
|
||||||
build_sketches_with_arduino 2 0 lm6f
|
|
||||||
elif [ "$BUILD_TYPE" = "build6_odd" ]; then
|
|
||||||
install_arduino nodebug
|
|
||||||
build_sketches_with_arduino 2 1 lm6f
|
|
||||||
elif [ "$BUILD_TYPE" = "platformio" ]; then
|
|
||||||
# PlatformIO
|
|
||||||
install_platformio
|
|
||||||
build_sketches_with_platformio $TRAVIS_BUILD_DIR/libraries "--board nodemcuv2 --verbose" 1 0
|
|
||||||
elif [ "$BUILD_TYPE" = "platformio_even" ]; then
|
|
||||||
# PlatformIO
|
|
||||||
install_platformio
|
|
||||||
build_sketches_with_platformio $TRAVIS_BUILD_DIR/libraries "--board nodemcuv2 --verbose" 2 0
|
|
||||||
elif [ "$BUILD_TYPE" = "platformio_odd" ]; then
|
|
||||||
# PlatformIO
|
|
||||||
install_platformio
|
|
||||||
build_sketches_with_platformio $TRAVIS_BUILD_DIR/libraries "--board nodemcuv2 --verbose" 2 1
|
|
||||||
else
|
|
||||||
echo "BUILD_TYPE not set or invalid"
|
|
||||||
rm -rf $cache_dir
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf $cache_dir
|
|
||||||
|
19
tests/debug.sh
Executable file
19
tests/debug.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/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"
|
||||||
|
|
75
tests/platformio.sh
Executable file
75
tests/platformio.sh
Executable file
@ -0,0 +1,75 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cache_dir=$(mktemp -d)
|
||||||
|
|
||||||
|
source "$TRAVIS_BUILD_DIR"/tests/common.sh
|
||||||
|
|
||||||
|
function install_platformio()
|
||||||
|
{
|
||||||
|
pip install --user -U https://github.com/platformio/platformio/archive/develop.zip
|
||||||
|
platformio platform install "https://github.com/platformio/platform-espressif8266.git#feature/stage"
|
||||||
|
sed -i 's/https:\/\/github\.com\/esp8266\/Arduino\.git/*/' ~/.platformio/platforms/espressif8266/platform.json
|
||||||
|
ln -s $TRAVIS_BUILD_DIR ~/.platformio/packages/framework-arduinoespressif8266
|
||||||
|
# Install dependencies:
|
||||||
|
# - esp8266/examples/ConfigFile
|
||||||
|
pio lib install ArduinoJson
|
||||||
|
}
|
||||||
|
|
||||||
|
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, beacause it is not the main sketch file";
|
||||||
|
continue
|
||||||
|
fi;
|
||||||
|
if [[ -f "$sketchdir/.test.skip" ]]; 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"
|
||||||
|
|
@ -79,7 +79,41 @@ EOF
|
|||||||
done
|
done
|
||||||
|
|
||||||
# use pip2 for python2 with python3 is around, platformio doesn't like it
|
# use pip2 for python2 with python3 is around, platformio doesn't like it
|
||||||
cp tests/common.sh tests/common-custom.sh
|
cp tests/platformio.sh tests/platformio-custom.sh
|
||||||
sed -i 's,pip ,pip2 ,g' tests/common-custom.sh
|
sed -i 's,pip ,pip2 ,g' tests/platformio-custom.sh
|
||||||
|
|
||||||
|
export HOME="${TMPCI}"
|
||||||
|
export TRAVIS_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
|
||||||
|
elif [ "$BUILD_TYPE" = "build_odd" ]; then
|
||||||
|
BUILD_PARITY=odd tests/build.sh
|
||||||
|
|
||||||
|
elif [ "$BUILD_TYPE" = "debug_even" ]; then
|
||||||
|
BUILD_PARITY=even tests/debug.sh
|
||||||
|
elif [ "$BUILD_TYPE" = "debug_odd" ]; then
|
||||||
|
BUILD_PARITY=odd tests/debug.sh
|
||||||
|
|
||||||
|
elif [ "$BUILD_TYPE" = "build6" ]; then
|
||||||
|
tests/build6.sh
|
||||||
|
elif [ "$BUILD_TYPE" = "build6_even" ]; then
|
||||||
|
BUILD_PARITY=even tests/build6.sh
|
||||||
|
elif [ "$BUILD_TYPE" = "build6_odd" ]; then
|
||||||
|
BUILD_PARITY=odd tests/build6.sh
|
||||||
|
|
||||||
|
elif [ "$BUILD_TYPE" = "platformio" ]; then
|
||||||
|
tests/platformio-custom.sh
|
||||||
|
elif [ "$BUILD_TYPE" = "platformio_even" ]; then
|
||||||
|
BUILD_PARITY=even tests/platformio-custom.sh
|
||||||
|
elif [ "$BUILD_TYPE" = "platformio_odd" ]; then
|
||||||
|
BUILD_PARITY=odd tests/platformio-custom.sh
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "BUILD_TYPE not set or invalid"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
HOME=${TMPCI} TRAVIS_BUILD_DIR=${TMPCI} BUILD_TYPE=$BUILD_TYPE tests/common-custom.sh
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user