1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-18 12:24:04 +03:00
esp8266/tests/run_CI_locally.sh
Max Prokhorov 0aab6ecee2
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
2022-10-31 11:13:40 -07:00

133 lines
2.8 KiB
Bash
Executable File

#!/bin/sh
# temporary directory
[ -z "${TMPCI}" ] && TMPCI=/tmp/ci
##################
set -e
TMPDIR=${TMPCI%/*}
CIDIR=${TMPCI##*/}
mkdir -p ${TMPDIR}
# set root directory into $ESP
ESP="$(cd ${0%/*}/..; pwd)"
branch=$(git rev-parse --abbrev-ref HEAD)
echo ""
echo " -- CI directory: ${TMPCI} --"
echo ""
echo "Ensure your changes are committed in current branch ${branch}"
echo ""
echo "press return to run 'git diff'"
read junk
git diff
echo "press return to run CI, or ^C"
read junk
# clone or update this repository into ${TMPDIR}/${CIDIR}
if [ -d ${TMPCI} ]; then
echo ""
echo " -- updating CI directory in ${TMPCI} --"
echo ""
(cd ${TMPCI}; git checkout master; git branch -D ${branch} || true; git checkout -b ${branch}; git pull origin ${branch})
else
echo ""
echo " -- installing CI directory in ${TMPCI} --"
echo ""
(cd ${TMPDIR}; git clone ${ESP} ${CIDIR})
fi
cd ${TMPCI}
if [ "$branch" != "$branch" ]; then
echo "branch ${cibranch} in ${TMPCI} not matching branch ${branch} in ${ESP}"
exit 1
fi
rm -rf arduino_ide arduino-nightly Arduino/libraries/ArduinoJson
while true; do
cat << EOF
Which build?
1. main
2. main + IPv6
4. debug even
5. debug odd
6. platformio
7. package
8. host
9. style
EOF
read ans
BUILD_TYPE=""
case "$ans" in
1) BUILD_TYPE=build;;
2) BUILD_TYPE=build6;;
4) BUILD_TYPE=debug_even;;
5) BUILD_TYPE=debug_odd;;
6) BUILD_TYPE=platformio;;
7) BUILD_TYPE=package;;
8) BUILD_TYPE=host;;
9) BUILD_TYPE=style;;
esac
test -z "$BUILD_TYPE" || break
done
git submodule update --init
export HOME="${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
tests/build.sh even
elif [ "$BUILD_TYPE" = "build_odd" ]; then
tests/build.sh odd
elif [ "$BUILD_TYPE" = "debug_even" ]; then
env ESP8266_ARDUINO_DEBUG=debug tests/build.sh even
elif [ "$BUILD_TYPE" = "debug_odd" ]; then
env ESP8266_ARDUINO_DEBUG=debug tests/build.sh odd
elif [ "$BUILD_TYPE" = "build6" ]; then
env ESP8266_ARDUINO_LWIP=lm6f tests/build.sh
elif [ "$BUILD_TYPE" = "build6_even" ]; then
env ESP8266_ARDUINO_LWIP=lm6f tests/build.sh even
elif [ "$BUILD_TYPE" = "build6_odd" ]; then
env ESP8266_ARDUINO_LWIP=lm6f tests/build.sh odd
elif [ "$BUILD_TYPE" = "platformio" ]; then
env ESP8266_ARDUINO_BUILDER=platformio tests/build.sh
elif [ "$BUILD_TYPE" = "platformio_even" ]; then
env ESP8266_ARDUINO_BUILDER=platformio tests/build.sh even
elif [ "$BUILD_TYPE" = "platformio_odd" ]; then
env ESP8266_ARDUINO_BUILDER=platformio tests/build.sh odd
elif [ "$BUILD_TYPE" = host ]; then
tests/ci/host_test.sh
elif [ "$BUILD_TYPE" = style ]; then
tests/ci/style_check.sh
tests/restyle.sh
else
echo "BUILD_TYPE not set or invalid"
exit 1
fi