Update workflow configurations and build scripts

- Modified GitHub workflow files for dev, stable, and test releases
- Updated platformio.ini and pio_local.ini_example configurations
- Enhanced build_interface.py script functionality
This commit is contained in:
proddy
2025-10-23 18:37:14 +02:00
parent ba334930fe
commit 0b84b79e1d
6 changed files with 46 additions and 34 deletions

View File

@@ -18,17 +18,17 @@ jobs:
steps: steps:
- name: Install python 3.13 - name: Install python 3.13
uses: actions/setup-python@v5 uses: actions/setup-python@v6
with: with:
python-version: '3.13' python-version: '3.13'
- name: Install Node.js 22 - name: Install Node.js 24
uses: actions/setup-node@v4 uses: actions/setup-node@v6
with: with:
node-version: 22 node-version: 24
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Enable Corepack - name: Enable Corepack
run: corepack enable pnpm run: corepack enable pnpm
@@ -45,20 +45,21 @@ jobs:
pip install -U platformio pip install -U platformio
python -m pip install intelhex python -m pip install intelhex
- name: Build the WebUI - name: Build webUI
run: | run: |
cd interface platformio run -e build_webUI
pnpm install
pnpm typesafe-i18n --no-watch
sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts
pnpm build
pnpm webUI
- name: Build all PIO target environments - name: Build modbus
run: |
platformio run -e build_modbus
- name: Build standalone
run: |
platformio run -e build_standalone
- name: Build all PIO target environments, from default_envs
run: | run: |
platformio run platformio run
env:
NO_BUILD_WEBUI: true
- name: Create GitHub Release - name: Create GitHub Release
id: 'automatic_releases' id: 'automatic_releases'

View File

@@ -49,8 +49,6 @@ jobs:
- name: Build all PIO target environments - name: Build all PIO target environments
run: | run: |
platformio run platformio run
env:
NO_BUILD_WEBUI: true
- name: Create GitHub Release - name: Create GitHub Release
uses: emsesp/action-automatic-releases@v1.0.0 uses: emsesp/action-automatic-releases@v1.0.0

View File

@@ -57,8 +57,6 @@ jobs:
- name: Build all target environments - name: Build all target environments
run: | run: |
platformio run platformio run
env:
NO_BUILD_WEBUI: true
- name: Create GitHub Release - name: Create GitHub Release
id: 'automatic_releases' id: 'automatic_releases'

View File

@@ -30,7 +30,7 @@ default_envs = debug
; uncomment if you want to upload the firmware via OTA (must have upload_protocol = custom) ; uncomment if you want to upload the firmware via OTA (must have upload_protocol = custom)
extra_scripts = extra_scripts =
pre:scripts/build_interface.py ; builds the WebUI (unless NO_BUILD_WEBUI is set) - comment out if you don't want to build each time pre:scripts/build_interface.py ; builds the WebUI - comment out if you don't want to build each time
scripts/rename_fw.py ; renames the firmware .bin file - comment out if not needed scripts/rename_fw.py ; renames the firmware .bin file - comment out if not needed
scripts/upload.py ; optionally upload the firmware via OTA (must have upload_protocol = custom) scripts/upload.py ; optionally upload the firmware via OTA (must have upload_protocol = custom)

View File

@@ -98,9 +98,9 @@ build_flags =
build_unflags = build_unflags =
${common.unbuild_flags} ${common.unbuild_flags}
extra_scripts = extra_scripts =
pre:scripts/build_interface.py ; builds the WebUI (unless NO_BUILD_WEBUI is set) ; pre:scripts/build_interface.py ; builds the WebUI
scripts/rename_fw.py ; renames the firmware .bin file scripts/rename_fw.py ; renames the firmware .bin file
scripts/upload.py ; optionally upload the firmware via OTA (if upload_protocol = custom) ; scripts/upload.py ; optionally upload the firmware via OTA (if upload_protocol = custom)
monitor_speed = 115200 monitor_speed = 115200
monitor_filters = direct monitor_filters = direct
build_type = release build_type = release
@@ -111,11 +111,16 @@ lib_deps =
ESP32Async/ESPAsyncWebServer @ 3.8.1 ESP32Async/ESPAsyncWebServer @ 3.8.1
https://github.com/emsesp/EMS-ESP-Modules.git @ 1.0.8 https://github.com/emsesp/EMS-ESP-Modules.git @ 1.0.8
; builds the web interface only, not the firmware
[env:build_webUI]
platform = native
targets = build
extra_scripts = post:scripts/build_interface.py
; ;
; Builds for different board types ; Builds for different board types
; We use Tasmota for boards without PSRAM as this framework has mbedtls removed to save memory. ; We use Tasmota for boards without PSRAM as this framework has mbedtls removed to save memory.
;
; Note, if the system environment variable (windows or linux) "NO_BUILD_WEBUI" is set, the WebUI will not be built.
; If you're building for a single target environment, we recommend creating a pio_local.ini (see example file) ; If you're building for a single target environment, we recommend creating a pio_local.ini (see example file)
; ;
@@ -273,6 +278,7 @@ test_testing_command =
# pio run -e build_modbus -t build # pio run -e build_modbus -t build
[env:build_modbus] [env:build_modbus]
extends = env:native extends = env:native
targets = build
extra_scripts = extra_scripts =
pre:scripts/build_modbus_entity_parameters_pre.py pre:scripts/build_modbus_entity_parameters_pre.py
post:scripts/build_run_test.py post:scripts/build_run_test.py
@@ -286,6 +292,7 @@ custom_post_script = scripts/build_modbus_entity_parameters_post.py
; to be run after build_modbus with: pio run -e build_standalone -t clean -t build ; to be run after build_modbus with: pio run -e build_standalone -t clean -t build
[env:build_standalone] [env:build_standalone]
extends = env:native extends = env:native
targets = build
extra_scripts = extra_scripts =
post:scripts/build_run_test.py post:scripts/build_run_test.py
build_flags = -DEMSESP_STANDALONE build_flags = -DEMSESP_STANDALONE

View File

@@ -55,6 +55,9 @@ def buildWeb():
interface_dir = Path("interface") interface_dir = Path("interface")
pnpm_exe = get_pnpm_executable() pnpm_exe = get_pnpm_executable()
# Set CI environment variable to make pnpm use silent mode
os.environ['CI'] = 'true'
print("Building web interface...") print("Building web interface...")
# Check if interface directory exists # Check if interface directory exists
@@ -100,13 +103,18 @@ def buildWeb():
return False return False
# Don't build webUI if called from GitHub Actions def build_webUI(*args, **kwargs):
if "NO_BUILD_WEBUI" in os.environ:
print("!! Skipping the build of the web interface !!")
else:
if not (env.IsCleanTarget()):
success = buildWeb() success = buildWeb()
if not success: if not success:
print("Web interface build failed!") print("Web interface build failed!")
# Optionally exit with error code env.Exit(1)
# sys.exit(1) env.Exit(0)
# Create custom target that only runs the script
env.AddCustomTarget(
name="build",
dependencies=None,
actions=[build_webUI],
title="build web interface",
description="installs pnpm packages, updates libraries and builds web UI"
)