Skip to content

Commit 4beb4b3

Browse files
Test Action to build release
1 parent e9f8174 commit 4beb4b3

File tree

3 files changed

+141
-140
lines changed

3 files changed

+141
-140
lines changed

.github/workflows/push.yml

Lines changed: 17 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,27 @@
1-
name: ESP32 Arduino Libs CI
2-
1+
name: IDF v5.3 with P4
32
on:
4-
push:
5-
branches:
6-
- master
7-
- release/v5.3
8-
pull_request:
9-
paths:
10-
- "**"
11-
- "!**.md"
12-
- "!.github/workflows/cron_build.yml"
13-
- "!.github/workflows/cron.yml"
14-
- "!.github/workflows/docker.yml"
15-
- "!.github/workflows/repository_dispatch.yml"
16-
- "!tools/config_editor/**"
17-
- "!tools/docker/**"
18-
19-
concurrency:
20-
group: esp-idf-libs-${{github.event.pull_request.number || github.ref}}
21-
cancel-in-progress: true
3+
workflow_dispatch: # Manually start a workflow
224

235
jobs:
246
build-libs:
25-
name: Build Libs for ${{ matrix.target }}
7+
name: Build Arduino Libs
268
runs-on: ubuntu-latest
27-
strategy:
28-
matrix:
29-
target: [esp32, esp32s3]
30-
fail-fast: false
319
steps:
3210
- uses: actions/checkout@v4
33-
11+
- name: Set up Python
12+
uses: actions/setup-python@v5
13+
with:
14+
python-version: "3.11"
3415
- name: Install dependencies
3516
run: bash ./tools/prepare-ci.sh
36-
37-
- name: Build Libs for ${{ matrix.target }}
38-
run: bash ./build.sh -e -t ${{ matrix.target }}
39-
40-
- name: Upload build
41-
if: failure()
42-
uses: actions/upload-artifact@v4
43-
with:
44-
name: build-${{ matrix.target }}
45-
path: build
46-
47-
- name: Upload archive
48-
uses: actions/upload-artifact@v4
49-
with:
50-
name: artifacts-${{ matrix.target }}
51-
path: dist
52-
17+
- name: Get current branch
18+
run: |
19+
echo "GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
20+
- name: Build Arduino Libs
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
23+
GIT_AUTHOR_EMAIL: ${{ secrets.PUSH_EMAIL }}
24+
run: bash ./build.sh
5325
- name: Release
5426
uses: jason2866/action-gh-release@v1.3
5527
with:
@@ -59,34 +31,5 @@ jobs:
5931
files: |
6032
dist/framework*
6133
release-info.txt
62-
63-
combine-artifacts:
64-
name: Combine artifacts
65-
needs: build-libs
66-
runs-on: ubuntu-latest
67-
steps:
68-
- name: Download artifacts
69-
uses: actions/download-artifact@v4
70-
with:
71-
path: dist
72-
pattern: artifacts-*
73-
merge-multiple: true
74-
75-
- shell: bash
76-
run: |
77-
mkdir -p out
78-
find dist -name 'arduino-esp32-libs-esp*.tar.gz' -exec tar zxvf {} -C out \;
79-
cd out/tools/esp32-arduino-libs && tar zcf ../../../dist/esp32-arduino-libs.tar.gz * && cd ../../..
80-
cp out/package_esp32_index.template.json dist/package_esp32_index.template.json
81-
82-
- name: Upload full esp32-arduino-libs archive
83-
uses: actions/upload-artifact@v4
84-
with:
85-
name: esp32-arduino-libs
86-
path: dist/esp32-arduino-libs.tar.gz
87-
88-
- name: Upload package_esp32_index.template.json
89-
uses: actions/upload-artifact@v4
90-
with:
91-
name: package-esp32-index-json
92-
path: dist/package_esp32_index.template.json
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build.sh

Lines changed: 38 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -20,51 +20,38 @@ export IDF_COMPONENT_OVERWRITE_MANAGED_COMPONENTS=1
2020

2121
CCACHE_ENABLE=1
2222

23-
TARGET="all"
23+
export TARGET="all"
2424
BUILD_TYPE="all"
25-
BUILD_DEBUG="default"
2625
SKIP_ENV=0
2726
COPY_OUT=0
28-
ARCHIVE_OUT=0
29-
if [ -z $DEPLOY_OUT ]; then
30-
DEPLOY_OUT=0
31-
fi
27+
ARCHIVE_OUT=1
28+
DEPLOY_OUT=0
3229

3330
function print_help() {
34-
echo "Usage: build.sh [-s] [-n] [-A <arduino_branch>] [-I <idf_branch>] [-D <debug_level>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]"
31+
echo "Usage: build.sh [-s] [-n] [-A <arduino_branch>] [-I <idf_branch>] [-i <idf_commit>] [-c <path>] [-t <target>] [-b <build|menuconfig|reconfigure|idf-libs|copy-bootloader|mem-variant>] [config ...]"
3532
echo " -s Skip installing/updating of ESP-IDF and all components"
3633
echo " -n Disable ccache"
3734
echo " -A Set which branch of arduino-esp32 to be used for compilation"
3835
echo " -I Set which branch of ESP-IDF to be used for compilation"
3936
echo " -i Set which commit of ESP-IDF to be used for compilation"
4037
echo " -e Archive the build to dist"
41-
echo " -d Deploy the build to github arduino-esp32"
42-
echo " -D Debug level to be set to ESP-IDF. One of default,none,error,warning,info,debug or verbose"
43-
echo " -c Set the arduino-esp32 folder to copy the result to. ex. '$HOME/Arduino/hardware/espressif/esp32'"
4438
echo " -t Set the build target(chip) ex. 'esp32s3' or select multiple targets(chips) by separating them with comma ex. 'esp32,esp32s3,esp32c3'"
4539
echo " -b Set the build type. ex. 'build' to build the project and prepare for uploading to a board"
4640
echo " ... Specify additional configs to be applied. ex. 'qio 80m' to compile for QIO Flash@80MHz. Requires -b"
4741
exit 1
4842
}
4943

50-
while getopts ":A:I:i:c:t:b:D:sde" opt; do
44+
while getopts ":A:I:i:c:t:b:sde" opt; do
5145
case ${opt} in
5246
s )
5347
SKIP_ENV=1
5448
;;
5549
n )
5650
CCACHE_ENABLE=0
5751
;;
58-
d )
59-
DEPLOY_OUT=1
60-
;;
6152
e )
6253
ARCHIVE_OUT=1
6354
;;
64-
c )
65-
export ESP32_ARDUINO="$OPTARG"
66-
COPY_OUT=1
67-
;;
6855
A )
6956
export AR_BRANCH="$OPTARG"
7057
;;
@@ -74,19 +61,16 @@ while getopts ":A:I:i:c:t:b:D:sde" opt; do
7461
i )
7562
export IDF_COMMIT="$OPTARG"
7663
;;
77-
D )
78-
BUILD_DEBUG="$OPTARG"
79-
;;
8064
t )
8165
IFS=',' read -ra TARGET <<< "$OPTARG"
8266
;;
8367
b )
8468
b=$OPTARG
85-
if [ "$b" != "build" ] &&
86-
[ "$b" != "menuconfig" ] &&
87-
[ "$b" != "reconfigure" ] &&
88-
[ "$b" != "idf-libs" ] &&
89-
[ "$b" != "copy-bootloader" ] &&
69+
if [ "$b" != "build" ] &&
70+
[ "$b" != "menuconfig" ] &&
71+
[ "$b" != "reconfigure" ] &&
72+
[ "$b" != "idf-libs" ] &&
73+
[ "$b" != "copy-bootloader" ] &&
9074
[ "$b" != "mem-variant" ]; then
9175
print_help
9276
fi
@@ -111,6 +95,7 @@ export IDF_CCACHE_ENABLE=$CCACHE_ENABLE
11195
echo "TARGET(s): ${TARGET[@]}"
11296

11397
mkdir -p dist
98+
rm -rf dependencies.lock
11499

115100
if [ $SKIP_ENV -eq 0 ]; then
116101
echo "* Installing/Updating ESP-IDF and all components..."
@@ -155,7 +140,7 @@ if [ "$BUILD_TYPE" != "all" ]; then
155140
continue
156141
fi
157142

158-
configs="configs/defconfig.common;configs/defconfig.$target;configs/defconfig.debug_$BUILD_DEBUG"
143+
configs="configs/defconfig.common;configs/defconfig.$target"
159144
for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do
160145
configs="$configs;configs/defconfig.$defconf"
161146
done
@@ -178,6 +163,15 @@ fi
178163
rm -rf build sdkconfig out
179164
mkdir -p "$AR_TOOLS/esp32-arduino-libs"
180165

166+
# Add release-info
167+
rm -rf release-info.txt
168+
IDF_Commit_short=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "")
169+
AR_Commit_short=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "")
170+
echo "Framework built from
171+
- $IDF_REPO branch [$IDF_BRANCH](https://github.com/$IDF_REPO/tree/$IDF_BRANCH) commit [$IDF_Commit_short](https://github.com/$IDF_REPO/commits/$IDF_BRANCH/#:~:text=$IDF_Commit_short)
172+
- $AR_REPO branch [$AR_BRANCH](https://github.com/$AR_REPO/tree/$AR_BRANCH) commit [$AR_Commit_short](https://github.com/$AR_REPO/commits/$AR_BRANCH/#:~:text=$AR_Commit_short)
173+
- Arduino lib builder branch: $GIT_BRANCH" >> release-info.txt
174+
181175
#targets_count=`jq -c '.targets[] | length' configs/builds.json`
182176
for target_json in `jq -c '.targets[]' configs/builds.json`; do
183177
target=$(echo "$target_json" | jq -c '.target' | tr -d '"')
@@ -210,7 +204,7 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
210204
echo "* Target: $target"
211205

212206
# Build Main Configs List
213-
main_configs="configs/defconfig.common;configs/defconfig.$target;configs/defconfig.debug_$BUILD_DEBUG"
207+
main_configs="configs/defconfig.common;configs/defconfig.$target"
214208
for defconf in `echo "$target_json" | jq -c '.features[]' | tr -d '"'`; do
215209
main_configs="$main_configs;configs/defconfig.$defconf"
216210
done
@@ -226,19 +220,6 @@ for target_json in `jq -c '.targets[]' configs/builds.json`; do
226220
idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" idf-libs
227221
if [ $? -ne 0 ]; then exit 1; fi
228222

229-
if [ "$target" == "esp32s3" ]; then
230-
idf.py -DIDF_TARGET="$target" -DSDKCONFIG_DEFAULTS="$idf_libs_configs" srmodels_bin
231-
if [ $? -ne 0 ]; then exit 1; fi
232-
AR_SDK="$AR_TOOLS/esp32-arduino-libs/$target"
233-
# sr model.bin
234-
if [ -f "build/srmodels/srmodels.bin" ]; then
235-
echo "$AR_SDK/esp_sr"
236-
mkdir -p "$AR_SDK/esp_sr"
237-
cp -f "build/srmodels/srmodels.bin" "$AR_SDK/esp_sr/"
238-
cp -f "partitions.csv" "$AR_SDK/esp_sr/"
239-
fi
240-
fi
241-
242223
# Build Bootloaders
243224
for boot_conf in `echo "$target_json" | jq -c '.bootloaders[]'`; do
244225
bootloader_configs="$main_configs"
@@ -297,42 +278,33 @@ for component in `ls "$AR_MANAGED_COMPS"`; do
297278
fi
298279
done
299280

300-
# update package_esp32_index.template.json
301-
if [ "$BUILD_TYPE" = "all" ]; then
302-
echo "* Generating package_esp32_index.template.json..."
303-
python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -j "$AR_COMPS/arduino/package/package_esp32_index.template.json" -o "$AR_OUT/"
304-
python3 ./tools/gen_tools_json.py -i "$IDF_PATH" -o "$TOOLS_JSON_OUT/"
305-
if [ $? -ne 0 ]; then exit 1; fi
306-
fi
281+
export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD)
307282

308-
# Generate PlatformIO manifest file
283+
# Generate PlatformIO library manifest file
309284
if [ "$BUILD_TYPE" = "all" ]; then
310-
echo "* Generating PlatformIO manifest file..."
311-
pushd $IDF_PATH
312-
ibr=$(git describe --all 2>/dev/null)
313-
ic=$(git -C "$IDF_PATH" rev-parse --short HEAD)
314-
popd
315-
python3 ./tools/gen_platformio_manifest.py -o "$TOOLS_JSON_OUT/" -s "$ibr" -c "$ic"
285+
python3 ./tools/gen_pio_lib_manifest.py -o "$TOOLS_JSON_OUT/" -s "v$IDF_VERSION" -c "$IDF_COMMIT"
316286
if [ $? -ne 0 ]; then exit 1; fi
317287
fi
318288

319-
# copy everything to arduino-esp32 installation
320-
if [ $COPY_OUT -eq 1 ] && [ -d "$ESP32_ARDUINO" ]; then
321-
echo "* Copying to Arduino..."
322-
./tools/copy-to-arduino.sh
323-
if [ $? -ne 0 ]; then exit 1; fi
324-
fi
289+
AR_VERSION=$(jq -c '.version' "$AR_COMPS/arduino/package.json" | tr -d '"')
290+
AR_VERSION_UNDERSCORE=`echo "$AR_VERSION" | tr . _`
325291

326-
# push changes to esp32-arduino-libs and create pull request into arduino-esp32
327-
if [ $DEPLOY_OUT -eq 1 ]; then
328-
echo "* Pushing to Arduino..."
329-
./tools/push-to-arduino.sh
292+
# Generate PlatformIO framework manifest file
293+
rm -rf "$AR_ROOT/package.json"
294+
if [ "$BUILD_TYPE" = "all" ]; then
295+
python3 ./tools/gen_pio_frmwk_manifest.py -o "$AR_ROOT/" -s "v$AR_VERSION" -c "$IDF_COMMIT"
330296
if [ $? -ne 0 ]; then exit 1; fi
331297
fi
332298

299+
# Generate core_version.h
300+
rm -rf "$AR_ROOT/core_version.h"
301+
echo "#define ARDUINO_ESP32_GIT_VER 0x$AR_Commit_short
302+
#define ARDUINO_ESP32_GIT_DESC $AR_VERSION
303+
#define ARDUINO_ESP32_RELEASE_$AR_VERSION_UNDERSCORE
304+
#define ARDUINO_ESP32_RELEASE \"$AR_VERSION_UNDERSCORE\"" >> "$AR_ROOT/core_version.h"
305+
333306
# archive the build
334307
if [ $ARCHIVE_OUT -eq 1 ]; then
335-
echo "* Archiving build..."
336308
./tools/archive-build.sh "$TARGET"
337309
if [ $? -ne 0 ]; then exit 1; fi
338310
fi

tools/gen_pio_lib_manifest.py

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import argparse
2+
import json
3+
import os
4+
import re
5+
import sys
6+
7+
MANIFEST_DATA = {
8+
"name": "framework-arduinoespressif32-libs",
9+
"description": "Precompiled libraries for Arduino Wiring-based Framework for the Espressif ESP32 series of SoCs",
10+
"keywords": ["framework", "tasmota", "arduino", "espressif", "esp32"],
11+
"license": "LGPL-2.1-or-later",
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/tasmota/esp32-arduino-libs",
15+
},
16+
}
17+
18+
19+
def convert_version(version_string):
20+
"""A helper function that converts a custom IDF version string
21+
extracted from a Git repository to a suitable SemVer alternative. For example:
22+
'release/v5.1' becomes '5.1.0',
23+
'v7.7.7' becomes '7.7.7'
24+
"""
25+
26+
regex_pattern = (
27+
r"v(?P<MAJOR>0|[1-9]\d*)\.(?P<MINOR>0|[1-9]\d*)\.*(?P<PATCH>0|[1-9]\d*)*"
28+
)
29+
match = re.search(regex_pattern, version_string)
30+
if not match:
31+
sys.stderr.write(
32+
f"Failed to find a regex match for '{regex_pattern}' in '{version_string}'\n"
33+
)
34+
return ""
35+
36+
major, minor, patch = match.groups()
37+
if not patch:
38+
patch = "0"
39+
40+
return ".".join((major, minor, patch))
41+
42+
43+
def main(dst_dir, version_string, commit_hash):
44+
45+
converted_version = convert_version(version_string)
46+
if not converted_version:
47+
sys.stderr.write(f"Failed to convert version '{version_string}'\n")
48+
return -1
49+
50+
manifest_file_path = os.path.join(dst_dir, "package.json")
51+
with open(manifest_file_path, "w", encoding="utf8") as fp:
52+
MANIFEST_DATA["version"] = f"{converted_version}+sha.{commit_hash}"
53+
json.dump(MANIFEST_DATA, fp, indent=2)
54+
55+
print(
56+
f"Generated PlatformIO libraries manifest file '{manifest_file_path}' with '{converted_version}' version"
57+
)
58+
return 0
59+
60+
61+
if __name__ == "__main__":
62+
parser = argparse.ArgumentParser()
63+
parser.add_argument(
64+
"-o",
65+
"--dst-dir",
66+
dest="dst_dir",
67+
required=True,
68+
help="Destination folder where the 'package.json' manifest will be located",
69+
)
70+
parser.add_argument(
71+
"-s",
72+
"--version-string",
73+
dest="version_string",
74+
required=True,
75+
help="ESP-IDF version string used for compiling libraries",
76+
)
77+
parser.add_argument(
78+
"-c",
79+
"--commit-hash",
80+
dest="commit_hash",
81+
required=True,
82+
help="ESP-IDF revision in form of a commit hash",
83+
)
84+
args = parser.parse_args()
85+
86+
sys.exit(main(args.dst_dir, args.version_string, args.commit_hash))

0 commit comments

Comments
 (0)