Skip to content

Commit 935bf7c

Browse files
authored
Merge branch 'master' into fix-wesp32-board-config
2 parents e92ad53 + e8d0d31 commit 935bf7c

File tree

7 files changed

+173
-18
lines changed

7 files changed

+173
-18
lines changed

.github/scripts/on-release.sh

Lines changed: 155 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,30 @@ if [ -n "${VENDOR}" ]; then
5454
echo "Setting packager: $VENDOR"
5555
fi
5656

57+
function update_version {
58+
set -e
59+
set -o pipefail
60+
61+
local tag=$1
62+
local major
63+
local minor
64+
local patch
65+
66+
# Extract major, minor, and patch from the tag
67+
# We need to make sure to remove the "v" prefix from the tag and any characters after the patch version
68+
tag=$(echo "$tag" | sed 's/^v//g' | sed 's/-.*//g')
69+
major=$(echo "$tag" | cut -d. -f1)
70+
minor=$(echo "$tag" | cut -d. -f2)
71+
patch=$(echo "$tag" | cut -d. -f3 | sed 's/[^0-9].*//') # Remove non-numeric suffixes like RC1, alpha, beta
72+
73+
echo "Major: $major, Minor: $minor, Patch: $patch"
74+
75+
"${SCRIPTS_DIR}/update-version.sh" "$major" "$minor" "$patch"
76+
77+
set +e
78+
set +o pipefail
79+
}
80+
5781
function get_file_size {
5882
local file="$1"
5983
if [[ "$OSTYPE" == "darwin"* ]]; then
@@ -199,8 +223,31 @@ set -e
199223
##
200224

201225
mkdir -p "$OUTPUT_DIR"
202-
PKG_DIR="$OUTPUT_DIR/$PACKAGE_NAME"
226+
PKG_DIR="${OUTPUT_DIR:?}/$PACKAGE_NAME"
203227
PACKAGE_ZIP="$PACKAGE_NAME.zip"
228+
PACKAGE_XZ="$PACKAGE_NAME.tar.xz"
229+
LIBS_ZIP="$PACKAGE_NAME-libs.zip"
230+
LIBS_XZ="$PACKAGE_NAME-libs.tar.xz"
231+
232+
echo "Updating version..."
233+
if ! update_version "$RELEASE_TAG"; then
234+
echo "ERROR: update_version failed!"
235+
exit 1
236+
fi
237+
git config --global github.user "github-actions[bot]"
238+
git config --global user.name "github-actions[bot]"
239+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
240+
git add .
241+
242+
# We should only commit if there are changes
243+
need_update_commit=true
244+
if git diff --cached --quiet; then
245+
echo "Version already updated"
246+
need_update_commit=false
247+
else
248+
echo "Creating version update commit..."
249+
git commit -m "change(version): Update core version to $RELEASE_TAG"
250+
fi
204251

205252
echo "Updating submodules ..."
206253
git -C "$GITHUB_WORKSPACE" submodule update --init --recursive > /dev/null 2>&1
@@ -283,7 +330,7 @@ echo \#define ARDUINO_ESP32_GIT_DESC "$(git -C "$GITHUB_WORKSPACE" describe --ta
283330
echo \#define ARDUINO_ESP32_RELEASE_"$ver_define" >> "$PKG_DIR/cores/esp32/core_version.h"
284331
echo \#define ARDUINO_ESP32_RELEASE \""$ver_define"\" >> "$PKG_DIR/cores/esp32/core_version.h"
285332

286-
# Compress package folder
333+
# Compress ZIP package folder
287334
echo "Creating ZIP ..."
288335
pushd "$OUTPUT_DIR" >/dev/null
289336
zip -qr "$PACKAGE_ZIP" "$PACKAGE_NAME"
@@ -293,22 +340,112 @@ if [ $? -ne 0 ]; then
293340
fi
294341

295342
# Calculate SHA-256
296-
echo "Calculating SHA sum ..."
297-
PACKAGE_PATH="$OUTPUT_DIR/$PACKAGE_ZIP"
343+
echo "Calculating ZIP SHA sum ..."
344+
PACKAGE_PATH="${OUTPUT_DIR:?}/$PACKAGE_ZIP"
298345
PACKAGE_SHA=$(shasum -a 256 "$PACKAGE_ZIP" | cut -f 1 -d ' ')
299346
PACKAGE_SIZE=$(get_file_size "$PACKAGE_ZIP")
300347
popd >/dev/null
301-
rm -rf "$PKG_DIR"
302348
echo "'$PACKAGE_ZIP' Created! Size: $PACKAGE_SIZE, SHA-256: $PACKAGE_SHA"
303349
echo
304350

305-
# Upload package to release page
306-
echo "Uploading package to release page ..."
351+
# Compress XZ package folder
352+
echo "Creating XZ ..."
353+
pushd "$OUTPUT_DIR" >/dev/null
354+
tar -cJf "$PACKAGE_XZ" "$PACKAGE_NAME"
355+
if [ $? -ne 0 ]; then
356+
echo "ERROR: Failed to create $PACKAGE_XZ ($?)"
357+
exit 1
358+
fi
359+
360+
# Calculate SHA-256
361+
echo "Calculating XZ SHA sum ..."
362+
PACKAGE_XZ_PATH="${OUTPUT_DIR:?}/$PACKAGE_XZ"
363+
PACKAGE_XZ_SHA=$(shasum -a 256 "$PACKAGE_XZ" | cut -f 1 -d ' ')
364+
PACKAGE_XZ_SIZE=$(get_file_size "$PACKAGE_XZ")
365+
popd >/dev/null
366+
echo "'$PACKAGE_XZ' Created! Size: $PACKAGE_XZ_SIZE, SHA-256: $PACKAGE_XZ_SHA"
367+
echo
368+
369+
# Upload ZIP package to release page
370+
echo "Uploading ZIP package to release page ..."
307371
PACKAGE_URL=$(git_safe_upload_asset "$PACKAGE_PATH")
308372
echo "Package Uploaded"
309373
echo "Download URL: $PACKAGE_URL"
310374
echo
311375

376+
# Upload XZ package to release page
377+
echo "Uploading XZ package to release page ..."
378+
PACKAGE_XZ_URL=$(git_safe_upload_asset "$PACKAGE_XZ_PATH")
379+
echo "Package Uploaded"
380+
echo "Download URL: $PACKAGE_XZ_URL"
381+
echo
382+
383+
# Remove package folder
384+
rm -rf "$PKG_DIR"
385+
386+
# Copy Libs from lib-builder to release in ZIP and XZ
387+
388+
libs_url=$(cat "$PACKAGE_JSON_TEMPLATE" | jq -r ".packages[0].tools[] | select(.name == \"esp32-arduino-libs\") | .systems[0].url")
389+
libs_sha=$(cat "$PACKAGE_JSON_TEMPLATE" | jq -r ".packages[0].tools[] | select(.name == \"esp32-arduino-libs\") | .systems[0].checksum" | sed 's/^SHA-256://')
390+
libs_size=$(cat "$PACKAGE_JSON_TEMPLATE" | jq -r ".packages[0].tools[] | select(.name == \"esp32-arduino-libs\") | .systems[0].size")
391+
echo "Downloading libs from lib-builder ..."
392+
echo "URL: $libs_url"
393+
echo "Expected SHA: $libs_sha"
394+
echo "Expected Size: $libs_size"
395+
echo
396+
397+
echo "Downloading libs from lib-builder ..."
398+
curl -L -o "$OUTPUT_DIR/$LIBS_ZIP" "$libs_url"
399+
400+
# Check SHA and Size
401+
zip_sha=$(sha256sum "$OUTPUT_DIR/$LIBS_ZIP" | awk '{print $1}')
402+
zip_size=$(stat -c%s "$OUTPUT_DIR/$LIBS_ZIP")
403+
echo "Downloaded SHA: $zip_sha"
404+
echo "Downloaded Size: $zip_size"
405+
if [ "$zip_sha" != "$libs_sha" ] || [ "$zip_size" != "$libs_size" ]; then
406+
echo "ERROR: ZIP SHA and Size do not match"
407+
exit 1
408+
fi
409+
410+
# Extract ZIP
411+
412+
echo "Repacking libs to XZ ..."
413+
unzip -q "$OUTPUT_DIR/$LIBS_ZIP" -d "$OUTPUT_DIR"
414+
pushd "$OUTPUT_DIR" >/dev/null
415+
tar -cJf "$LIBS_XZ" "esp32-arduino-libs"
416+
popd >/dev/null
417+
418+
# Upload ZIP and XZ libs to release page
419+
420+
echo "Uploading ZIP libs to release page ..."
421+
LIBS_ZIP_URL=$(git_safe_upload_asset "$OUTPUT_DIR/$LIBS_ZIP")
422+
echo "ZIP libs Uploaded"
423+
echo "Download URL: $LIBS_ZIP_URL"
424+
echo
425+
426+
echo "Uploading XZ libs to release page ..."
427+
LIBS_XZ_URL=$(git_safe_upload_asset "$OUTPUT_DIR/$LIBS_XZ")
428+
echo "XZ libs Uploaded"
429+
echo "Download URL: $LIBS_XZ_URL"
430+
echo
431+
432+
# Update libs URLs in JSON template
433+
echo "Updating libs URLs in JSON template ..."
434+
435+
# Update all libs URLs in the JSON template
436+
libs_jq_arg="(.packages[0].tools[] | select(.name == \"esp32-arduino-libs\") | .systems[].url) = \"$LIBS_ZIP_URL\""
437+
438+
cat "$PACKAGE_JSON_TEMPLATE" | jq "$libs_jq_arg" > "$OUTPUT_DIR/package-libs-updated.json"
439+
PACKAGE_JSON_TEMPLATE="$OUTPUT_DIR/package-libs-updated.json"
440+
441+
echo "Libs URLs updated in JSON template"
442+
echo
443+
444+
# Clean up
445+
rm -rf "${OUTPUT_DIR:?}/esp32-arduino-libs"
446+
rm -rf "${OUTPUT_DIR:?}/$LIBS_ZIP"
447+
rm -rf "${OUTPUT_DIR:?}/$LIBS_XZ"
448+
312449
##
313450
## TEMP WORKAROUND FOR RV32 LONG PATH ON WINDOWS
314451
##
@@ -469,6 +606,17 @@ if [ "$RELEASE_PRE" == "false" ]; then
469606
echo
470607
fi
471608

609+
if [ "$need_update_commit" == "true" ]; then
610+
echo "Pushing version update commit..."
611+
git push
612+
new_tag_commit=$(git rev-parse HEAD)
613+
echo "New commit: $new_tag_commit"
614+
615+
echo "Moving tag $RELEASE_TAG to $new_tag_commit..."
616+
git tag -f "$RELEASE_TAG" "$new_tag_commit"
617+
git push --force origin "$RELEASE_TAG"
618+
fi
619+
472620
set +e
473621

474622
##

.github/scripts/update-version.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# Disable shellcheck warning about using 'cat' to read a file.
33
# shellcheck disable=SC2002
44

5+
# Exit on any error and make pipelines fail if any command fails
6+
set -e
7+
set -o pipefail
8+
59
# For reference: add tools for all boards by replacing one line in each board
610
# "[board].upload.tool=esptool_py" to "[board].upload.tool=esptool_py\n[board].upload.tool.default=esptool_py\n[board].upload.tool.network=esp_ota"
711
#cat boards.txt | sed "s/\([a-zA-Z0-9_\-]*\)\.upload\.tool\=esptool_py/\1\.upload\.tool\=esptool_py\\n\1\.upload\.tool\.default\=esptool_py\\n\1\.upload\.tool\.network\=esp_ota/"
@@ -38,6 +42,11 @@ echo "Updating issue template..."
3842
cat .github/ISSUE_TEMPLATE/Issue-report.yml | \
3943
sed "s/.*\- latest master .*/ - latest master \(checkout manually\)\\n - v$ESP_ARDUINO_VERSION/g" > __issue-report.yml && mv __issue-report.yml .github/ISSUE_TEMPLATE/Issue-report.yml
4044

45+
echo "Updating GitLab variables..."
46+
cat .gitlab/workflows/common.yml | \
47+
sed "s/ESP_IDF_VERSION:.*/ESP_IDF_VERSION: \"$ESP_IDF_VERSION\"/g" | \
48+
sed "s/ESP_ARDUINO_VERSION:.*/ESP_ARDUINO_VERSION: \"$ESP_ARDUINO_VERSION\"/g" > .gitlab/workflows/__common.yml && mv .gitlab/workflows/__common.yml .gitlab/workflows/common.yml
49+
4150
echo "Updating platform.txt..."
4251
cat platform.txt | sed "s/version=.*/version=$ESP_ARDUINO_VERSION/g" > __platform.txt && mv __platform.txt platform.txt
4352

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
- name: Checkout repository
1818
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1919
with:
20+
ref: ${{ github.event.release.target_commitish }}
2021
fetch-depth: 0
2122

2223
- name: Set up Python

boards.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52150,7 +52150,7 @@ fobe_quill_esp32s3_mesh.name=FoBE Quill ESP32S3 Mesh
5215052150
fobe_quill_esp32s3_mesh.vid.0=0x303a
5215152151
fobe_quill_esp32s3_mesh.pid.0=0x82f4
5215252152
fobe_quill_esp32s3_mesh.vid.1=0x303a
52153-
fobe_quill_esp32s3_mesh.vid.1=0x82f5
52153+
fobe_quill_esp32s3_mesh.pid.1=0x82f5
5215452154
fobe_quill_esp32s3_mesh.vid.2=0x303a
5215552155
fobe_quill_esp32s3_mesh.pid.2=0x82f6
5215652156

@@ -52370,6 +52370,8 @@ twinaiot.upload.tool.network=esp_ota
5237052370

5237152371
twinaiot.upload.maximum_size=1310720
5237252372
twinaiot.upload.maximum_data_size=327680
52373+
twinaiot.upload.flags=
52374+
twinaiot.upload.extra_flags=
5237352375
twinaiot.upload.use_1200bps_touch=false
5237452376
twinaiot.upload.wait_for_upload_port=false
5237552377

cores/esp32/esp32-hal-gpio.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,21 @@
3333
#include "soc/touch_sensor_periph.h"
3434

3535
int8_t digitalPinToTouchChannel(uint8_t pin) {
36-
int8_t ret = -1;
3736
if (pin < SOC_GPIO_PIN_COUNT) {
3837
for (uint8_t i = 0; i < SOC_TOUCH_SENSOR_NUM; i++) {
3938
if (touch_sensor_channel_io_map[i] == pin) {
40-
ret = i;
41-
break;
39+
return i;
4240
}
4341
}
4442
}
45-
return ret;
43+
44+
log_e("No touch pad on selected pin(%u)!", pin);
45+
return -1;
4646
}
4747
#else
4848
// No Touch Sensor available
4949
int8_t digitalPinToTouchChannel(uint8_t pin) {
50+
log_e("Touch sensor not available on this chip");
5051
return -1;
5152
}
5253
#endif

cores/esp32/esp32-hal-touch-ng.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ static void __touchChannelInit(int pad) {
332332
static touch_value_t __touchRead(uint8_t pin) {
333333
int8_t pad = digitalPinToTouchChannel(pin);
334334
if (pad < 0) {
335-
log_e(" No touch pad on selected pin!");
336335
return 0;
337336
}
338337

@@ -360,7 +359,6 @@ static touch_value_t __touchRead(uint8_t pin) {
360359
static void __touchConfigInterrupt(uint8_t pin, void (*userFunc)(void), void *Args, bool callWithArgs, touch_value_t threshold) {
361360
int8_t pad = digitalPinToTouchChannel(pin);
362361
if (pad < 0) {
363-
log_e(" No touch pad on selected pin!");
364362
return;
365363
}
366364

@@ -446,7 +444,6 @@ bool touchInterruptGetLastStatus(uint8_t pin) {
446444
void touchSleepWakeUpEnable(uint8_t pin, touch_value_t threshold) {
447445
int8_t pad = digitalPinToTouchChannel(pin);
448446
if (pad < 0) {
449-
log_e(" No touch pad on selected pin!");
450447
return;
451448
}
452449

cores/esp32/esp32-hal-touch.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ static void __touchChannelInit(int pad) {
206206
static touch_value_t __touchRead(uint8_t pin) {
207207
int8_t pad = digitalPinToTouchChannel(pin);
208208
if (pad < 0) {
209-
log_e(" No touch pad on selected pin!");
210209
return 0;
211210
}
212211

@@ -233,7 +232,6 @@ static touch_value_t __touchRead(uint8_t pin) {
233232
static void __touchConfigInterrupt(uint8_t pin, void (*userFunc)(void), void *Args, touch_value_t threshold, bool callWithArgs) {
234233
int8_t pad = digitalPinToTouchChannel(pin);
235234
if (pad < 0) {
236-
log_e(" No touch pad on selected pin!");
237235
return;
238236
}
239237

@@ -295,7 +293,6 @@ bool touchInterruptGetLastStatus(uint8_t pin) {
295293
void touchSleepWakeUpEnable(uint8_t pin, touch_value_t threshold) {
296294
int8_t pad = digitalPinToTouchChannel(pin);
297295
if (pad < 0) {
298-
log_e(" No touch pad on selected pin!");
299296
return;
300297
}
301298

0 commit comments

Comments
 (0)