Refactor GitHub Actions workflows for build, documentation, and linting#2260
Refactor GitHub Actions workflows for build, documentation, and linting#2260Odyno wants to merge 1 commit into1technophile:developmentfrom
Conversation
d34290f to
f8779e1
Compare
1134284 to
27c998b
Compare
.github/workflows/environments.json
Outdated
| "sonoff-basic", | ||
| "sonoff-basic-rfr3" | ||
| ], | ||
| "metadata": { |
There was a problem hiding this comment.
If it is not used by the code I would remove the metadata, they are currently out of sync (the count does not match the qty of environments (83 in metadata 82 in the list)
There was a problem hiding this comment.
Yes, I agree, it was one experiment not cleaned.
scripts/ci_build.sh
Outdated
| } | ||
|
|
||
| # Function to list available environments | ||
| list_environments() { |
There was a problem hiding this comment.
environment listing should come from environments.json and not the ini I suspect
There was a problem hiding this comment.
Let me create a double option... one from environment.json and the other from real platform.ini... so we can use it in all cases and not only in CI
scripts/ci_set_version.sh
Outdated
| log_info "Setting PRODUCTION version: $version" | ||
|
|
||
| replace_version "$USER_CONFIG" "$version" || return 1 | ||
| replace_version "$VERSION_JSON" "$version" || return 1 |
There was a problem hiding this comment.
VERSION_JSON does not look defined somewhere
There was a problem hiding this comment.
I deleted this file in the end because I realized it was only useful for the website, and it made a small change to the code… a change that cannot be reverted and works only one time. This way of doing things is an anti‑pattern, because it stops local development of this pipeline and makes the code messy. I changed this part so the functionality still works, but without modifying files that are tracked by Git. I tried to work on this and in latest_version.json, latest_version_dev.json, board.md, web-install.md, and config.js. Please check out the proposal
scripts/ci_set_version.sh
Outdated
| log_info "Setting DEVELOPMENT version: $version" | ||
|
|
||
| replace_version "$USER_CONFIG" "$version" || return 1 | ||
| replace_version "$VERSION_DEV_JSON" "$version" || return 1 |
There was a problem hiding this comment.
VERSION_DEV_JSON does not look defined somewhere
scripts/ci_00_config.sh
Outdated
| # Used by: All build scripts for centralized configuration | ||
|
|
||
| # Python Configuration | ||
| PYTHON_VERSION="3.13" |
There was a problem hiding this comment.
do we really need all those variables ? If they are not used I would suggest to remove them.
They can mislead the developer in thinking that we have a centralized place for them but it is not the case
.github/workflows/lint.yml
Outdated
| @@ -4,13 +4,9 @@ on: [push, pull_request] | |||
|
|
|||
| jobs: | |||
There was a problem hiding this comment.
can we centralize this in task lint and remove this file ?
There was a problem hiding this comment.
I agree! I left it just because it was present
|
I'm very happy that you reviewed this MR! Yes, in those 3 days I have done a small review of all the code of this MR (for this reason it is in draft) because I also tested the site and I discovered some errors. Really happy to include the comment on the next commit we're I would like to provide a more bit steps to test the site locally ( do not worry always feature parity + add the ability to run all in localhost, also the generation of manifest of local develop version ...) Hope you have another time to follow the update! Time to test |
86af2df to
aaee4e2
Compare
|
@1technophile (and @h2zero ) I have completed the full review and included all the comments. I hope you appreciate this work. While I understand it's not directly related to the core project, I believe it will help the community to try and test these features, which could be a significant boost for the open-source aspects of the project. This PR is ready from my side. I have thoroughly tested every part of it, with the exception of the GitHub-specific repository options, which are beyond the scope of this implementation. |
821086f to
36c5f0a
Compare
|
@claude can you review this PR |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
PR #2260 Review: CI/CD Infrastructure RefactoringOverviewAuthor: Odyno ✅ Strengths1. Architecture Design
2. Local Development Experience
3. Documentation Quality
4. Code Organization
|
|
That's true, shellcheck and nodjs check will be part of next PR #2263 |
h2zero
left a comment
There was a problem hiding this comment.
I like this, just a couple remarks.
| 2. Make your changes and follow the naming rules: | ||
| * New gateway: `ZgatewayXXX` where `XXX` is the protocol name. | ||
| * New sensor: `ZsensorYYY` where `YYY` is the sensor type. | ||
| * New actuator: `ZactuatorZZZ` where `ZZZ` is the actuator type. |
There was a problem hiding this comment.
While we're here lets remove the "Z" prefix from these as that no longer is used.
There was a problem hiding this comment.
I agree, but at the moment it is used in site generation, in board page generation for retrieving information about the modules present in the environment.
| @@ -1,4 +1,5 @@ | |||
|
|
|||
| # Replaces BLE library with custom version during PlatformIO build | |||
| # Used by: Currently unused (utility script for BLE library replacement) | |||
There was a problem hiding this comment.
I think we can delete this now as it is quite out of date.
DetailsTested this today and encountered this error: After running: It looks like the folder location of the firmware bins is incorrect as they are actually found in Please disregard, I missed the |
or use the option |
- Consolidated build logic into reusable workflows (`task-build.yml` and `task-docs.yml`) to reduce duplication across multiple workflows. - Introduced `environments.json` to centralize the list of PlatformIO build environments, improving maintainability and clarity. - Updated `build.yml` and `build_and_docs_to_dev.yml` to utilize the new reusable workflows and environment definitions. - Enhanced `release.yml` to streamline the release process and integrate documentation generation. - Created reusable linting workflow (`task-lint.yml`) to standardize code formatting checks across the repository. - Simplified manual documentation workflow by leveraging the new reusable documentation workflow. - Improved artifact management and retention policies across workflows. - Updated dependencies and versions in workflows to ensure compatibility and performance. CI/CD pipeline agnostic of Workflow Engine and integrated on github actions - Implemented ci.sh for orchestrating the complete build pipeline. - Created ci_00_config.sh for centralized configuration of build scripts. - Created ci_build_firmware.sh for building firmware for specified PlatformIO environments. - Created ci_prepare_artifacts.sh for preparing firmware artifacts for upload or deployment. - Created ci_set_version.sh for updating version tags in firmware configuration files. - Created ci_build.sh to orchestrate the complete build pipeline. - Created ci_qa.sh for code linting and formatting checks using clang-format. - Created ci_site.sh for building and deploying VuePress documentation with version management. - Implemented checks for required tools and dependencies in the new scripts. - Improved internal scripts for better error handling and logging. UPDATE the web installer manifest generation and update documentation structure - Enhanced ci_list-env.sh to list environments from a JSON file. - Replaced common_wu.py and gen_wu.py scripts with new npm scripts for site generation and previewing on docsgen/gen_wu.js - Replaced generate_board_docs.py with docsgen/generated_board_docs.js - Added new npm scripts for integration of site generation on build phase. - Created preview_site.js to serve locally generated site over HTTPS with improved error handling. - Added new CI environments for CI builds in environments.json. - Deleted lint.yml as part of workflow cleanup. - Enhanced task-build.yml to include linting as a job and added support for specifying PlatformIO version. - Improved task-docs.yml to handle versioning more effectively and added clean option. Enhance documentation - ADD CLEAR Mark of development version of site - Updated README.md to include detailed workflow dependencies and relationships using mermaid diagrams. - Improved development.md with a quick checklist for contributors and clarified the code style guide. - Enhanced quick_start.md with tips for contributors and streamlined the workflow explanation. LINT FIX - Refined User_config.h for better formatting consistency. - Adjusted blufi.cpp and gatewayBT.cpp for improved code readability and consistency in formatting. - Updated gatewaySERIAL.cpp and mqttDiscovery.cpp to enhance logging error messages. - Improved sensorDS1820.cpp for better logging of device information.
36c5f0a to
3ffbc94
Compare
Description:
Based on the discussion on https://community.openmqttgateway.com/t/holiday-questions-d/4345, this PR refactors the CI/CD infrastructure to improve maintainability, testability, and local development experience while maintaining complete
feature parity with the existing pipeline.
Problem Statement
The current CI/CD setup creates friction for developers:
Solution
Platform-agnostic CI/CD system with two complementary layers:
1. GitHub Actions Workflows (Reorganized)
task-build.yml,task-docs.yml,task-lint.ymlenvironments.jsonbuild.yml,build_and_docs_to_dev.yml,release.yml2. Local-First Bash CI Scripts
ci.sh- Main entry point for all CI operationsci_build.sh- Firmware compilation pipelineci_site.sh- Documentation generation with version managementci_qa.sh- Code linting and formattingci_set_version.sh- Automated version taggingci_prepare_artifacts.sh- Artifact packagingci_00_config.sh(DRY principle)3. Enhanced Documentation Development Experience
The site generation is now fully self-contained and locally developable using only Node.js and VuePress:
docs/participate/README.md) with cross-linked navigationdevelopment.md,quick_start.md)community.md,support.md,adding-protocols.md)Key Benefits
./ci.shDocumentation
Complete reference materials included:
Future Work
Security hardening planned for follow-up PR:
Tested
Checklist