Skip to content

Commit da7efc7

Browse files
committed
update github actions to arduino-cli for build tests
1 parent 30d5e13 commit da7efc7

File tree

4 files changed

+45
-39
lines changed

4 files changed

+45
-39
lines changed

.github/workflows/main.yml

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ jobs:
3737
echo -en "matrix=" >> $GITHUB_OUTPUT
3838
echo -en "[" >> $GITHUB_OUTPUT
3939
40-
get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp8266_pico esp8266 1.8.19 esp8266com:esp8266:generic:xtal=80,vt=flash,exception=disabled,stacksmash=disabled,ssl=all,mmu=3232,non32xfer=fast,ResetMethod=nodemcu,CrystalFreq=26,FlashFreq=80,FlashMode=qio,eesz=4M2M,led=2,sdk=nonosdk_190703,ip=lm2f,dbg=Serial1,lvl=SSL,wipe=none,baud=115200 >> $GITHUB_OUTPUT
40+
get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp8266_pico esp8266 0.35.0 esp8266:esp8266:generic:xtal=80,vt=flash,exception=disabled,stacksmash=disabled,ssl=all,mmu=3232,non32xfer=fast,ResetMethod=nodemcu,CrystalFreq=26,FlashFreq=80,FlashMode=qio,eesz=4M2M,led=2,sdk=nonosdk_190703,ip=lm2f,dbg=Serial1,lvl=SSL,wipe=none,baud=115200 >> $GITHUB_OUTPUT
4141
echo -en "," >> $GITHUB_OUTPUT
4242
43-
get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp8266_pico esp8266 1.8.19 esp8266com:esp8266:generic:xtal=80,vt=flash,exception=disabled,stacksmash=disabled,ssl=all,mmu=3232,non32xfer=fast,ResetMethod=nodemcu,CrystalFreq=26,FlashFreq=80,FlashMode=qio,eesz=4M2M,led=2,sdk=nonosdk_190703,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200 >> $GITHUB_OUTPUT
43+
get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp8266_pico esp8266 0.35.0 esp8266:esp8266:generic:xtal=80,vt=flash,exception=disabled,stacksmash=disabled,ssl=all,mmu=3232,non32xfer=fast,ResetMethod=nodemcu,CrystalFreq=26,FlashFreq=80,FlashMode=qio,eesz=4M2M,led=2,sdk=nonosdk_190703,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200 >> $GITHUB_OUTPUT
4444
echo -en "," >> $GITHUB_OUTPUT
4545
46-
get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp32 esp32 1.8.19 espressif:esp32:esp32:FlashFreq=80 >> $GITHUB_OUTPUT
46+
get_sketches_json_matrix arduino $GITHUB_WORKSPACE/examples/esp32 esp32 0.35.0 esp32:esp32:esp32:FlashFreq=80 >> $GITHUB_OUTPUT
4747
4848
echo -en "]" >> $GITHUB_OUTPUT
4949
echo >> $GITHUB_OUTPUT
@@ -55,9 +55,10 @@ jobs:
5555
strategy:
5656
fail-fast: false
5757
matrix:
58-
IDE_VERSION: [1.8.19]
58+
IDE_VERSION: [0.35.0]
5959
env:
6060
IDE_VERSION: ${{ matrix.IDE_VERSION }}
61+
ARDUINO_DIRECTORIES_DATA: /home/runner/arduino_ide
6162

6263
steps:
6364
- uses: actions/checkout@v2
@@ -74,14 +75,15 @@ jobs:
7475
path: |
7576
/home/runner/arduino_ide
7677
/home/runner/Arduino
77-
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ matrix.IDE_VERSION }}
78+
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ matrix.IDE_VERSION }}-cli
7879

7980
- name: download IDE
8081
if: steps.cache_all.outputs.cache-hit != 'true'
8182
run: |
82-
wget http://downloads.arduino.cc/arduino-$IDE_VERSION-linux64.tar.xz -q
83-
tar xf arduino-$IDE_VERSION-linux64.tar.xz
84-
mv arduino-$IDE_VERSION $HOME/arduino_ide
83+
wget https://github.com/arduino/arduino-cli/releases/download/v$IDE_VERSION/arduino-cli$IDE_VERSION_Linux_64bit.tar.gz -q
84+
tar xf arduino-cli_$IDE_VERSION_Linux_64bit.tar.gz
85+
mkdir -p $ARDUINO_DIRECTORIES_DATA
86+
mv arduino-cli $ARDUINO_DIRECTORIES_DATA/
8587
8688
- name: download ArduinoJson
8789
if: steps.cache_all.outputs.cache-hit != 'true'
@@ -91,17 +93,12 @@ jobs:
9193
unzip 6.x.zip
9294
mv ArduinoJson-6.x $HOME/Arduino/libraries/ArduinoJson
9395
94-
- name: download esp8266
96+
- name: download cores
9597
if: steps.cache_all.outputs.cache-hit != 'true'
9698
run: |
99+
export PATH="$ARDUINO_DIRECTORIES_DATA:$PATH"
97100
source $GITHUB_WORKSPACE/travis/common.sh
98-
get_core esp8266
99-
100-
- name: download esp32
101-
if: steps.cache_all.outputs.cache-hit != 'true'
102-
run: |
103-
source $GITHUB_WORKSPACE/travis/common.sh
104-
get_core esp32
101+
get_core_cli
105102
106103
build:
107104
needs: [prepare_ide, prepare_example_json]
@@ -115,6 +112,7 @@ jobs:
115112
BOARD: ${{ matrix.board }}
116113
IDE_VERSION: ${{ matrix.ideversion }}
117114
SKETCH: ${{ matrix.sketch }}
115+
ARDUINO_DIRECTORIES_DATA: /home/runner/arduino_ide
118116

119117
# Steps represent a sequence of tasks that will be executed as part of the job
120118
steps:
@@ -136,7 +134,7 @@ jobs:
136134
path: |
137135
/home/runner/arduino_ide
138136
/home/runner/Arduino
139-
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ matrix.ideversion }}
137+
key: ${{ runner.os }}-${{ steps.get-date.outputs.date }}-${{ matrix.ideversion }}-cli
140138

141139
- name: install python serial
142140
if: matrix.cpu == 'esp32'
@@ -145,32 +143,16 @@ jobs:
145143
sudo pip install pyserial
146144
# sudo apt install python-is-python3
147145

148-
- name: start DISPLAY
149-
run: |
150-
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16
151-
export DISPLAY=:1.0
152-
sleep 3
153-
154146
- name: test IDE
155147
run: |
156-
export PATH="$HOME/arduino_ide:$PATH"
157-
which arduino
148+
export PATH="$ARDUINO_DIRECTORIES_DATA:$PATH"
149+
which arduino-cli
158150
159151
- name: copy code
160152
run: |
161153
mkdir -p $HOME/Arduino/libraries/
162154
cp -r $GITHUB_WORKSPACE $HOME/Arduino/libraries/arduinoWebSockets
163155
164-
- name: config IDE
165-
run: |
166-
set +x
167-
export DISPLAY=:1.0
168-
export PATH="$HOME/arduino_ide:$PATH"
169-
arduino --board $BOARD --save-prefs
170-
arduino --pref update.check=false --pref build.verbose=false --pref cache.enable=true --pref compiler.cache_core=true --pref compiler.warning_level=default --save-prefs
171-
arduino --get-pref sketchbook.path
172-
arduino --get-pref
173-
174156
- name: build example
175157
timeout-minutes: 20
176158
run: |
@@ -179,7 +161,7 @@ jobs:
179161
export PATH="$HOME/arduino_ide:$PATH"
180162
source $GITHUB_WORKSPACE/travis/common.sh
181163
cd $GITHUB_WORKSPACE
182-
build_sketch arduino $SKETCH
164+
build_sketch_cli "$SKETCH" "$BOARD"
183165
184166
done:
185167
needs: [prepare_ide, prepare_example_json, build, check_version_files]

src/SocketIOclient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class SocketIOclient : protected WebSocketsClient {
6161
#endif
6262
#endif
6363
bool isConnected(void);
64-
64+
6565
void onEvent(SocketIOclientEvent cbEvent);
6666
void disconnect(void);
6767

src/WebSockets.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ String WebSockets::acceptKey(String & clientKey) {
571571
*/
572572
String WebSockets::base64_encode(uint8_t * data, size_t length) {
573573
size_t size = ((length * 1.6f) + 1);
574-
size = std::max(size, (size_t) 5); //minimum buffer size
574+
size = std::max(size, (size_t)5); // minimum buffer size
575575
char * buffer = (char *)malloc(size);
576576
if(buffer) {
577577
base64_encodestate _state;

travis/common.sh

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@ function build_sketches()
2929
done
3030
}
3131

32+
function build_sketch_cli()
33+
{
34+
local sketch=$1
35+
local board=$2
36+
arduino-cli --log --log-level info compile -b "$board" "$sketch"
37+
if [ $result -ne 0 ]; then
38+
echo "Build failed ($sketch) build verbose..."
39+
arduino-cli --log --log-level debug compile -b "$board" "$sketch"
40+
result=$?
41+
fi
42+
if [ $result -ne 0 ]; then
43+
echo "Build failed ($1) $sketch"
44+
return $result
45+
fi
46+
}
47+
3248
function build_sketch()
3349
{
3450
local arduino=$1
@@ -88,11 +104,19 @@ function get_sketches_json_matrix()
88104
done
89105
}
90106

107+
function get_core_cli() {
108+
arduino-cli core update-index --additional-urls https://arduino.esp8266.com/stable/package_esp8266com_index.json,https://espressif.github.io/arduino-esp32/package_esp32_index.json,https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
109+
arduino-cli core install esp8266:esp8266
110+
arduino-cli core install esp32:esp32
111+
arduino-cli core install arduino:mbed_rp2040
112+
}
113+
91114
function get_core()
92115
{
93116
echo Setup core for $1
94117

95-
cd $HOME/arduino_ide/hardware
118+
mkdir -p $HOME/arduino_ide/packages/hardware
119+
cd $HOME/arduino_ide/packages/hardware
96120

97121
if [ "$1" = "esp8266" ] ; then
98122
mkdir esp8266com

0 commit comments

Comments
 (0)