Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d0b064a

Browse filesBrowse files
authored
Update CI scripts for better error handling (espressif#3316)
1 parent 85c77a9 commit d0b064a
Copy full SHA for d0b064a

File tree

Expand file treeCollapse file tree

4 files changed

+63
-68
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+63
-68
lines changed

‎.github/scripts/install-arduino-core-esp32.sh

Copy file name to clipboardExpand all lines: .github/scripts/install-arduino-core-esp32.sh
+15-21Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,33 @@
22

33
export ARDUINO_ESP32_PATH="$ARDUINO_USR_PATH/hardware/espressif/esp32"
44
if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
5-
echo "Installing ESP32 Arduino Core in '$ARDUINO_ESP32_PATH'..."
5+
echo "Installing ESP32 Arduino Core ..."
66
script_init_path="$PWD"
7-
mkdir -p "$ARDUINO_USR_PATH/hardware/espressif" && \
7+
mkdir -p "$ARDUINO_USR_PATH/hardware/espressif"
88
cd "$ARDUINO_USR_PATH/hardware/espressif"
9-
if [ $? -ne 0 ]; then exit 1; fi
9+
10+
echo "Installing Python Serial ..."
11+
pip install pyserial > /dev/null
12+
13+
if [ "$OS_IS_WINDOWS" == "1" ]; then
14+
echo "Installing Python Requests ..."
15+
pip install requests > /dev/null
16+
fi
1017

1118
if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then
12-
echo "Linking Core..." && \
19+
echo "Linking Core..."
1320
ln -s $GITHUB_WORKSPACE esp32
1421
else
15-
echo "Cloning Core Repository..." && \
22+
echo "Cloning Core Repository..."
1623
git clone https://github.com/espressif/arduino-esp32.git esp32 > /dev/null 2>&1
17-
if [ $? -ne 0 ]; then echo "ERROR: GIT clone failed"; exit 1; fi
1824
fi
1925

20-
cd esp32 && \
21-
echo "Updating Submodules..." && \
26+
echo "Updating Submodules ..."
27+
cd esp32
2228
git submodule update --init --recursive > /dev/null 2>&1
23-
if [ $? -ne 0 ]; then echo "ERROR: Submodule update failed"; exit 1; fi
24-
25-
echo "Installing Python Serial..." && \
26-
pip install pyserial > /dev/null
27-
if [ $? -ne 0 ]; then echo "ERROR: Install failed"; exit 1; fi
28-
29-
if [ "$OS_IS_WINDOWS" == "1" ]; then
30-
echo "Installing Python Requests..."
31-
pip install requests > /dev/null
32-
if [ $? -ne 0 ]; then echo "ERROR: Install failed"; exit 1; fi
33-
fi
3429

35-
echo "Installing Platform Tools..."
30+
echo "Installing Platform Tools ..."
3631
cd tools && python get.py
37-
if [ $? -ne 0 ]; then echo "ERROR: Download failed"; exit 1; fi
3832
cd $script_init_path
3933

4034
echo "ESP32 Arduino has been installed in '$ARDUINO_ESP32_PATH'"

‎.github/scripts/install-arduino-ide.sh

Copy file name to clipboardExpand all lines: .github/scripts/install-arduino-ide.sh
+12-11Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,23 @@ else
4646
fi
4747

4848
if [ ! -d "$ARDUINO_IDE_PATH" ]; then
49-
echo "Installing Arduino IDE on $OS_NAME..."
50-
echo "Downloading 'arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT' to 'arduino.$ARCHIVE_FORMAT'..."
49+
echo "Installing Arduino IDE on $OS_NAME ..."
50+
echo "Downloading 'arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT' to 'arduino.$ARCHIVE_FORMAT' ..."
5151
if [ "$OS_IS_LINUX" == "1" ]; then
5252
wget -O "arduino.$ARCHIVE_FORMAT" "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
53-
if [ $? -ne 0 ]; then echo "ERROR: Download failed"; exit 1; fi
54-
echo "Extracting 'arduino.$ARCHIVE_FORMAT'..."
53+
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
5554
tar xf "arduino.$ARCHIVE_FORMAT" > /dev/null
56-
if [ $? -ne 0 ]; then exit 1; fi
5755
mv arduino-nightly "$ARDUINO_IDE_PATH"
5856
else
5957
curl -o "arduino.$ARCHIVE_FORMAT" -L "https://www.arduino.cc/download.php?f=/arduino-nightly-$OS_NAME.$ARCHIVE_FORMAT" > /dev/null 2>&1
60-
if [ $? -ne 0 ]; then echo "ERROR: Download failed"; exit 1; fi
61-
echo "Extracting 'arduino.$ARCHIVE_FORMAT'..."
58+
echo "Extracting 'arduino.$ARCHIVE_FORMAT' ..."
6259
unzip "arduino.$ARCHIVE_FORMAT" > /dev/null
63-
if [ $? -ne 0 ]; then exit 1; fi
6460
if [ "$OS_IS_MACOS" == "1" ]; then
6561
mv "Arduino.app" "/Applications/Arduino.app"
6662
else
6763
mv arduino-nightly "$ARDUINO_IDE_PATH"
6864
fi
6965
fi
70-
if [ $? -ne 0 ]; then exit 1; fi
7166
rm -rf "arduino.$ARCHIVE_FORMAT"
7267

7368
mkdir -p "$ARDUINO_USR_PATH/libraries"
@@ -95,7 +90,7 @@ function build_sketch(){ # build_sketch <fqbn> <path-to-ino> [extra-options]
9590
fi
9691

9792
echo ""
98-
echo "Compiling '"$(basename "$sketch")"'..."
93+
echo "Compiling '"$(basename "$sketch")"' ..."
9994
mkdir -p "$ARDUINO_BUILD_DIR"
10095
mkdir -p "$ARDUINO_CACHE_DIR"
10196
$ARDUINO_IDE_PATH/arduino-builder -compile -logger=human -core-api-version=10810 \
@@ -115,9 +110,13 @@ function build_sketch(){ # build_sketch <fqbn> <path-to-ino> [extra-options]
115110
function count_sketches() # count_sketches <examples-path>
116111
{
117112
local examples="$1"
113+
rm -rf sketches.txt
114+
if [ ! -d "$examples" ]; then
115+
touch sketches.txt
116+
return 0
117+
fi
118118
local sketches=$(find $examples -name *.ino)
119119
local sketchnum=0
120-
rm -rf sketches.txt
121120
for sketch in $sketches; do
122121
local sketchdir=$(dirname $sketch)
123122
local sketchdirname=$(basename $sketchdir)
@@ -163,8 +162,10 @@ function build_sketches() # build_sketches <fqbn> <examples-path> <chunk> <total
163162
return 1
164163
fi
165164

165+
set +e
166166
count_sketches "$examples"
167167
local sketchcount=$?
168+
set -e
168169
local sketches=$(cat sketches.txt)
169170
rm -rf sketches.txt
170171

‎.github/scripts/install-platformio-esp32.sh

Copy file name to clipboard
100644100755
Expand all lines: .github/scripts/install-platformio-esp32.sh
+34-34Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,59 @@
22

33
export PLATFORMIO_ESP32_PATH="$HOME/.platformio/packages/framework-arduinoespressif32"
44

5-
echo "Installing Python Wheel..."
5+
echo "Installing Python Wheel ..."
66
pip install wheel > /dev/null 2>&1
7-
if [ $? -ne 0 ]; then echo "ERROR: Install failed"; exit 1; fi
87

9-
echo "Installing PlatformIO..."
8+
echo "Installing PlatformIO ..."
109
pip install -U https://github.com/platformio/platformio/archive/develop.zip > /dev/null 2>&1
11-
if [ $? -ne 0 ]; then echo "ERROR: Install failed"; exit 1; fi
1210

13-
echo "Installing Platform ESP32..."
11+
echo "Installing Platform ESP32 ..."
1412
python -m platformio platform install https://github.com/platformio/platform-espressif32.git#feature/stage > /dev/null 2>&1
15-
if [ $? -ne 0 ]; then echo "ERROR: Install failed"; exit 1; fi
1613

17-
echo "Replacing the framework version..."
14+
echo "Replacing the framework version ..."
1815
if [[ "$OSTYPE" == "darwin"* ]]; then
19-
sed 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' "$HOME/.platformio/platforms/espressif32/platform.json" > "platform.json" && \
16+
sed 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' "$HOME/.platformio/platforms/espressif32/platform.json" > "platform.json"
2017
mv -f "platform.json" "$HOME/.platformio/platforms/espressif32/platform.json"
2118
else
2219
sed -i 's/https:\/\/github\.com\/espressif\/arduino-esp32\.git/*/' "$HOME/.platformio/platforms/espressif32/platform.json"
2320
fi
24-
if [ $? -ne 0 ]; then echo "ERROR: Replace failed"; exit 1; fi
2521

2622
if [ "$GITHUB_REPOSITORY" == "espressif/arduino-esp32" ]; then
27-
echo "Linking Core..." && \
23+
echo "Linking Core..."
2824
ln -s $GITHUB_WORKSPACE "$PLATFORMIO_ESP32_PATH"
2925
else
30-
echo "Cloning Core Repository..." && \
26+
echo "Cloning Core Repository ..."
3127
git clone https://github.com/espressif/arduino-esp32.git "$PLATFORMIO_ESP32_PATH" > /dev/null 2>&1
32-
if [ $? -ne 0 ]; then echo "ERROR: GIT clone failed"; exit 1; fi
3328
fi
3429

3530
echo "PlatformIO for ESP32 has been installed"
3631
echo ""
3732

38-
3933
function build_pio_sketch(){ # build_pio_sketch <board> <path-to-ino>
4034
if [ "$#" -lt 2 ]; then
4135
echo "ERROR: Illegal number of parameters"
4236
echo "USAGE: build_pio_sketch <board> <path-to-ino>"
4337
return 1
4438
fi
4539

46-
local board="$1"
47-
local sketch="$2"
48-
local sketch_dir=$(dirname "$sketch")
49-
echo ""
50-
echo "Compiling '"$(basename "$sketch")"'..."
51-
python -m platformio ci --board "$board" "$sketch_dir" --project-option="board_build.partitions = huge_app.csv"
40+
local board="$1"
41+
local sketch="$2"
42+
local sketch_dir=$(dirname "$sketch")
43+
echo ""
44+
echo "Compiling '"$(basename "$sketch")"' ..."
45+
python -m platformio ci --board "$board" "$sketch_dir" --project-option="board_build.partitions = huge_app.csv"
5246
}
5347

5448
function count_sketches() # count_sketches <examples-path>
5549
{
56-
local examples="$1"
50+
local examples="$1"
51+
rm -rf sketches.txt
52+
if [ ! -d "$examples" ]; then
53+
touch sketches.txt
54+
return 0
55+
fi
5756
local sketches=$(find $examples -name *.ino)
5857
local sketchnum=0
59-
rm -rf sketches.txt
6058
for sketch in $sketches; do
6159
local sketchdir=$(dirname $sketch)
6260
local sketchdirname=$(basename $sketchdir)
@@ -91,35 +89,37 @@ function build_pio_sketches() # build_pio_sketches <board> <examples-path> <chun
9189
chunks_num="1"
9290
fi
9391

94-
if [ "$chunks_num" -le 0 ]; then
95-
echo "ERROR: Chunks count must be positive number"
96-
return 1
97-
fi
98-
if [ "$chunk_idex" -ge "$chunks_num" ]; then
99-
echo "ERROR: Chunk index must be less than chunks count"
100-
return 1
101-
fi
92+
if [ "$chunks_num" -le 0 ]; then
93+
echo "ERROR: Chunks count must be positive number"
94+
return 1
95+
fi
96+
if [ "$chunk_idex" -ge "$chunks_num" ]; then
97+
echo "ERROR: Chunk index must be less than chunks count"
98+
return 1
99+
fi
102100

101+
set +e
103102
count_sketches "$examples"
104103
local sketchcount=$?
104+
set -e
105105
local sketches=$(cat sketches.txt)
106106
rm -rf sketches.txt
107107

108108
local chunk_size=$(( $sketchcount / $chunks_num ))
109109
local all_chunks=$(( $chunks_num * $chunk_size ))
110110
if [ "$all_chunks" -lt "$sketchcount" ]; then
111-
chunk_size=$(( $chunk_size + 1 ))
111+
chunk_size=$(( $chunk_size + 1 ))
112112
fi
113113

114114
local start_index=$(( $chunk_idex * $chunk_size ))
115115
if [ "$sketchcount" -le "$start_index" ]; then
116-
echo "Skipping job"
117-
return 0
116+
echo "Skipping job"
117+
return 0
118118
fi
119119

120120
local end_index=$(( $(( $chunk_idex + 1 )) * $chunk_size ))
121121
if [ "$end_index" -gt "$sketchcount" ]; then
122-
end_index=$sketchcount
122+
end_index=$sketchcount
123123
fi
124124

125125
local start_num=$(( $start_index + 1 ))
@@ -141,7 +141,7 @@ function build_pio_sketches() # build_pio_sketches <board> <examples-path> <chun
141141
sketchnum=$(($sketchnum + 1))
142142
if [ "$sketchnum" -le "$start_index" ] \
143143
|| [ "$sketchnum" -gt "$end_index" ]; then
144-
continue
144+
continue
145145
fi
146146
build_pio_sketch "$board" "$sketch"
147147
local result=$?

‎.github/scripts/on-push.sh

Copy file name to clipboardExpand all lines: .github/scripts/on-push.sh
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
set -e
4+
35
if [ ! -z "$TRAVIS_TAG" ]; then
46
echo "Skipping Test: Tagged build"
57
exit 0
@@ -52,7 +54,6 @@ if [ "$BUILD_PIO" -eq 0 ]; then
5254
# CMake Test
5355
if [ "$CHUNK_INDEX" -eq 0 ]; then
5456
bash "$ARDUINO_ESP32_PATH/.github/scripts/check-cmakelists.sh"
55-
if [ $? -ne 0 ]; then exit 1; fi
5657
fi
5758
build_sketches "$FQBN" "$ARDUINO_ESP32_PATH/libraries" "$CHUNK_INDEX" "$CHUNKS_CNT"
5859
fi
@@ -68,4 +69,3 @@ else
6869
build_pio_sketch "$BOARD" "$PLATFORMIO_ESP32_PATH/libraries/ESP32/examples/Camera/CameraWebServer/CameraWebServer.ino"
6970
#build_pio_sketches esp32dev "$PLATFORMIO_ESP32_PATH/libraries"
7071
fi
71-
if [ $? -ne 0 ]; then exit 1; fi

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.