Skip to content

Commit 65e256c

Browse files
authored
Try github CI (#3115)
1 parent fa55a2c commit 65e256c

9 files changed

+642
-116
lines changed

.github/workflows/main.yml

+426
Large diffs are not rendered by default.

tools/build-tests.sh

+20-41
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,33 @@
11
#!/bin/bash
22

3-
#- set -e
4-
5-
if [ ! -z "$TRAVIS_TAG" ]; then
6-
echo "No sketch builds & tests required for tagged TravisCI builds, exiting"
7-
exit 0
8-
fi
3+
# CMake Test
4+
echo -e "travis_fold:start:check_cmakelists"
5+
tools/check_cmakelists.sh
6+
if [ $? -ne 0 ]; then exit 1; fi
7+
echo -e "travis_fold:end:check_cmakelists"
98

10-
echo -e "travis_fold:start:sketch_test_env_prepare"
11-
pip install pyserial
12-
wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
13-
tar xf arduino.tar.xz
14-
mv arduino-nightly $HOME/arduino_ide
15-
mkdir -p $HOME/Arduino/libraries
16-
cd $HOME/arduino_ide/hardware
17-
mkdir espressif
18-
cd espressif
19-
ln -s $TRAVIS_BUILD_DIR esp32
20-
cd esp32
21-
git submodule update --init --recursive
22-
cd tools
23-
python get.py
24-
cd $TRAVIS_BUILD_DIR
25-
export PATH="$HOME/arduino_ide:$TRAVIS_BUILD_DIR/tools/xtensa-esp32-elf/bin:$PATH"
26-
source tools/common.sh
27-
echo -e "travis_fold:end:sketch_test_env_prepare"
9+
# ArduinoIDE Test
10+
echo -e "travis_fold:start:prep_arduino_ide"
11+
tools/prep-arduino-ide.sh
12+
if [ $? -ne 0 ]; then exit 1; fi
13+
echo -e "travis_fold:end:prep_arduino_ide"
2814

29-
echo -e "travis_fold:start:sketch_test"
30-
build_sketches $HOME/arduino_ide $TRAVIS_BUILD_DIR/libraries "-l $HOME/Arduino/libraries"
15+
echo -e "travis_fold:start:test_arduino_ide"
16+
tools/test-arduino-ide.sh
3117
if [ $? -ne 0 ]; then exit 1; fi
32-
echo -e "travis_fold:end:sketch_test"
18+
echo -e "travis_fold:end:test_arduino_ide"
3319

3420
echo -e "travis_fold:start:size_report"
3521
cat size.log
3622
echo -e "travis_fold:end:size_report"
3723

38-
echo -e "travis_fold:start:platformio_test_env_prepare"
39-
pip install -U https://github.com/platformio/platformio/archive/develop.zip && \
40-
platformio platform install https://github.com/platformio/platform-espressif32.git#feature/stage && \
41-
sed -i 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' ~/.platformio/platforms/espressif32/platform.json && \
42-
ln -s $TRAVIS_BUILD_DIR ~/.platformio/packages/framework-arduinoespressif32
24+
# PlatformIO Test
25+
echo -e "travis_fold:start:prep_platformio"
26+
tools/prep-platformio.sh
4327
if [ $? -ne 0 ]; then exit 1; fi
44-
echo -e "travis_fold:end:platformio_test_env_prepare"
28+
echo -e "travis_fold:end:prep_platformio"
4529

46-
echo -e "travis_fold:start:platformio_test"
47-
platformio ci --board esp32dev libraries/WiFi/examples/WiFiClient && \
48-
platformio ci --board esp32dev libraries/WiFiClientSecure/examples/WiFiClientSecure && \
49-
platformio ci --board esp32dev libraries/BluetoothSerial/examples/SerialToSerialBT && \
50-
platformio ci --board esp32dev libraries/BLE/examples/BLE_server && \
51-
platformio ci --board esp32dev libraries/AzureIoT/examples/GetStarted && \
52-
platformio ci --board esp32dev libraries/ESP32/examples/Camera/CameraWebServer --project-option="board_build.partitions = huge_app.csv"
30+
echo -e "travis_fold:start:test_platformio"
31+
tools/test-platformio.sh
5332
if [ $? -ne 0 ]; then exit 1; fi
54-
echo -e "travis_fold:end:platformio_test"
33+
echo -e "travis_fold:end:test_platformio"

tools/build.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
if [ ! -z "$TRAVIS_TAG" ]; then
44
# zip the package if tagged build
55
tools/build-release.sh -a$ESP32_GITHUB_TOKEN
6-
else
6+
#else
77
# run cmake and sketch tests
8-
tools/check_cmakelists.sh && tools/build-tests.sh
8+
#tools/build-tests.sh
99
fi

tools/check_cmakelists.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ set -e
1010

1111
cd "`dirname $0`/.." # cd to arduino-esp32 root
1212

13+
# pull all submodules
14+
git submodule update --init --recursive
15+
1316
# find all source files in repo
14-
#REPO_SRCS=`find cores/esp32/ libraries/ -name 'examples' -prune -o -name 'main.cpp' -prune -o -name '*.c' -print -o -name '*.cpp' -print | sort`
1517
REPO_SRCS=`find cores/esp32/ libraries/ -name 'examples' -prune -o -name '*.c' -print -o -name '*.cpp' -print | sort`
1618

1719
# find all source files named in CMakeLists.txt COMPONENT_SRCS

tools/common.sh

-72
This file was deleted.

tools/prep-arduino-ide.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
pip install pyserial
4+
wget -O arduino.tar.xz https://www.arduino.cc/download.php?f=/arduino-nightly-linux64.tar.xz
5+
tar xf arduino.tar.xz
6+
mv arduino-nightly $HOME/arduino_ide
7+
mkdir -p $HOME/Arduino/libraries
8+
9+
cd $HOME/arduino_ide/hardware
10+
mkdir espressif
11+
cd espressif
12+
ln -s $TRAVIS_BUILD_DIR esp32
13+
cd esp32/tools
14+
python get.py

tools/prep-platformio.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
pip install -U https://github.com/platformio/platformio/archive/develop.zip && \
4+
python -m platformio platform install https://github.com/platformio/platform-espressif32.git#feature/stage && \
5+
sed -i 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' ~/.platformio/platforms/espressif32/platform.json && \
6+
ln -s $TRAVIS_BUILD_DIR ~/.platformio/packages/framework-arduinoespressif32

tools/test-arduino-ide.sh

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
#!/bin/bash
2+
3+
CHUNK_INDEX=$1
4+
CHUNKS_CNT=$2
5+
if [ "$#" -lt 2 ]; then
6+
echo "Building all sketches"
7+
CHUNK_INDEX=0
8+
CHUNKS_CNT=1
9+
fi
10+
if [ "$CHUNKS_CNT" -le 0 ]; then
11+
echo "Chunks count must be positive number"
12+
exit 1
13+
fi
14+
if [ "$CHUNK_INDEX" -ge "$CHUNKS_CNT" ]; then
15+
echo "Chunk index must be less than chunks count"
16+
exit 1
17+
fi
18+
19+
export ARDUINO_IDE_PATH=$HOME/arduino_ide
20+
export ARDUINO_LIB_PATH=$HOME/Arduino/libraries
21+
export EXAMPLES_PATH=$TRAVIS_BUILD_DIR/libraries
22+
export EXAMPLES_BUILD_DIR=$TRAVIS_BUILD_DIR/build.tmp
23+
export EXAMPLES_BUILD_CMD="python tools/build.py -b esp32 -v -k -p $EXAMPLES_BUILD_DIR -l $ARDUINO_LIB_PATH "
24+
export EXAMPLES_SIZE_BIN=$TRAVIS_BUILD_DIR/tools/xtensa-esp32-elf/bin/xtensa-esp32-elf-size
25+
26+
function print_size_info()
27+
{
28+
elf_file=$1
29+
30+
if [ -z "$elf_file" ]; then
31+
printf "sketch iram0.text flash.text flash.rodata dram0.data dram0.bss dram flash\n"
32+
return 0
33+
fi
34+
35+
elf_name=$(basename $elf_file)
36+
sketch_name="${elf_name%.*}"
37+
# echo $sketch_name
38+
declare -A segments
39+
while read -a tokens; do
40+
seg=${tokens[0]}
41+
seg=${seg//./}
42+
size=${tokens[1]}
43+
addr=${tokens[2]}
44+
if [ "$addr" -eq "$addr" -a "$addr" -ne "0" ] 2>/dev/null; then
45+
segments[$seg]=$size
46+
fi
47+
done < <($EXAMPLES_SIZE_BIN --format=sysv $elf_file)
48+
49+
total_ram=$((${segments[dram0data]} + ${segments[dram0bss]}))
50+
total_flash=$((${segments[iram0text]} + ${segments[flashtext]} + ${segments[dram0data]} + ${segments[flashrodata]}))
51+
printf "%-32s %-8d %-8d %-8d %-8d %-8d %-8d %-8d\n" $sketch_name ${segments[iram0text]} ${segments[flashtext]} ${segments[flashrodata]} ${segments[dram0data]} ${segments[dram0bss]} $total_ram $total_flash
52+
return 0
53+
}
54+
55+
function build_sketch()
56+
{
57+
local sketch=$1
58+
echo -e "\n------------ Building $sketch ------------\n";
59+
rm -rf $EXAMPLES_BUILD_DIR/*
60+
time ($EXAMPLES_BUILD_CMD $sketch >build.log)
61+
local result=$?
62+
if [ $result -ne 0 ]; then
63+
echo "Build failed ($1)"
64+
echo "Build log:"
65+
cat build.log
66+
return $result
67+
fi
68+
rm build.log
69+
return 0
70+
}
71+
72+
function count_sketches()
73+
{
74+
local sketches=$(find $EXAMPLES_PATH -name *.ino)
75+
local sketchnum=0
76+
rm -rf sketches.txt
77+
for sketch in $sketches; do
78+
local sketchdir=$(dirname $sketch)
79+
local sketchdirname=$(basename $sketchdir)
80+
local sketchname=$(basename $sketch)
81+
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
82+
continue
83+
fi;
84+
if [[ -f "$sketchdir/.test.skip" ]]; then
85+
continue
86+
fi
87+
echo $sketch >> sketches.txt
88+
sketchnum=$(($sketchnum + 1))
89+
done
90+
return $sketchnum
91+
}
92+
93+
function build_sketches()
94+
{
95+
mkdir -p $EXAMPLES_BUILD_DIR
96+
local chunk_idex=$1
97+
local chunks_num=$2
98+
count_sketches
99+
local sketchcount=$?
100+
local sketches=$(cat sketches.txt)
101+
102+
local chunk_size=$(( $sketchcount / $chunks_num ))
103+
local all_chunks=$(( $chunks_num * $chunk_size ))
104+
if [ "$all_chunks" -lt "$sketchcount" ]; then
105+
chunk_size=$(( $chunk_size + 1 ))
106+
fi
107+
108+
local start_index=$(( $chunk_idex * $chunk_size ))
109+
if [ "$sketchcount" -le "$start_index" ]; then
110+
echo "Skipping job"
111+
return 0
112+
fi
113+
114+
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
115+
if [ "$end_index" -gt "$sketchcount" ]; then
116+
end_index=$sketchcount
117+
fi
118+
119+
local start_num=$(( $start_index + 1 ))
120+
#echo -e "Sketches: \n$sketches\n"
121+
echo "Found $sketchcount Sketches";
122+
echo "Chunk Count : $chunks_num"
123+
echo "Chunk Size : $chunk_size"
124+
echo "Start Sketch: $start_num"
125+
echo "End Sketch : $end_index"
126+
127+
local sketchnum=0
128+
print_size_info >size.log
129+
for sketch in $sketches; do
130+
local sketchdir=$(dirname $sketch)
131+
local sketchdirname=$(basename $sketchdir)
132+
local sketchname=$(basename $sketch)
133+
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then
134+
#echo "Skipping $sketch, beacause it is not the main sketch file";
135+
continue
136+
fi;
137+
if [[ -f "$sketchdir/.test.skip" ]]; then
138+
#echo "Skipping $sketch marked";
139+
continue
140+
fi
141+
sketchnum=$(($sketchnum + 1))
142+
if [ "$sketchnum" -le "$start_index" ]; then
143+
#echo "Skipping $sketch index low"
144+
continue
145+
fi
146+
if [ "$sketchnum" -gt "$end_index" ]; then
147+
#echo "Skipping $sketch index high"
148+
continue
149+
fi
150+
build_sketch $sketch
151+
local result=$?
152+
if [ $result -ne 0 ]; then
153+
return $result
154+
fi
155+
print_size_info $EXAMPLES_BUILD_DIR/*.elf >>size.log
156+
done
157+
return 0
158+
}
159+
160+
build_sketches $CHUNK_INDEX $CHUNKS_CNT
161+
162+
if [ $? -ne 0 ]; then exit 1; fi

tools/test-platformio.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
python -m platformio ci --board esp32dev libraries/WiFi/examples/WiFiClient && \
4+
python -m platformio ci --board esp32dev libraries/WiFiClientSecure/examples/WiFiClientSecure && \
5+
python -m platformio ci --board esp32dev libraries/BluetoothSerial/examples/SerialToSerialBT && \
6+
python -m platformio ci --board esp32dev libraries/BLE/examples/BLE_server && \
7+
python -m platformio ci --board esp32dev libraries/AzureIoT/examples/GetStarted && \
8+
python -m platformio ci --board esp32dev libraries/ESP32/examples/Camera/CameraWebServer --project-option="board_build.partitions = huge_app.csv"
9+
if [ $? -ne 0 ]; then exit 1; fi

0 commit comments

Comments
 (0)