-
Notifications
You must be signed in to change notification settings - Fork 853
Refactor GitHub Actions workflows for build, documentation, and linting #2260
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
base: development
Are you sure you want to change the base?
Refactor GitHub Actions workflows for build, documentation, and linting #2260
Conversation
- 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.
d34290f to
f8779e1
Compare
…ctions - 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. - Updated common_wu.py, compressFirmware.py, gen_wu.py, generate_board_docs.py, and prepare_deploy.sh with descriptive comments. Refactor CI/CD scripts for improved modularity and clarity - Consolidated build steps in task-build.yml to utilize ci.sh for version tagging, building, and artifact preparation. - Updated task-lint.yml to use ci.sh for code formatting checks instead of ci_qa.sh. - Enhanced CI_SCRIPTS.md documentation to reflect changes in script usage, command structure, and output organization. - Improved internal scripts for better error handling and logging. - Streamlined the output structure for build artifacts and documentation.
1134284 to
27c998b
Compare
| "sonoff-basic", | ||
| "sonoff-basic-rfr3" | ||
| ], | ||
| "metadata": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I agree, it was one experiment not cleaned.
| } | ||
|
|
||
| # Function to list available environments | ||
| list_environments() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
environment listing should come from environments.json and not the ini I suspect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VERSION_JSON does not look defined somewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VERSION_DEV_JSON does not look defined somewhere
| # Used by: All build scripts for centralized configuration | ||
|
|
||
| # Python Configuration | ||
| PYTHON_VERSION="3.13" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
|
||
| on: [push, pull_request] | ||
|
|
||
| jobs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we centralize this in task lint and remove this file ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
Description:
UPDATE_NOTE_START
Since I don’t like providing untested PRs, I decided to add a new commit to this PR that includes a series of scripts which allowed me to be CI-agnostic and test my proposal. I’m about 90% confident that everything works (I can’t test anything else).
UPDATE_NOTE_END
Based on the discussion on https://community.openmqttgateway.com/t/holiday-questions-d/4345, this PR provides a comprehensive refactoring of the CI/CD infrastructure.
This Pull Request maintains feature parity with the existing CI/CD pipeline, with no new actions/workflow introduced and no regressions, while significantly improving maintainability and local development experience.
Full documentation is available in:
Key Improvements
GitHub Actions Workflow Reorganization
task-build.yml,task-docs.yml,task-lint.yml) to eliminate duplicationenvironments.jsonto centralize PlatformIO build environments, improving maintainabilitybuild.yml,build_and_docs_to_dev.yml,release.yml) to leverage reusable componentsPlatform-Agnostic CI/CD Scripts
ci.shdispatcher scriptci_build.sh- Firmware build pipeline orchestrationci_site.sh- Documentation build with version managementci_qa.sh- Code linting and formatting checksci_set_version.sh- Automated version taggingci_build_firmware.sh- PlatformIO build executionci_prepare_artifacts.sh- Artifact packaging and organizationci_00_config.shfor DRY principlesComprehensive Documentation
Benefits
Future Enhancements
Testing
Checklist