-
Notifications
You must be signed in to change notification settings - Fork 13.3k
/
Copy pathrun_CI_locally.sh
executable file
·119 lines (97 loc) · 2.67 KB
/
run_CI_locally.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/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
3. debug even
4. debug odd
5. platformio
6. package
7. host
8. style
EOF
read ans
BUILD_TYPE=""
case "$ans" in
1) BUILD_TYPE=build;;
2) BUILD_TYPE=build6;;
3) BUILD_TYPE=debug_even;;
4) BUILD_TYPE=debug_odd;;
5) BUILD_TYPE=platformio;;
6) BUILD_TYPE=package;;
7) BUILD_TYPE=host;;
8) BUILD_TYPE=style;;
esac
test -z "$BUILD_TYPE" || break
done
# use pip2 for python2 with python3 is around, platformio doesn't like it
cp tests/platformio.sh tests/platformio-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