Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added GitHub workflow to build and publish all firmware #103

Conversation

Martinius79
Copy link
Collaborator

  • Added GitHub Actions workflow to build and publish all firmware files if content in the folder "EleksTubeHax_pio" in the main branch is updated
  • Added helper scripts
  • Added switch and scripts in platformio.ini
  • replaced esptool.exe with a never version to be able to merge files locally on windows (option merge_bin was missing)
  1. GitHub Actions Workflow (pio-build-and-publish-all-firmware-files.yml):

    • New Workflow: Added a GitHub Actions workflow to automate the process of generating firmware files.
    • Triggers: The workflow is triggered on pushes to the main branch in the ElekstubeHAX_pio subfolder and manual dispatch.
    • Set Version Job: Introduced a job to set the version number based on the GitHub run number.
    • Build Firmware Job: Added a job to build firmware for multiple hardware configurations using a matrix strategy.
  2. Configuration and Scripts:

    • Configuration:
      • platformio.ini:
        • Added a build_flag -D CREATE_FIRMWAREFILE to enable local firmware generation.
        • Added script "script_build_fs_and_merge.py" under "extra_scripts" to trigger the build of the filesystem image and merge. This script only runs if the CREATE_FIRMWAREFILE flag is set in the build_flags.
    • Scripts:
      • script_build_fs_and_merge.py:
        • Build the SPIFFS filesystem (because it is not triggered automatically when default build target is called in PIO).
        • Merge all build binaries into a valid flashable firmware image.
        • Use partition table CSV files to get the correct offsets.
        • Generate output file names based on the defined hardware.
        • The script only runs if the CREATE_FIRMWAREFILE flag is set in the build_flags.
      • script_modify_user_defines.py:
        • This script rewrites the USER_DEFINES.h on the fly to switch hardware defines.

Versioning:

  • The version number is generated based on a hard-defined major and minor version (1.0) + the workflow run number.
  • It's then injected into both GLOBAL_DEFINES.h (in the existing version string) and individual firmware files.
  • The version information is also added to the All-firmwaresX.zip archive.

Advantages:

  • All pre-built firmware files for supported hardware are generated automatically and available for download, review, or inclusion in releases.
  • Users have access to actual firmware files even if not checked into the repository.
  • Versioning based on run numbers guarantees unique versions.
  • Users can build complete flashable firmware locally by uncommenting a line in platformio.ini.
  • Public GitHub projects currently have no known limitations on running time or storage usage, so building on every commit shouldn't be an issue. The default retention time for artifacts is 90 days.

Disadvantages:

  • To use a matrix build strategy, intermediate build results must be published as separate artifacts alongside the All-firmwaresX.zip file.
  • The mechanism relies on the existing file structure and keyword detection. Changes in file structure may require refactoring.
  • New hardware or changed major or minor version numbers needs to be defined in the workflow to be included in the build process.

esptool.exe Update:

  • A newer version of esptool.exe (v4.7.0) wasn't strictly necessary as the Python version bundled with PlatformIO is used. However, having the ability to use it manually from the command line is beneficial.
  • The provided version is built for Windows x64 from the original Espressif sources and includes correct file version information.

TODO: Add documentation in the Readme.md.

…ent in the folder "EleksTubeHax_pio" in the main branch is updated - added helper scripts - added switch in and scripts in platformio.ini - replaced esptool.exe with a never version to be able to merge files locally on windows (option merge_bin was missing)
@aly-fly aly-fly merged commit 1aa6b5b into aly-fly:main Nov 9, 2024
2 checks passed
@eku
Copy link

eku commented Nov 9, 2024

TODO: Add documentation in the Readme.md.

Yes please. I was no able to find any artefacts at the actions that has been run.

@Martinius79
Copy link
Collaborator Author

Martinius79 commented Nov 9, 2024

@Martinius79 Martinius79 deleted the AddedWorkflowToBuildAndPublishAllFirmwareFiles branch November 10, 2024 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants