[SITE] Renew the web board presentation and the ESP32 web upload + [SYS] Security checks (#2277)

* 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.
- 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.

Add security scan workflows for vulnerability detection

Add SBOM generation and upload to release workflow; update security scan summary handling

Add shellcheck suppor + FIX shellcheck warning

Enhance documentation for CI/CD scripts and workflows, adding details for security scanning and SBOM generation processes

Fix formatting and alignment in BLE connection handling

Reviewed the full web board presentation and the ESP32 web upload. The project uses a modern pattern where data is divided from the presentation layer.

- Removed the `generate_board_docs` script.
- Updated the `gen_wu` script in order to generate `boards-info.json`: the fail that containe all information about the configuration
- Created and isolate the file `boards-info.js` to streamline the parsing of PlatformIO dependencies, modules, environments and improve the handling of library information.
- Introduced vuepress component `BoardEnvironmentTable.vue` that render `boards-info.json` as UI card component
- Introduced vuepress component `FlashEnvironmentSelector.vue` that render a selectred environment from  `boards-info.json` and provide esp-web-upload feature on it
- Introduced a new board page `board-selector.md` for improved firmware selection.
- Updated `web-install.md` to enhance the firmware upload process, including a new board environment table.
- Enhanced custom descriptions in `environments.ini` to include HTML links for better user guidance and board image link

Add CC1101 initialization improvements and logging enhancements
Add installation step for PlatformIO dependencies in documentation workflow

Remove ci_set_version.sh script and associated versioning functionality

* Fix comment provisined

Fix PlatformIO version input reference in documentation workflow

Remove outdated Squeezelite-ESP32 installer documentation
This commit is contained in:
Alessandro Staniscia
2026-03-09 13:47:30 +01:00
committed by GitHub
parent 5f0966c2c1
commit 98481c5145
73 changed files with 5985 additions and 2447 deletions

View File

@@ -3,61 +3,59 @@ name: Reusable Documentation Workflow
on:
workflow_call:
inputs:
python-version:
description: 'Python version to use'
mode:
description: 'Build mode: "prod" or "dev"'
required: false
type: string
default: '3.11'
node-version:
description: 'Node.js version to use'
default: "prod"
version:
description: 'Version string for documentation (use "auto" for automatic detection)'
required: false
type: string
default: '14.x'
version-source:
description: 'Source of version: "release" (from GitHub release) or "custom" (provided)'
required: false
type: string
default: 'release'
custom-version:
description: 'Custom version string when version-source is "custom"'
required: false
type: string
default: ''
base-path:
description: 'Base path for documentation (e.g., "/" for prod, "/dev/" for dev)'
required: false
type: string
default: '/'
destination-dir:
description: 'Destination directory for GitHub Pages deployment'
required: false
type: string
default: '.'
generate-webuploader:
description: 'Generate WebUploader manifest'
default: "auto"
just-check:
description: "Just create a quick build to check for errors"
required: false
type: boolean
default: true
webuploader-args:
description: 'Additional arguments for gen_wu.py script'
default: false
url-prefix:
description: 'URL prefix for docs (e.g., "/" for prod, "/dev/" for dev)'
required: false
type: string
default: ''
default: "/"
run-pagespeed:
description: 'Run PageSpeed Insights after deployment'
description: "Run PageSpeed Insights after deploy"
required: false
type: boolean
default: false
pagespeed-url:
description: 'URL to test with PageSpeed Insights'
description: "URL to test with PageSpeed"
required: false
type: string
default: 'https://docs.openmqttgateway.com/'
secrets:
GITHUB_TOKEN:
required: true
APIKEY:
default: "https://docs.openmqttgateway.com/"
destination-dir:
description: "GitHub Pages destination directory"
required: false
type: string
default: "."
python-version:
description: "Python version to use"
required: false
type: string
default: "3.13"
pio-version:
description: "PlatformIO version to use"
required: false
type: string
default: "v6.1.18"
secrets:
github-token:
description: "GitHub token for deploying to GitHub Pages"
required: false
pagespeed-apikey:
description: "API key for PageSpeed Insights"
required: false
jobs:
documentation:
@@ -65,63 +63,84 @@ jobs:
name: Create and deploy documentation
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
fetch-depth: 0 # Fetch all history for git tags
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Build documentation site
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
version: "latest"
enable-cache: false
- name: Install PlatformIO dependencies
run: |
# Build script arguments based on inputs
ARGS=""
# Set version source and custom version
if [ "${{ inputs.version-source }}" = "custom" ] && [ -n "${{ inputs.custom-version }}" ]; then
ARGS="$ARGS --custom-version '${{ inputs.custom-version }}' --version-source custom"
elif [ "${{ inputs.version-source }}" = "release" ]; then
# Get latest release tag
if command -v git >/dev/null 2>&1; then
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "development")
ARGS="$ARGS --custom-version '${LATEST_TAG}' --version-source release"
uv pip install --system -U "https://github.com/pioarduino/platformio-core/archive/refs/tags/${{ inputs.pio-version }}.zip"
- name: Determine version
id: version
run: |
VERSION="${{ inputs.version }}"
MODE="${{ inputs.mode }}"
# If version is 'auto', determine it based on mode
if [ "$VERSION" = "auto" ]; then
if [ "$MODE" = "dev" ]; then
# Dev mode: always use short SHA
VERSION="$(git rev-parse --short HEAD)"
echo "Dev mode - using SHA: $VERSION"
else
ARGS="$ARGS --version-source release"
# Prod mode: try to get git tag
if GIT_TAG=$(git describe --tags --exact-match 2>/dev/null); then
VERSION="$GIT_TAG"
echo "Using exact git tag: $VERSION"
elif LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null); then
VERSION="$LATEST_TAG"
echo "Using latest tag: $VERSION"
else
VERSION="v0.0.0-unknown"
echo "Warning: No tag found, using: $VERSION"
fi
fi
fi
# Set base path/URL prefix
if [ "${{ inputs.base-path }}" != "/" ]; then
ARGS="$ARGS --url-prefix '${{ inputs.base-path }}'"
fi
# WebUploader generation
if [ "${{ inputs.generate-webuploader }}" != "true" ]; then
ARGS="$ARGS --no-webuploader"
elif [ -n "${{ inputs.webuploader-args }}" ]; then
ARGS="$ARGS --webuploader-args '${{ inputs.webuploader-args }}'"
fi
# Run the build script
eval "./scripts/ci_site.sh ${ARGS}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Final version: $VERSION"
- name: Download all firmware artifacts
if: ${{ inputs.mode == 'dev' }}
uses: actions/download-artifact@v4
with:
pattern: "*"
path: generated/artifacts
merge-multiple: true
- name: Build documentation site
run: |
./scripts/ci.sh site \
--clean \
--mode ${{ inputs.mode }} \
--version ${{ steps.version.outputs.version }} \
--url-prefix ${{ inputs.url-prefix }}
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ inputs.just-check == false }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_token: ${{ secrets.github-token }}
publish_dir: ./generated/site
destination_dir: ${{ inputs.destination-dir }}
cname: docs.openmqttgateway.com
- name: Run PageSpeed Insights
if: inputs.run-pagespeed
if: ${{ inputs.just-check == false && inputs.run-pagespeed == true }}
uses: jakepartusch/psi-action@v1.3
id: psi
with:
url: ${{ inputs.pagespeed-url }}
threshold: 60
key: ${{ secrets.APIKEY }}
key: ${{ secrets.pagespeed-apikey }}