Skip to content

Commit f5b2242

Browse files
committed
update workflows
1 parent 3c1dfd2 commit f5b2242

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# 定义工作流名称
2+
name: esp32s3box3 lvgl_micropython
3+
4+
# 触发条件:仅手动触发
5+
on:
6+
workflow_dispatch: # 仅手动触发
7+
8+
jobs:
9+
build_esp32:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
# 1. 检出源码
14+
- name: 1.检出 lvgl_micropython 主仓库(含全部子模块)
15+
uses: actions/checkout@v4
16+
with:
17+
submodules: recursive # 递归拉取所有子模块
18+
fetch-depth: 0 # 拉取完整历史,便于后续版本识别
19+
20+
# 2. 安装系统依赖
21+
- name: 2.安装 Ubuntu 系统级编译依赖
22+
run: |
23+
sudo apt-get update
24+
sudo apt-get install -y \
25+
build-essential \
26+
pkg-config \
27+
cmake \
28+
ninja-build \
29+
ccache
30+
31+
# 3. 设置 Python
32+
- name: 3.配置 Python 3.11 运行环境
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: '3.11' # ESP-IDF 与 MicroPython 均推荐 3.11
36+
37+
# 4. 初始化子模块(项目依赖)
38+
- name: 4.按需浅克隆关键子模块(加速下载)
39+
run: |
40+
# 仅拉取编译必需的子模块,深度=1 减少体积
41+
git submodule update --init --depth 1 -- lib/pycparser
42+
git submodule update --init --depth 1 --jobs 4 -- lib/micropython
43+
git submodule update --init --depth 1 --jobs 4 -- lib/lvgl
44+
45+
# 5. 缓存 ESP-IDF
46+
- name: 5.加载或创建 ESP-IDF 缓存
47+
id: cache-deps
48+
uses: actions/cache@v4
49+
with:
50+
path: |
51+
lib/esp-idf # ESP-IDF 主目录
52+
~/.espressif # 工具链、Python 虚拟环境
53+
key: ${{ runner.os }}-v4-deps # 缓存键,可随版本调整
54+
55+
# 6. 若缓存未命中,拉取 ESP-IDF
56+
- name: 6.缓存未命中时完整拉取 ESP-IDF 及其子模块
57+
if: steps.cache-deps.outputs.cache-hit != 'true'
58+
run: |
59+
# 拉取 ESP-IDF 主仓库
60+
git submodule update --init --depth 1 --jobs 4 -- lib/esp-idf
61+
cd lib/esp-idf
62+
# 按需浅克隆 ESP-IDF 自身需要的子模块
63+
git submodule update --init --depth 1 --jobs 4 -- \
64+
components/bt/host/nimble/nimble \
65+
components/esp_wifi \
66+
components/esptool_py/esptool \
67+
components/lwip/lwip \
68+
components/mbedtls/mbedtls \
69+
components/bt/controller/lib_esp32 \
70+
components/bt/controller/lib_esp32c3_family
71+
cd ../..
72+
# 安装 ESP-IDF 全部工具链(all 代表支持所有芯片)
73+
export "IDF_PATH=$GITHUB_WORKSPACE/lib/esp-idf"
74+
./lib/esp-idf/install.sh all
75+
76+
# 7. 设置 ESP-IDF 环境
77+
- name: 7.激活 ESP-IDF 环境变量(每个 step 都需重新执行)
78+
run: |
79+
export "IDF_PATH=$GITHUB_WORKSPACE/lib/esp-idf"
80+
. ./lib/esp-idf/export.sh # source export.sh,使 idf.py 可用
81+
env:
82+
IDF_PATH: ${{ github.workspace }}/lib/esp-idf
83+
84+
# 8. 构建固件
85+
- name: 8.使用 make.py 编译指定板型/Flash/显示/触摸配置
86+
run: |
87+
# 调用 make.py 进行编译
88+
python3 make.py esp32 "${opts[@]}"
89+
python3 make.py esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT --flash-size=16 DISPLAY=ili9341 INDEV=gt911 --enable-uart-repl=n --enable-jtag-repl=n --enable-cdc-repl=y
90+
91+
# 9. 收集固件到统一目录
92+
- name: 9.重命名并收集所有固件到 ~/artifacts
93+
run: |
94+
# 定义最终存放固件的目录,固定放到 $HOME/artifacts
95+
ARTIFACTS_DIR="$HOME/artifacts"
96+
mkdir -p "$ARTIFACTS_DIR" # 如果目录不存在则自动创建
97+
# 拼出 ESP-IDF 实际编译输出目录的前缀
98+
BUILD_DIR="${{ github.workspace }}/lib/micropython/ports/esp32"
99+
# 计算固件真正所在路径
100+
FW_PATH="${BUILD_DIR}/build-ESP32_GENERIC_S3-SPIRAM_OCT/firmware.bin"
101+
102+
# 组合最终文件名:板型_可选variant_FlashMB_显示_触摸.bin
103+
OUT_NAME="lvgl_mpy_esp32s3box3_ili9341_gt911.bin"
104+
105+
# 复制并重命名
106+
cp "$FW_PATH" "$ARTIFACTS_DIR/$OUT_NAME"
107+
108+
109+
# 10. 上传构建产物
110+
- name: 10.上传重命名后的固件到 GitHub Actions 产物区
111+
uses: actions/upload-artifact@v4
112+
with:
113+
# 产物名与文件名保持一致,便于识别
114+
name: lvgl_mpy_esp32s3box3_ili9341_gt911
115+
path: ~/artifacts/*.bin

0 commit comments

Comments
 (0)