From 0b84b79e1d924a11647864ab6d824542bf53e7c6 Mon Sep 17 00:00:00 2001 From: proddy Date: Thu, 23 Oct 2025 18:37:14 +0200 Subject: [PATCH] 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 --- .github/workflows/dev_release.yml | 31 ++++++++++++++-------------- .github/workflows/stable_release.yml | 2 -- .github/workflows/test_release.yml | 2 -- pio_local.ini_example | 2 +- platformio.ini | 15 ++++++++++---- scripts/build_interface.py | 28 ++++++++++++++++--------- 6 files changed, 46 insertions(+), 34 deletions(-) diff --git a/.github/workflows/dev_release.yml b/.github/workflows/dev_release.yml index 20629475e..474fd2523 100644 --- a/.github/workflows/dev_release.yml +++ b/.github/workflows/dev_release.yml @@ -18,17 +18,17 @@ jobs: steps: - name: Install python 3.13 - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: '3.13' - - name: Install Node.js 22 - uses: actions/setup-node@v4 + - name: Install Node.js 24 + uses: actions/setup-node@v6 with: - node-version: 22 + node-version: 24 - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Enable Corepack run: corepack enable pnpm @@ -45,20 +45,21 @@ jobs: pip install -U platformio python -m pip install intelhex - - name: Build the WebUI + - name: Build webUI run: | - cd interface - pnpm install - pnpm typesafe-i18n --no-watch - sed -i "s/= 'pl'/= 'en'/" ./src/i18n/i18n-util.ts - pnpm build - pnpm webUI + platformio run -e build_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: | platformio run - env: - NO_BUILD_WEBUI: true - name: Create GitHub Release id: 'automatic_releases' diff --git a/.github/workflows/stable_release.yml b/.github/workflows/stable_release.yml index b4c44c4f1..6e192d700 100644 --- a/.github/workflows/stable_release.yml +++ b/.github/workflows/stable_release.yml @@ -49,8 +49,6 @@ jobs: - name: Build all PIO target environments run: | platformio run - env: - NO_BUILD_WEBUI: true - name: Create GitHub Release uses: emsesp/action-automatic-releases@v1.0.0 diff --git a/.github/workflows/test_release.yml b/.github/workflows/test_release.yml index ae685cf43..9022992ec 100644 --- a/.github/workflows/test_release.yml +++ b/.github/workflows/test_release.yml @@ -57,8 +57,6 @@ jobs: - name: Build all target environments run: | platformio run - env: - NO_BUILD_WEBUI: true - name: Create GitHub Release id: 'automatic_releases' diff --git a/pio_local.ini_example b/pio_local.ini_example index 83dd19eb8..8f37b479f 100644 --- a/pio_local.ini_example +++ b/pio_local.ini_example @@ -30,7 +30,7 @@ default_envs = debug ; uncomment if you want to upload the firmware via OTA (must have upload_protocol = custom) 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/upload.py ; optionally upload the firmware via OTA (must have upload_protocol = custom) diff --git a/platformio.ini b/platformio.ini index 72f21db2b..2719bff6a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -98,9 +98,9 @@ build_flags = build_unflags = ${common.unbuild_flags} 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/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_filters = direct build_type = release @@ -111,11 +111,16 @@ lib_deps = ESP32Async/ESPAsyncWebServer @ 3.8.1 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 ; 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) ; @@ -273,6 +278,7 @@ test_testing_command = # pio run -e build_modbus -t build [env:build_modbus] extends = env:native +targets = build extra_scripts = pre:scripts/build_modbus_entity_parameters_pre.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 [env:build_standalone] extends = env:native +targets = build extra_scripts = post:scripts/build_run_test.py build_flags = -DEMSESP_STANDALONE diff --git a/scripts/build_interface.py b/scripts/build_interface.py index 939640fd8..8b967cded 100755 --- a/scripts/build_interface.py +++ b/scripts/build_interface.py @@ -55,6 +55,9 @@ def buildWeb(): interface_dir = Path("interface") pnpm_exe = get_pnpm_executable() + # Set CI environment variable to make pnpm use silent mode + os.environ['CI'] = 'true' + print("Building web interface...") # Check if interface directory exists @@ -100,13 +103,18 @@ def buildWeb(): return False -# Don't build webUI if called from GitHub Actions -if "NO_BUILD_WEBUI" in os.environ: - print("!! Skipping the build of the web interface !!") -else: - if not (env.IsCleanTarget()): - success = buildWeb() - if not success: - print("Web interface build failed!") - # Optionally exit with error code - # sys.exit(1) +def build_webUI(*args, **kwargs): + success = buildWeb() + if not success: + print("Web interface build failed!") + env.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" +)