mirror of
https://github.com/1technophile/OpenMQTTGateway.git
synced 2026-02-22 01:31:39 +01:00
* Refactor GitHub Actions workflows for build, documentation, and linting - 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. - 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.
91 lines
3.4 KiB
Python
91 lines
3.4 KiB
Python
# Generates board documentation table from platformio.ini environments
|
|
# Used by: .github/workflows/task-docs.yml
|
|
import pytablereader as ptr
|
|
import pandas as pd
|
|
import os
|
|
import re
|
|
import configparser
|
|
conf = configparser.ConfigParser()
|
|
|
|
# Init the table with the columns
|
|
table_init = pd.DataFrame(columns=['Environment', 'uC', 'Hardware', 'Description', 'Modules', 'Platform',
|
|
'Partitions', 'Libraries', 'Options'])
|
|
table = table_init
|
|
|
|
# Parse platformio.ini to retrieve boards information
|
|
conf.read('environments.ini')
|
|
for each_section in conf.sections():
|
|
if ("env:" in each_section and "-test" not in each_section):
|
|
env = each_section.replace("env:", "")
|
|
uc = ""
|
|
board = ""
|
|
hardware = ""
|
|
description = ""
|
|
modules = ""
|
|
platform = ""
|
|
partitions = ""
|
|
libraries = ""
|
|
options = ""
|
|
for (k, v) in conf.items(each_section):
|
|
v = v.replace('{', '').replace('}', '').replace('$', '').replace(
|
|
"env:", '').replace('\'', '').replace("-D", "")
|
|
if (k == "board"):
|
|
uc = v
|
|
if (k == "platform"):
|
|
platform = v
|
|
if (k == "board_build.partitions"):
|
|
partitions = v
|
|
if (k == "lib_deps"):
|
|
libraries = v
|
|
libraries = libraries.replace(
|
|
"\ncom-esp.lib_deps\n", "").replace(
|
|
"\ncom-arduino.lib_deps\n", "").replace("libraries.", "")
|
|
if (k == "build_flags"):
|
|
options = v
|
|
for o in options.split('\n'):
|
|
if ("gateway" in o or "sensor" in o or "actuator" in o):
|
|
if (modules != ""):
|
|
modules = modules + "\n"
|
|
modules = modules + o[1:o.rfind("=\"")]
|
|
options = options.replace(
|
|
"com-esp.build_flags\n", "")
|
|
if (k == "custom_description"):
|
|
description = v
|
|
if (k == "custom_hardware"):
|
|
hardware = v
|
|
table.loc[len(table.index)] = [env, uc, hardware, description, modules, platform,
|
|
partitions, libraries, options]
|
|
|
|
# Sort rows per Environment name
|
|
table.sort_values(by=['Environment'], inplace=True,
|
|
key=lambda col: col.str.lower())
|
|
|
|
# Produce individual file
|
|
for ind in table.index:
|
|
table_extract = table.iloc[ind]
|
|
print(table_extract)
|
|
file = open("docs/prerequisites/boards/" +
|
|
table.iloc[ind]["Environment"] + ".md", 'w')
|
|
table_extract = table_extract.rename_axis("Board index")
|
|
table_md = table_extract.to_markdown()
|
|
n = file.write(table_md)
|
|
file.close()
|
|
|
|
# Produce list file
|
|
# Add link to the file from the environment and replace /n with ,
|
|
for ind in table.index:
|
|
table['Environment'][ind] = "[" + table['Environment'][ind] + \
|
|
"](../prerequisites/boards/" + table['Environment'][ind] + ")"
|
|
|
|
table = table.replace("\n", ", ", regex=True)
|
|
table = table.drop(["Partitions", "Hardware", "Platform", "Options","Modules"], axis=1)
|
|
table = table.reset_index(drop=True)
|
|
print(table)
|
|
# Convert to Markdown and save per Model_Id
|
|
table_md = table.to_markdown()
|
|
file = open("docs/prerequisites/board.md", 'a')
|
|
n = file.write("# Supported\n" + table_md)
|
|
file = open("docs/upload/web-install.md", 'a')
|
|
n = file.write(table_md)
|
|
file.close()
|