Skip to content

Commit 8e2094e

Browse files
authored
CI - build with arduino-cli (#9241)
Sync with GCC14 branch test scripts Remove explicit IDE, HARDWARE & LIBRARIES envirnoment in workflows in favour of script defaults Remove explicit dependency on IDE & HARDWARE path, assume arduino-cli default paths Remove explicit library install for platformio, share library path & downloaded libraries with arduino Bump ConfigFile dependencies, set ArduinoJson to v7 & update blob install script
1 parent cd844b9 commit 8e2094e

File tree

7 files changed

+311
-203
lines changed

7 files changed

+311
-203
lines changed

.github/workflows/build-ide.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ jobs:
5252
- name: Build Sketches
5353
env:
5454
ESP8266_ARDUINO_BUILDER: "arduino"
55-
ESP8266_ARDUINO_IDE: "${{ runner.temp }}/arduino_ide"
5655
ESP8266_ARDUINO_LWIP: ${{ matrix.lwip }}
5756
run: |
5857
bash ./tests/build.sh 8 ${{ matrix.chunk }}
@@ -75,8 +74,6 @@ jobs:
7574
key: ${{ runner.os }}-${{ hashFiles('package/package_esp8266com_index.template.json', 'tests/common.sh', 'tests/build.sh') }}
7675
- name: Build Sketch
7776
env:
78-
ESP8266_ARDUINO_HARDWARE: "${{ runner.temp }}/hardware"
79-
ESP8266_ARDUINO_IDE: "${{ runner.temp }}/arduino_ide"
8077
ESP8266_ARDUINO_SKETCHES: "libraries/esp8266/examples/Blink/Blink.ino"
8178
run: |
8279
bash ./tests/build.sh
@@ -100,8 +97,6 @@ jobs:
10097
key: ${{ runner.os }}-${{ hashFiles('package/package_esp8266com_index.template.json', 'tests/common.sh', 'tests/build.sh') }}
10198
- name: Build Sketch
10299
env:
103-
ESP8266_ARDUINO_HARDWARE: "${{ runner.temp }}/hardware"
104-
ESP8266_ARDUINO_IDE: "${{ runner.temp }}/arduino_ide"
105100
ESP8266_ARDUINO_SKETCHES: "libraries/esp8266/examples/Blink/Blink.ino"
106101
run: |
107102
bash ./tests/build.sh

libraries/esp8266/examples/ConfigFile/ConfigFile.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <LittleFS.h>
1313

1414
// more and possibly updated information can be found at:
15-
// https://arduinojson.org/v6/example/config/
15+
// https://arduinojson.org/v7/example/config/
1616

1717
bool loadConfig() {
1818
File configFile = LittleFS.open("/config.json", "r");
@@ -21,7 +21,7 @@ bool loadConfig() {
2121
return false;
2222
}
2323

24-
StaticJsonDocument<200> doc;
24+
JsonDocument doc;
2525
auto error = deserializeJson(doc, configFile);
2626
if (error) {
2727
Serial.println("Failed to parse config file");
@@ -42,7 +42,7 @@ bool loadConfig() {
4242
}
4343

4444
bool saveConfig() {
45-
StaticJsonDocument<200> doc;
45+
JsonDocument doc;
4646
doc["serverName"] = "api.example.com";
4747
doc["accessToken"] = "128du9as8du12eoue8da98h123ueh9h98";
4848

tests/build.sh

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,40 @@
11
#!/usr/bin/env bash
22

3+
# expect to have git available
34
root=$(git rev-parse --show-toplevel)
45

6+
# general configuration related to the builder itself
57
ESP8266_ARDUINO_BUILD_DIR=${ESP8266_ARDUINO_BUILD_DIR:-$root}
68
ESP8266_ARDUINO_BUILDER=${ESP8266_ARDUINO_BUILDER:-arduino}
79
ESP8266_ARDUINO_PRESERVE_CACHE=${ESP8266_ARDUINO_PRESERVE_CACHE:-}
810

9-
ESP8266_ARDUINO_IDE=${ESP8266_ARDUINO_IDE:-$HOME/arduino_ide}
10-
ESP8266_ARDUINO_HARDWARE=${ESP8266_ARDUINO_HARDWARE:-$HOME/Arduino/hardware}
11-
ESP8266_ARDUINO_LIBRARIES=${ESP8266_ARDUINO_LIBRARIES:-$HOME/Arduino/libraries}
12-
11+
# sketch build options
1312
ESP8266_ARDUINO_DEBUG=${ESP8266_ARDUINO_DEBUG:-nodebug}
1413
ESP8266_ARDUINO_LWIP=${ESP8266_ARDUINO_LWIP:-default}
1514
ESP8266_ARDUINO_SKETCHES=${ESP8266_ARDUINO_SKETCHES:-}
1615

16+
ESP8266_ARDUINO_CLI=${ESP8266_ARDUINO_CLI:-$HOME/.local/bin/arduino-cli}
17+
18+
# ref. https://arduino.github.io/arduino-cli/1.2/configuration/#default-directories
19+
case "${RUNNER_OS:-Linux}" in
20+
"Linux")
21+
ESP8266_ARDUINO_HARDWARE=${ESP8266_ARDUINO_HARDWARE:-$HOME/Arduino/hardware}
22+
ESP8266_ARDUINO_LIBRARIES=${ESP8266_ARDUINO_LIBRARIES:-$HOME/Arduino/libraries}
23+
;;
24+
"macOS")
25+
ESP8266_ARDUINO_HARDWARE=${ESP8266_ARDUINO_HARDWARE:-$HOME/Documents/Arduino/hardware}
26+
ESP8266_ARDUINO_LIBRARIES=${ESP8266_ARDUINO_LIBRARIES:-$HOME/Documents/Arduino/libraries}
27+
;;
28+
"Windows")
29+
ESP8266_ARDUINO_HARDWARE=${ESP8266_ARDUINO_HARDWARE:-$HOME/Documents/Arduino/hardware}
30+
ESP8266_ARDUINO_LIBRARIES=${ESP8266_ARDUINO_LIBRARIES:-$HOME/Documents/Arduino/libraries}
31+
;;
32+
*)
33+
echo 'Unknown ${RUNNER_OS} = "' ${RUNNER_OS} '"'
34+
exit 2
35+
esac
36+
37+
source "$root/tests/lib-skip-ino.sh"
1738
source "$root/tests/common.sh"
1839

1940
cmd=${0##*/}
@@ -22,21 +43,22 @@ ENVIRONMENT:
2243
ESP8266_ARDUINO_SKETCHES - list of .ino files; defaults to **all available examples**
2344
ESP8266_ARDUINO_BUILDER - arduino or platformio
2445
25-
For Arduino IDE:
26-
ESP8266_ARDUINO_IDE - path to the IDE (portable)
46+
For Arduino CLI:
2747
ESP8266_ARDUINO_HARDWARE - path to the hardware directory (usually, containing our repo)
2848
ESP8266_ARDUINO_LIBRATIES - path to the libraries directory (external dependencies)
2949
ESP8266_ARDUINO_DEBUG - debug or nodebug
3050
ESP8266_ARDUINO_LWIP - v4 or v6
3151
3252
USAGE:
3353
$cmd <[even | odd]> - build every Nth, when '<N> % 2' is either even or odd
34-
$cmd <mod> <rem> - build every Nth, when '<N> % <mod>' is equal to 'rem'
54+
$cmd <mod> <rem> <[cnt]> - build every Nth, when '<N> % <mod>' is equal to 'rem'
55+
optionally, set <cnt> to start with the Nth sketch
3556
$cmd - build every .ino file from ESP8266_ARDUINO_SKETCHES
3657
"
3758

3859
mod=1
3960
rem=0
61+
cnt=0
4062

4163
if [ "$#" -eq 1 ] ; then
4264
case "$1" in
@@ -60,6 +82,10 @@ if [ "$#" -eq 1 ] ; then
6082
elif [ "$#" -eq 2 ] ; then
6183
mod=$1
6284
rem=$2
85+
elif [ "$#" -eq 3 ] ; then
86+
mod=$1
87+
rem=$2
88+
cnt=$3
6389
elif [ "$#" -gt 2 ] ; then
6490
echo "$usage"
6591
exit 1
@@ -72,14 +98,17 @@ fi
7298
case "$ESP8266_ARDUINO_BUILDER" in
7399
"arduino")
74100
install_arduino "$ESP8266_ARDUINO_DEBUG"
75-
build_sketches_with_arduino "$mod" "$rem" "$ESP8266_ARDUINO_LWIP"
101+
build_sketches_with_arduino "$ESP8266_ARDUINO_LWIP" "$mod" "$rem" "$cnt"
76102
;;
77103
"platformio")
78104
install_platformio nodemcuv2
79-
build_sketches_with_platformio "$mod" "$rem"
105+
build_sketches_with_platformio "$mod" "$rem" "$cnt"
106+
;;
107+
"print")
108+
print_sketch_info "$mod" "$rem"
80109
;;
81110
*)
82-
echo "Unknown builder! Must be either arduino or platformio"
111+
echo "Unknown builder! Must be one of - arduino, platformio or print"
83112
exit 1
84113
;;
85114
esac

0 commit comments

Comments
 (0)