File tree
93 files changed
+357
-352
lines changed- libraries
- ArduinoOTA/examples/BasicOTA
- AsyncUDP/examples
- AsyncUDPClient
- AsyncUDPMulticastServer
- AsyncUDPServer
- DNSServer/examples/CaptivePortal
- ESP32/examples/Time/SimpleTime
- ESP_NOW/examples
- ESP_NOW_Broadcast_Master
- ESP_NOW_Broadcast_Slave
- ESP_NOW_Network
- ESP_NOW_Serial
- ESPmDNS/examples
- mDNS-SD_Extended
- mDNS_Web_Server
- Ethernet/examples/ETH_WIFI_BRIDGE
- FFat/examples/FFat_time
- HTTPClient/examples
- Authorization
- BasicHttpClient
- BasicHttpsClient
- HTTPClientEnterprise
- ReuseConnection
- StreamHttpClient
- HTTPUpdateServer/examples/WebUpdater
- HTTPUpdate/examples
- httpUpdateSPIFFS
- httpUpdateSecure
- httpUpdate
- Insights/examples
- DiagnosticsSmokeTest
- MinimalDiagnostics
- LittleFS/examples/LITTLEFS_time
- NetBIOS/examples/ESP_NBNST
- NetworkClientSecure/examples
- WiFiClientInsecure
- WiFiClientPSK
- WiFiClientSecureEnterprise
- WiFiClientSecureProtocolUpgrade
- WiFiClientSecure
- WiFiClientShowPeerCredentials
- WiFiClientTrustOnFirstUse
- PPP/examples/PPP_WIFI_BRIDGE
- RainMaker/examples
- RMakerCustomAirCooler
- RMakerCustom
- RMakerSonoffDualR3
- RMakerSwitch
- SD_MMC/examples/SDMMC_time
- SD/examples/SD_time
- SPIFFS/examples/SPIFFS_time
- Update/examples
- AWS_S3_OTA_Update
- HTTPS_OTA_Update
- HTTP_Client_AES_OTA_Update
- HTTP_Server_AES_OTA_Update
- OTAWebUpdater
- WebServer/examples
- AdvancedWebServer
- FSBrowser
- Filters
- HelloServer
- HttpAdvancedAuth
- HttpAuthCallbackInline
- HttpAuthCallback
- HttpBasicAuthSHA1orBearerToken
- HttpBasicAuthSHA1
- HttpBasicAuth
- MultiHomedServers
- 10000 div>PathArgServerSDWebServerSimpleAuthentificationUploadHugeFileWebServerWebUpdateWiFiProv/examples/WiFiProvWiFi/examples
- FTM
- FTM_Initiator
- FTM_Responder
- SimpleWiFiServer
- WPS
- WiFiAccessPoint
- WiFiBlueToothSwitch
- WiFiClientBasic
- WiFiClientConnect
- WiFiClientEnterprise
- WiFiClientEvents
- WiFiClientStaticIP
- WiFiClient
- WiFiExtender
- WiFiIPv6
- WiFiMultiAdvanced
- WiFiMulti
- WiFiScanAsync
- WiFiScanDualAntenna
- WiFiScanWiFiSmartConfig
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.93 files changed
+357-352lines changedLines changed: 7 additions & 86 deletionsOriginal file line number Diff line number Diff line change @@ -7,6 +7,9 @@ TOOLCHAIN_VERSION="12.2.0+20230208"7
7
ESPTOOLPY_VERSION="~1.40501.0"8
8
ESPRESSIF_ORGANIZATION_NAME="espressif"9
9
SDKCONFIG_DIR="$PLATFORMIO_ESP32_PATH/tools/esp32-arduino-libs"10
+
SCRIPTS_DIR="./.github/scripts"11
+
COUNT_SKETCHES="${SCRIPTS_DIR}/sketch_utils.sh count"12
+
CHECK_REQUIREMENTS="${SCRIPTS_DIR}/sketch_utils.sh check_requirements"10
13
11
14
echo "Installing Python Wheel ..."12
15
pip install wheel > /dev/null 2>&1@@ -74,64 +77,6 @@ function build_pio_sketch(){ # build_pio_sketch <board> <options> <path-to-ino>74
77
python -m platformio ci --board "$board" "$sketch_dir" --project-option="$options"75
78
}76
79
77
-
function count_sketches(){ # count_sketches <examples-path>78
-
local examples="$1"79
-
rm -rf sketches.txt80
-
if [ ! -d "$examples" ]; then81
-
touch sketches.txt82
-
return 083
-
fi84
-
local sketches=$(find $examples -name *.ino)85
-
local sketchnum=086
-
for sketch in $sketches; do87
-
local sketchdir=$(dirname $sketch)88
-
local sketchdirname=$(basename $sketchdir)89
-
local sketchname=$(basename $sketch)90
-
if [[ "${sketchdirname}.ino" != "$sketchname" ]]; then91
-
continue92
-
elif [ -f $sketchdir/ci.json ]; then93
-
# If the target is listed as false, skip the sketch. Otherwise, include it.94
-
is_target=$(jq -r '.targets[esp32]' $sketchdir/ci.json)95
-
if [[ "$is_target" == "false" ]]; then96
-
continue97
-
fi98
-
99
-
# Check if the sketch requires any configuration options (AND)100
-
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)101
-
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then102
-
for requirement in $requirements; do103
-
requirement=$(echo $requirement | xargs)104
-
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")105
-
if [[ "$found_line" == "" ]]; then106
-
continue 2107
-
fi108
-
done109
-
fi110
-
111
-
# Check if the sketch requires any configuration options (OR)112
-
requirements_or=$(jq -r '.requires_any[]? // empty' $sketchdir/ci.json)113
-
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then114
-
found=false115
-
for requirement in $requirements_or; do116
-
requirement=$(echo $requirement | xargs)117
-
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")118
-
if [[ "$found_line" != "" ]]; then119
-
found=true120
-
break121
-
fi122
-
done123
-
if [[ "$found" == "false" ]]; then124
-
continue125
-
fi126
-
fi127
-
fi128
-
129
-
echo $sketch >> sketches.txt130
-
sketchnum=$(($sketchnum + 1))131
-
done132
-
return $sketchnum133
-
}134
-
135
80
function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-path> <chunk> <total-chunks>136
81
if [ "$#" -lt 3 ]; then137
82
echo "ERROR: Illegal number of parameters"@@ -160,7 +105,7 @@ function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-160
105
fi161
106
162
107
set +e163
-
count_sketches "$examples"108
+
${COUNT_SKETCHES} "$examples" "esp32"164
109
local sketchcount=$?165
110
set -e166
111
local sketches=$(cat sketches.txt)@@ -204,33 +149,9 @@ function build_pio_sketches(){ # build_pio_sketches <board> <options> <examples-204
149
continue205
150
fi206
151
207
-
# Check if the sketch requires any configuration options (AND)208
-
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)209
-
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then210
-
for requirement in $requirements; do211
-
requirement=$(echo $requirement | xargs)212
-
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")213
-
if [[ "$found_line" == "" ]]; then214
-
continue 2215
-
fi216
-
done217
-
fi218
-
219
-
# Check if the sketch requires any configuration options (OR)220
-
requirements_or=$(jq -r '.requires_any[]? // empty' $sketchdir/ci.json)221
-
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then222
-
found=false223
-
for requirement in $requirements_or; do224
-
requirement=$(echo $requirement | xargs)225
-
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/esp32/sdkconfig")226
-
if [[ "$found_line" != "" ]]; then227
-
found=true228
-
break229
-
fi230
-
done231
-
if [[ "$found" == "false" ]]; then232
-
continue233
-
fi152
+
local has_requirements=$(${CHECK_REQUIREMENTS} $sketchdir "$SDKCONFIG_DIR/esp32/sdkconfig")153
+
if [ "$has_requirements" == "0" ]; then154
+
continue234
155
fi235
156
fi236
157
Lines changed: 53 additions & 56 deletionsOriginal file line number Diff line number Diff line change @@ -8,6 +8,49 @@ else8
8
SDKCONFIG_DIR="tools/esp32-arduino-libs"9
9
fi10
10
11
+
function check_requirements(){ # check_requirements <sketchdir> <sdkconfig_path>12
+
local sketchdir=$113
+
local sdkconfig_path=$214
+
local has_requirements=115
+
16
+
if [ ! -f "$sdkconfig_path" ] || [ ! -f "$sketchdir/ci.json" ]; then17
+
echo "ERROR: sdkconfig or ci.json not found" 1>&218
+
# Return 1 on error to force the sketch to be built and fail. This way the19
+
# CI will fail and the user will know that the sketch has a problem.20
+
else21
+
# Check if the sketch requires any configuration options (AND)22
+
local requirements=$(jq -r '.requires[]? // empty' "$sketchdir/ci.json")23
+
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then24
+
for requirement in $requirements; do25
+
requirement=$(echo $requirement | xargs)26
+
found_line=$(grep -E "^$requirement" "$sdkconfig_path")27
+
if [[ "$found_line" == "" ]]; then28
+
has_requirements=029
+
fi30
+
done31
+
fi32
+
33
+
# Check if the sketch requires any configuration options (OR)34
+
local requirements_or=$(jq -r '.requires_any[]? // empty' "$sketchdir/ci.json")35
+
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then36
+
local found=false37
+
for requirement in $requirements_or; do38
+
requirement=$(echo $requirement | xargs)39
+
found_line=$(grep -E "^$requirement" "$sdkconfig_path")40
+
if [[ "$found_line" != "" ]]; then41
+
found=true42
+
break43
+
fi44
+
done45
+
if [[ "$found" == "false" ]]; then46
+
has_requirements=047
+
fi48
+
fi49
+
fi50
+
51
+
echo $has_requirements52
+
}53
+
11
54
function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [extra-options]12
55
while [ ! -z "$1" ]; do13
56
case "$1" in@@ -171,35 +214,10 @@ function build_sketch(){ # build_sketch <ide_path> <user_path> <path-to-ino> [ex171
214
exit 0172
215
fi173
216
174
-
# Check if the sketch requires any configuration options (AND)175
-
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)176
-
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then177
-
for requirement in $requirements; do178
-
requirement=$(echo $requirement | xargs)179
-
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/$target/sdkconfig")180
-
if [[ "$found_line" == "" ]]; then181
-
echo "Target $target does not meet the requirement $requirement for $sketchname. Skipping."182
-
exit 0183
-
fi184
-
done185
-
fi186
-
187
-
# Check if the sketch excludes any configuration options (OR)188
-
requirements_or=$(jq -r '.requires_any[]? // empty' $sketchdir/ci.json)189
-
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then190
-
found=false191
-
for requirement in $requirements_or; do192
-
requirement=$(echo $requirement | xargs)193
-
found_line=$(grep -E "^$requirement" "$SDKCONFIG_DIR/$target/sdkconfig")194
-
if [[ "$found_line" != "" ]]; then195
-
found=true196
-
break197
-
fi198
-
done199
-
if [[ "$found" == "false" ]]; then200
-
echo "Target $target meets none of the requirements in requires_any for $sketchname. Skipping."201
-
exit 0202
-
fi217
+
local has_requirements=$(check_requirements "$sketchdir" "$SDKCONFIG_DIR/$target/sdkconfig")218
+
if [ "$has_requirements" == "0" ]; then219
+
echo "Target $target does not meet the requirements for $sketchname. Skipping."220
+
exit 0203
221
fi204
222
fi205
223
@@ -348,33 +366,9 @@ function count_sketches(){ # count_sketches <path> [target] [file] [ignore-requi348
366
fi349
367
350
368
if [ "$ignore_requirements" != "1" ]; then351
-
# Check if the sketch requires any configuration options (AND)352
-
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)353
-
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then354
-
for requirement in $requirements; do355
-
requirement=$(echo $requirement | xargs)356
-
found_line=$(grep -E "^$requirement" $SDKCONFIG_DIR/$target/sdkconfig)357
-
if [[ "$found_line" == "" ]]; then358
-
continue 2359
-
fi360
-
done361
-
fi362
-
363
-
# Check if the sketch excludes any configuration options (OR)364
-
requirements_or=$(jq -r '.requires_any[]? // empty' $sketchdir/ci.json)365
-
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then366
-
found=false367
-
for requirement in $requirements_or; do368
-
requirement=$(echo $requirement | xargs)369
-
found_line=$(grep -E "^$requirement" $SDKCONFIG_DIR/$target/sdkconfig)370
-
if [[ "$found_line" != "" ]]; then371
-
found=true372
-
break373
-
fi374
-
done375
-
if [[ "$found" == "false" ]]; then376
-
continue 2377
-
fi369
+
local has_requirements=$(check_requirements "$sketchdir" "$SDKCONFIG_DIR/$target/sdkconfig")370
+
if [ "$has_requirements" == "0" ]; then371
+
continue378
372
fi379
373
fi380
374
fi@@ -552,6 +546,7 @@ Available commands:552
546
count: Count sketches.553
547
build: Build a sketch.554
548
chunk_build: Build a chunk of sketches.549
+
check_requirements: Check if target meets sketch requirements.555
550
"556
551
557
552
cmd=$1@@ -569,6 +564,8 @@ case "$cmd" in569
564
;;570
565
"chunk_build") build_sketches $*571
566
;;567
+
"check_requirements") check_requirements $*568
+
;;572
569
*)573
570
echo "ERROR: Unrecognized command"574
571
echo "$USAGE"Lines changed: 14 additions & 33 deletionsOriginal file line number Diff line number Diff line change @@ -9,6 +9,7 @@ function run_test() {9
9
local sketchname=$(basename $sketchdir)10
10
local result=011
11
local error=012
+
local sdkconfig_path12
13
13
14
if [ $options -eq 0 ] && [ -f $sketchdir/ci.json ]; then14
15
len=`jq -r --arg target $target '.fqbn[$target] | length' $sketchdir/ci.json`@@ -20,9 +21,9 @@ function run_test() {20
21
fi21
22
22
23
if [ $len -eq 1 ]; then23
-
SDKCONFIG_PATH="$HOME/.arduino/tests/$sketchname/build.tmp/sdkconfig"24
+
sdkconfig_path="$HOME/.arduino/tests/$sketchname/build.tmp/sdkconfig"24
25
else25
-
SDKCONFIG_PATH="$HOME/.arduino/tests/$sketchname/build0.tmp/sdkconfig"26
+
sdkconfig_path="$HOME/.arduino/tests/$sketchname/build0.tmp/sdkconfig"26
27
fi27
28
28
29
if [ -f $sketchdir/ci.json ]; then@@ -35,39 +36,19 @@ function run_test() {35
36
printf "\n\n\n"36
37
return 037
38
fi39
+
fi38
40
39
-
# Check if the sketch requires any configuration options (AND)40
-
requirements=$(jq -r '.requires[]? // empty' $sketchdir/ci.json)41
-
if [[ "$requirements" != "null" && "$requirements" != "" ]]; then42
-
for requirement in $requirements; do43
-
requirement=$(echo $requirement | xargs)44
-
found_line=$(grep -E "^$requirement" "$SDKCONFIG_PATH")45
-
if [[ "$found_line" == "" ]]; then46
-
printf "\033[93mTarget $target does not meet the requirement $requirement for $sketchname. Skipping.\033[0m\n"47
-
printf "\n\n\n"48
-
return 049
-
fi50
-
done51
-
fi41
+
if [ ! -f $sdkconfig_path ]; then42
+
printf "\033[93mSketch $sketchname not built\nMight be due to missing target requirements or build failure\033[0m\n"43
+
printf "\n\n\n"44
+
return 045
+
fi52
46
53
-
# Check if the sketch requires any configuration options (OR)54
-
requirements_or=$(jq -r '.requires_any[]? // empty' $sketchdir/ci.json)55
-
if [[ "$requirements_or" != "null" && "$requirements_or" != "" ]]; then56
-
found=false57
-
for requirement in $requirements_or; do58
-
requirement=$(echo $requirement | xargs)59
-
found_line=$(grep -E "^$requirement" "$SDKCONFIG_PATH")60
-
if [[ "$found_line" != "" ]]; then61
-
found=true62
-
break63
-
fi64
-
done65
-
if [[ "$found" == "false" ]]; then66
-
printf "\033[93mTarget $target meets none of the requirements in requires_any for $sketchname. Skipping.\033[0m\n"67
-
printf "\n\n\n"68
-
return 069
-
fi70
-
fi47
+
local right_target=$(grep -E "^CONFIG_IDF_TARGET=\"$target\"$" "$sdkconfig_path")48
+
if [ -z "$right_target" ]; then49
+
printf "\033[91mError: Sketch $sketchname compiled for different target\n\033[0m\n"50
+
printf "\n\n\n"51
+
return 171
52
fi72
53
73
54
if [ $len -eq 1 ]; thenLines changed: 3 additions & 2 deletionsOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@1
1
{2
-
"requires": [3
-
"CONFIG_SOC_WIFI_SUPPORTED=y"2
+
"requires_any": [3
+
"CONFIG_SOC_WIFI_SUPPORTED=y",4
+
"CONFIG_ESP_WIFI_REMOTE_ENABLED=y"4
5
]5
6
}Lines changed: 3 additions & 2 deletionsOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@1
1
{2
-
"requires": [3
-
"CONFIG_SOC_WIFI_SUPPORTED=y"2
+
"requires_any": [3
+
"CONFIG_SOC_WIFI_SUPPORTED=y",4
+
"CONFIG_ESP_WIFI_REMOTE_ENABLED=y"4
5
]5
6
}Lines changed: 3 additions & 2 deletionsOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@1
1
{2
-
"requires": [3
-
"CONFIG_SOC_WIFI_SUPPORTED=y"2
+
"requires_any": [3
+
"CONFIG_SOC_WIFI_SUPPORTED=y",4
+
"CONFIG_ESP_WIFI_REMOTE_ENABLED=y"4
5
]5
6
}Lines changed: 3 additions & 2 deletionsOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@1
1
{2
-
"requires": [3
-
"CONFIG_SOC_WIFI_SUPPORTED=y"2
+
"requires_any": [3
+
"CONFIG_SOC_WIFI_SUPPORTED=y",4
+
"CONFIG_ESP_WIFI_REMOTE_ENABLED=y"4
5
]5
6
}Lines changed: 3 additions & 2 deletionsOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@1
1
{2
-
"requires": [3
-
"CONFIG_SOC_WIFI_SUPPORTED=y"2
+
"requires_any": [3
+
"CONFIG_SOC_WIFI_SUPPORTED=y",4
+
"CONFIG_ESP_WIFI_REMOTE_ENABLED=y"4
5
]5
6
}Lines changed: 3 additions & 2 deletionsOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@1
1
{2
-
"requires": [3
-
"CONFIG_SOC_WIFI_SUPPORTED=y"2
+
"requires_any": [3
+
"CONFIG_SOC_WIFI_SUPPORTED=y",4
+
"CONFIG_ESP_WIFI_REMOTE_ENABLED=y"4
5
]5
6
}Lines changed: 3 additions & 2 deletionsOriginal file line number Diff line number Diff line change @@ -1,5 +1,6 @@1
1
{2
-
"requires": [3
-
"CONFIG_SOC_WIFI_SUPPORTED=y"2
+
"requires_any": [3
+
"CONFIG_SOC_WIFI_SUPPORTED=y",4
+
"CONFIG_ESP_WIFI_REMOTE_ENABLED=y"4
5
]5
6
}
0 commit comments