[CI] Refactor GitHub Actions workflows for build, documentation, and linting (#2260)
* 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.
This commit is contained in:
1 parent
fd433c220e
commit
134c03362c
27 files changed
+4151
-346
No files matched your search
@@ -0,0 +1,697 @@
|
||||
# GitHub Actions Workflows Documentation
|
||||
|
||||
This document provides a overview of all GitHub Actions workflows in the OpenMQTTGateway project.
|
||||
|
||||
---
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
The workflow system is organized in two layers:
|
||||
|
||||
### **Main Workflows** (User-facing triggers)
|
||||
Entry points triggered by user actions, schedules, or events:
|
||||
- `build.yml` - CI validation on push/PR
|
||||
- `build_and_docs_to_dev.yml` - Daily development builds
|
||||
- `release.yml` - Production releases
|
||||
- `manual_docs.yml` - Documentation deployment
|
||||
- `lint.yml` - Code formatting check
|
||||
- `stale.yml` - Issue management
|
||||
|
||||
### **Task Workflows** (Reusable components)
|
||||
Parameterized building blocks called by main workflows:
|
||||
- `task-build.yml` - Configurable firmware build
|
||||
- `task-docs.yml` - Configurable documentation build
|
||||
- `task-lint.yml` - Configurable code formatting check
|
||||
|
||||
---
|
||||
|
||||
## Workflow Overview Table
|
||||
|
||||
| Workflow | Trigger | Purpose | Artifacts |
|
||||
|----------|---------|---------|-----------|
|
||||
| `build.yml` | Push, Pull Request | CI Build Validation | Firmware binaries (7 days) |
|
||||
| `build_and_docs_to_dev.yml` | Daily Cron, Manual | Development Builds + Docs | Firmware + Docs deployment |
|
||||
| `release.yml` | Release Published | Production Release | Release assets + Docs |
|
||||
| `manual_docs.yml` | Manual, Workflow Call | Documentation Only | GitHub Pages docs |
|
||||
| `lint.yml` | Push, Pull Request | Code Format Check | None |
|
||||
| `stale.yml` | Daily Cron | Issue Management | None |
|
||||
| **`task-build.yml`** | **Workflow Call** | **Reusable Build Logic** | **Configurable** |
|
||||
| **`task-docs.yml`** | **Workflow Call** | **Reusable Docs Logic** | **GitHub Pages** |
|
||||
| **`task-lint.yml`** | **Workflow Call** | **Reusable Lint Logic** | **None** |
|
||||
|
||||
---
|
||||
|
||||
## Detailed Workflow Documentation
|
||||
|
||||
### 1. `build.yml` - Continuous Integration Build
|
||||
|
||||
**Purpose**: Validates that code changes compile successfully across all supported hardware platforms.
|
||||
|
||||
**Triggers**:
|
||||
- **Push**: Every commit pushed to any branch
|
||||
- **Pull Request**: Every PR creation or update
|
||||
|
||||
**What it does**:
|
||||
1. **Build job**: Calls `task-build.yml` with CI parameters
|
||||
- Builds firmware for **83 hardware environments** in parallel
|
||||
2. **Documentation job**: Inline job that validates docs build (doesn't deploy)
|
||||
- Downloads common config from theengs.io
|
||||
- Runs `npm install` and `npm run docs:build`
|
||||
- Uses Node.js 14.x
|
||||
|
||||
**Technical Details**:
|
||||
- **Calls**: `task-build.yml` only (documentation is inline)
|
||||
- Python version: 3.13 (for build job)
|
||||
- Build strategy: Parallel matrix via task workflow
|
||||
- Artifact retention: 7 days
|
||||
- Development OTA: Disabled (`enable-dev-ota: false`)
|
||||
|
||||
**Outputs**:
|
||||
- Firmware binaries for each environment (83 artifacts)
|
||||
- No documentation deployment (validation only)
|
||||
|
||||
**Use Case**: Ensures no breaking changes before merge. Fast feedback for developers.
|
||||
|
||||
**Execution Context**: Runs for ALL contributors on ALL branches.
|
||||
|
||||
---
|
||||
|
||||
### 2. `build_and_docs_to_dev.yml` - Development Deployment Pipeline
|
||||
|
||||
**Purpose**: Creates nightly development builds and deploys documentation to the `/dev` subdirectory for testing.
|
||||
|
||||
**Triggers**:
|
||||
- **Schedule**: Daily at midnight UTC (`0 0 * * *`)
|
||||
- **Manual**: Via workflow_dispatch button
|
||||
|
||||
**What it does**:
|
||||
1. **Prepare job**: Generates 6-character short SHA
|
||||
2. **Build job**: Calls `task-build.yml` with development parameters
|
||||
- Builds firmware for **83 hardware environments** in parallel
|
||||
- Enables development OTA updates with SHA commit version
|
||||
3. **Deploy job**: Prepares and uploads assets
|
||||
- Creates library dependency zips for each board
|
||||
- Generates source code zip
|
||||
- Removes test environment binaries
|
||||
4. **Documentation job**: Calls `task-docs.yml` with development parameters
|
||||
- Deploys to `/dev` subdirectory
|
||||
- Adds "DEVELOPMENT" watermark
|
||||
- Runs PageSpeed Insights
|
||||
|
||||
**Technical Details**:
|
||||
- **Calls**: `task-build.yml` + `task-docs.yml`
|
||||
- Python version: 3.13 (build), 3.11 (docs)
|
||||
- Node.js version: 16.x (docs)
|
||||
- Repository restriction: Hardcoded to `1technophile` owner only
|
||||
- Artifact retention: 1 day
|
||||
- Build flag: `enable-dev-ota: true` (passed to task-build.yml)
|
||||
|
||||
**Outputs**:
|
||||
- Firmware binaries with `-firmware.bin` suffix
|
||||
- Bootloader and partition binaries
|
||||
- Library dependency zips per board
|
||||
- Source code zip
|
||||
- Documentation deployed to `docs.openmqttgateway.com/dev/`
|
||||
|
||||
**Version Labeling**:
|
||||
- Git SHA (6 chars) injected into firmware
|
||||
- Docs tagged: "DEVELOPMENT SHA:XXXXXX TEST ONLY"
|
||||
|
||||
**Use Case**: Daily bleeding-edge builds for early adopters and testing. Preview documentation changes.
|
||||
|
||||
**Execution Context**: Only runs on `1technophile` repository owner. Forks will skip this workflow automatically.
|
||||
|
||||
---
|
||||
|
||||
### 3. `release.yml` - Production Release Pipeline
|
||||
|
||||
**Purpose**: Creates official release builds when a new version is published.
|
||||
|
||||
**Triggers**:
|
||||
- **Release**: When a GitHub release is published (tagged)
|
||||
|
||||
**What it does**:
|
||||
1. **Prepare job**: Extracts version tag and release info
|
||||
2. **Build job**: Calls `task-build.yml` with production parameters
|
||||
- Builds firmware for **83 hardware environments** in parallel
|
||||
- Injects release tag version into firmware
|
||||
3. **Deploy job**: Prepares and uploads release assets
|
||||
- Downloads all build artifacts
|
||||
- Reorganizes for `prepare_deploy.sh` script
|
||||
- Creates library zips and source zip
|
||||
- Uploads to GitHub Release
|
||||
4. **Documentation job**: Calls `task-docs.yml` for production docs
|
||||
|
||||
**Technical Details**:
|
||||
- **Calls**: `task-build.yml` + `task-docs.yml`
|
||||
- Python version: 3.13 (build), 3.11 (docs)
|
||||
- Node.js version: 18.x
|
||||
- Build flag: Standard (no DEVELOPMENTOTA)
|
||||
- Artifact retention: 90 days
|
||||
- Uses `prepare_deploy.sh` script for asset preparation
|
||||
|
||||
**Outputs**:
|
||||
- Production firmware binaries attached to GitHub Release
|
||||
- Library zips per board
|
||||
- Source code zip
|
||||
- Production documentation at `docs.openmqttgateway.com/`
|
||||
|
||||
**Version Labeling**:
|
||||
- Git tag (e.g., `v1.2.3`) injected into firmware and `latest_version.json`
|
||||
|
||||
**Workflow Chain**:
|
||||
```
|
||||
prepare → build (task-build.yml) → deploy → documentation (task-docs.yml)
|
||||
```
|
||||
|
||||
**Use Case**: Official releases for end users. Stable, versioned firmware.
|
||||
|
||||
**Execution Context**: Triggered by repository maintainers creating releases.
|
||||
|
||||
---
|
||||
|
||||
### 4. `manual_docs.yml` - Documentation Deployment
|
||||
|
||||
**Purpose**: Entry point for standalone documentation deployment to GitHub Pages.
|
||||
|
||||
**Triggers**:
|
||||
- **Manual**: Via workflow_dispatch button
|
||||
- **Workflow Call**: Can be called by other workflows (legacy compatibility)
|
||||
|
||||
**What it does**:
|
||||
1. Calls `task-docs.yml` with production parameters
|
||||
2. Deploys to root directory (`/`) of GitHub Pages
|
||||
|
||||
**Technical Details**:
|
||||
- **Calls**: `task-docs.yml`
|
||||
- Python version: 3.11
|
||||
- Node.js version: 14.x
|
||||
- Version source: Latest GitHub release tag
|
||||
- WebUploader manifest: Enabled
|
||||
|
||||
**Outputs**:
|
||||
- Production documentation at `docs.openmqttgateway.com/`
|
||||
- Custom domain: `docs.openmqttgateway.com` (via CNAME)
|
||||
|
||||
**Use Case**: Standalone documentation updates without full release process.
|
||||
|
||||
**Execution Context**: Manual trigger or legacy workflow calls.
|
||||
|
||||
---
|
||||
|
||||
### 5. `lint.yml` - Code Format Validation
|
||||
|
||||
**Purpose**: Ensures code follows consistent formatting standards.
|
||||
|
||||
**Triggers**:
|
||||
- **Push**: Every commit pushed to any branch
|
||||
- **Pull Request**: Every PR creation or update
|
||||
|
||||
**What it does**:
|
||||
1. Calls `task-lint.yml` with specific parameters
|
||||
2. Checks formatting in `./main` directory only
|
||||
|
||||
**Technical Details**:
|
||||
- **Calls**: `task-lint.yml`
|
||||
- clang-format version: 9
|
||||
- File extensions: `.h`, `.ino` (not `.cpp`)
|
||||
- Source directory: `main` (single directory)
|
||||
|
||||
**Configuration**:
|
||||
```yaml
|
||||
source: 'main'
|
||||
extensions: 'h,ino'
|
||||
clang-format-version: '9'
|
||||
```
|
||||
|
||||
**Use Case**: Maintains code quality and consistency. Prevents formatting debates in PRs.
|
||||
|
||||
**Execution Context**: Runs for ALL contributors on ALL branches.
|
||||
|
||||
---
|
||||
|
||||
### 6. `stale.yml` - Issue and PR Management
|
||||
|
||||
**Purpose**: Automatically closes inactive issues and pull requests to reduce maintenance burden.
|
||||
|
||||
**Triggers**:
|
||||
- **Schedule**: Daily at 00:30 UTC (`30 0 * * *`)
|
||||
|
||||
**What it does**:
|
||||
1. Marks issues/PRs as stale after 90 days of inactivity
|
||||
2. Closes stale issues/PRs after 14 additional days
|
||||
3. Exempts issues labeled "enhancement"
|
||||
|
||||
**Configuration**:
|
||||
- Stale after: 90 days
|
||||
- Close after: 14 days (104 days total)
|
||||
- Stale label: `stale`
|
||||
- Exempt labels: `enhancement`
|
||||
|
||||
**Messages**:
|
||||
- Stale: "This issue is stale because it has been open for 90 days with no activity."
|
||||
- Close: "This issue was closed because it has been inactive for 14 days since being marked as stale."
|
||||
|
||||
**Use Case**: Housekeeping. Reduces backlog of abandoned issues.
|
||||
|
||||
**Execution Context**: Automated maintenance by GitHub bot.
|
||||
|
||||
---
|
||||
|
||||
## Task Workflows (Reusable Components)
|
||||
|
||||
### 7. `task-build.yml` - Reusable Build Workflow
|
||||
|
||||
**Purpose**: Parameterized firmware build logic used by multiple workflows.
|
||||
|
||||
**Trigger**: `workflow_call` only (called by other workflows)
|
||||
|
||||
**Parameters**:
|
||||
- `python-version`: Python version (default: '3.13')
|
||||
- `enable-dev-ota`: Enable development OTA (default: false)
|
||||
- `version-tag`: Version to inject (default: 'unspecified')
|
||||
- `artifact-retention-days`: Artifact retention (default: 7)
|
||||
- `artifact-name-prefix`: Artifact name prefix (default: '')
|
||||
- `prepare-for-deploy`: Prepare for deployment (default: false)
|
||||
|
||||
**What it does**:
|
||||
1. **Load environments**: Reads environment list from `environments.json`
|
||||
2. **Matrix build**: Builds all 83 environments in parallel
|
||||
3. **Build execution**: Calls unified `ci.sh build <environment> [OPTIONS]`:
|
||||
- `<environment>`: Target hardware (e.g., `esp32dev-ble`)
|
||||
- `--version <tag>`: Version to inject (SHA for dev, tag for prod)
|
||||
- `--mode <dev|prod>`: Build mode (enables/disables OTA)
|
||||
- `--deploy-ready`: Prepare artifacts for deployment
|
||||
- `--output <dir>`: Output directory for artifacts (default: `generated/artifacts/`)
|
||||
|
||||
**Command Flow**:
|
||||
```bash
|
||||
./scripts/ci.sh build esp32dev-ble --version v1.8.0 --mode prod --deploy-ready
|
||||
↓
|
||||
├─→ ci_build.sh (orchestrator)
|
||||
│ ├─→ ci_set_version.sh v1.8.0 [--dev]
|
||||
│ ├─→ ci_build_firmware.sh esp32dev-ble [--dev-ota]
|
||||
│ └─→ ci_prepare_artifacts.sh esp32dev-ble [--deploy] → outputs to generated/artifacts/
|
||||
```
|
||||
|
||||
**Technical Details**:
|
||||
- Runs on: Ubuntu latest
|
||||
- PlatformIO version: 6.1.18 (custom fork: `pioarduino/platformio-core`)
|
||||
- Python package manager: `uv` (astral-sh/setup-uv@v6)
|
||||
- Strategy: Matrix with fail-fast: false
|
||||
- Main orchestrator: `ci.sh` → `ci_build.sh` → sub-scripts
|
||||
|
||||
**Callers**:
|
||||
- `build.yml` (CI validation)
|
||||
- `build_and_docs_to_dev.yml` (development builds)
|
||||
- `release.yml` (production releases)
|
||||
|
||||
---
|
||||
|
||||
### 8. `task-docs.yml` - Reusable Documentation Workflow
|
||||
|
||||
**Purpose**: Parameterized documentation build and deployment logic.
|
||||
|
||||
**Trigger**: `workflow_call` only (called by other workflows)
|
||||
|
||||
**Parameters**:
|
||||
- `python-version`: Python version (default: '3.11')
|
||||
- `node-version`: Node.js version (default: '14.x')
|
||||
- `version-source`: Version source ('release', 'git-tag', 'custom')
|
||||
- `custom-version`: Custom version string (optional)
|
||||
- `base-path`: Base URL path (default: '/')
|
||||
- `destination-dir`: Deploy directory (default: '.')
|
||||
- `generate-webuploader`: Generate WebUploader manifest (default: true)
|
||||
- `webuploader-args`: WebUploader generation arguments (optional)
|
||||
- `run-pagespeed`: Run PageSpeed Insights (default: false)
|
||||
- `pagespeed-url`: URL for PageSpeed test (optional)
|
||||
|
||||
**What it does**:
|
||||
1. **Build documentation**: Calls unified `ci.sh site [OPTIONS]`:
|
||||
- `--mode <dev|prod>`: Documentation mode
|
||||
- `--custom-version <ver>`: Custom version string
|
||||
- `--version-source <release|custom>`: Version source
|
||||
- `--url-prefix <path>`: Base URL path (e.g., `/dev/`)
|
||||
- `--webuploader-args <args>`: WebUploader options
|
||||
- `--no-webuploader`: Skip manifest generation
|
||||
2. **Deploy**: Publishes to GitHub Pages using `peaceiris/actions-gh-pages@v3`
|
||||
3. **PageSpeed test**: Optionally runs performance audit
|
||||
|
||||
**Command Flow**:
|
||||
```bash
|
||||
./scripts/ci.sh site --mode prod --version-source release --url-prefix /
|
||||
↓
|
||||
└─→ ci_site.sh (orchestrator)
|
||||
├─→ generate_board_docs.py (auto-generate board docs)
|
||||
├─→ npm run docs:build (VuePress compilation)
|
||||
└─→ gen_wu.py (WebUpdater manifest)
|
||||
```
|
||||
|
||||
**Callers**:
|
||||
- `build_and_docs_to_dev.yml` (dev docs to `/dev`)
|
||||
- `release.yml` (production docs to `/`)
|
||||
- `manual_docs.yml` (manual production docs)
|
||||
|
||||
---
|
||||
|
||||
### 9. `task-lint.yml` - Reusable Lint Workflow
|
||||
|
||||
**Purpose**: Parameterized code formatting validation.
|
||||
|
||||
**Trigger**: `workflow_call` only (called by other workflows)
|
||||
|
||||
**Parameters**:
|
||||
- `source`: Source directories to lint (default: './lib ./main')
|
||||
- `extensions`: File extensions to check (default: 'h,ino,cpp')
|
||||
- `clang-format-version`: clang-format version (default: '9')
|
||||
- `exclude-pattern`: Pattern to exclude (optional)
|
||||
|
||||
**What it does**:
|
||||
1. Checks out code
|
||||
2. Installs clang-format (specified version)
|
||||
3. Runs unified `ci.sh qa [OPTIONS]`:
|
||||
- `--check`: Validation mode (exit on violations)
|
||||
- `--fix`: Auto-fix formatting issues
|
||||
- `--source <dir>`: Directory to lint
|
||||
- `--extensions <list>`: File extensions (comma-separated)
|
||||
- `--clang-format-version <ver>`: Formatter version
|
||||
4. Fails if formatting violations found
|
||||
|
||||
**Command Flow**:
|
||||
```bash
|
||||
./scripts/ci.sh qa --check --source main --extensions h,ino --clang-format-version 9
|
||||
↓
|
||||
└─→ ci_qa.sh (formatter)
|
||||
└─→ clang-format (checks/fixes code style)
|
||||
```
|
||||
|
||||
**Technical Details**:
|
||||
- Script: `ci_qa.sh` (custom formatting check script)
|
||||
- Install: `clang-format-$version` via apt-get
|
||||
- Default source: `main` (single directory)
|
||||
- Default extensions: `h,ino` (not cpp)
|
||||
|
||||
**Callers**:
|
||||
- `lint.yml` (CI lint check)
|
||||
|
||||
**Default Behavior**: If called without parameters, lints `main` directory for `.h` and `.ino` files.
|
||||
|
||||
---
|
||||
|
||||
## Workflow Dependencies and Call Chain
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
%% Triggers
|
||||
subgraph triggers ["🎯 Triggers"]
|
||||
push["Push / Pull Request"]
|
||||
release["Release Published"]
|
||||
manual["Manual Trigger"]
|
||||
cron1["Cron: Daily 00:00 UTC"]
|
||||
cron2["Cron: Daily 00:30 UTC"]
|
||||
end
|
||||
|
||||
subgraph github_workflows ["📋 GitHub Workflows"]
|
||||
%% Main Workflows
|
||||
subgraph main ["📋 Main Workflows"]
|
||||
lint["lint.yml<br/>Format Check"]
|
||||
|
||||
build["build.yml<br/>CI Build"]
|
||||
|
||||
release_wf["release.yml<br/>Production Release"]
|
||||
manual_docs["manual_docs.yml<br/>Docs Only"]
|
||||
build_dev["build_and_docs_to_dev.yml<br/>Dev Builds"]
|
||||
stale["stale.yml<br/>Issue Management"]
|
||||
end
|
||||
|
||||
%% Task Workflows
|
||||
subgraph tasks ["⚙️ Task Workflows"]
|
||||
task_build["task-build.yml<br/>Build Firmware"]
|
||||
task_docs["task-docs.yml<br/>Build & Deploy Docs"]
|
||||
task_lint["task-lint.yml<br/>Code Format"]
|
||||
end
|
||||
end
|
||||
|
||||
subgraph ci_scripts ["🔧 CI Scripts"]
|
||||
%% CI Scripts Layer
|
||||
subgraph bash ["🔧 Orchestrator"]
|
||||
ci_main["ci.sh<br/>(main dispatcher)"]
|
||||
ci_build_script["ci_build.sh<br/>(build orchestrator)"]
|
||||
ci_site_script["ci_site.sh<br/>(docs orchestrator)"]
|
||||
ci_qa_script["ci_qa.sh<br/>(lint orchestrator)"]
|
||||
end
|
||||
|
||||
%% Sub-Scripts Layer
|
||||
subgraph sub_scripts ["⚙️ Workers"]
|
||||
ci_set_ver["ci_set_version.sh<br/>(version injection)"]
|
||||
ci_build_fw["ci_build_firmware.sh<br/>(PlatformIO build)"]
|
||||
ci_prep_art["ci_prepare_artifacts.sh<br/>(artifact packaging)"]
|
||||
gen_board["generate_board_docs.py<br/>(board docs)"]
|
||||
gen_wu["gen_wu.py<br/>(WebUpdater manifest)"]
|
||||
clang_fmt["clang-format<br/>(code formatter)"]
|
||||
end
|
||||
end
|
||||
|
||||
%% Trigger connections
|
||||
push --> lint
|
||||
push --> build
|
||||
|
||||
release --> release_wf
|
||||
manual --> manual_docs
|
||||
cron1 --> build_dev
|
||||
cron2 --> stale
|
||||
|
||||
%% Main workflow to task workflow connections
|
||||
build -->|calls| task_build
|
||||
lint -->|calls| task_lint
|
||||
build_dev -->|calls| task_build
|
||||
build_dev -->|calls| task_docs
|
||||
release_wf -->|calls| task_build
|
||||
release_wf -->|calls| task_docs
|
||||
manual_docs -->|calls| task_docs
|
||||
|
||||
%% Task workflows to CI scripts
|
||||
task_build -->|"ci.sh build<br/>--version --mode<br/>--deploy-ready"| ci_main
|
||||
task_docs -->|"ci.sh site<br/>--mode --url-prefix<br/>--version-source"| ci_main
|
||||
task_lint -->|"ci.sh qa<br/>--check --source<br/>--extensions"| ci_main
|
||||
|
||||
%% CI main dispatcher to orchestrators
|
||||
ci_main -->|"route: build"| ci_build_script
|
||||
ci_main -->|"route: site"| ci_site_script
|
||||
ci_main -->|"route: qa"| ci_qa_script
|
||||
|
||||
%% Orchestrators to workers
|
||||
ci_build_script --> ci_set_ver
|
||||
ci_build_script --> ci_build_fw
|
||||
ci_build_script --> ci_prep_art
|
||||
|
||||
ci_site_script --> gen_board
|
||||
ci_site_script --> gen_wu
|
||||
|
||||
ci_qa_script --> clang_fmt
|
||||
|
||||
%% Styling
|
||||
classDef triggerStyle fill:#e1f5ff,stroke:#0066cc,stroke-width:2px
|
||||
classDef mainStyle fill:#fff4e6,stroke:#ff9900,stroke-width:2px
|
||||
classDef taskStyle fill:#e6f7e6,stroke:#00aa00,stroke-width:2px
|
||||
classDef ciStyle fill:#ffe6f0,stroke:#cc0066,stroke-width:2px
|
||||
classDef subStyle fill:#f0e6ff,stroke:#9933ff,stroke-width:2px
|
||||
|
||||
class push,release,manual,cron1,cron2 triggerStyle
|
||||
class build,lint,release_wf,manual_docs,build_dev,stale mainStyle
|
||||
class task_build,task_docs,task_lint taskStyle
|
||||
class ci_main,ci_build_script,ci_site_script,ci_qa_script ciStyle
|
||||
class ci_set_ver,ci_build_fw,ci_prep_art,gen_board,gen_wu,clang_fmt subStyle
|
||||
|
||||
|
||||
style github_workflows stroke:#6A7BD8,stroke-dasharray:6 4,stroke-width:1.8px,fill:#fbfbfc
|
||||
style main stroke:#6A7BD8,stroke-dasharray:6 4,stroke-width:0.6px,fill:#fcfdff
|
||||
style tasks stroke:#6A7BD8,stroke-dasharray:6 4,stroke-width:0.6px,fill:#fcfdff
|
||||
|
||||
style ci_scripts stroke:#FF9A3C,stroke-dasharray:6 4,stroke-width:1.8px,fill:#fffaf5
|
||||
style bash stroke:#FF9A3C,stroke-dasharray:6 4,stroke-width:0.6px,fill:#fffaf5
|
||||
style sub_scripts stroke:#FF9A3C,stroke-dasharray:6 4,stroke-width:0.6px,fill:#fffaf5
|
||||
|
||||
style triggers fill:none,stroke:none
|
||||
|
||||
```
|
||||
|
||||
### Workflow Relationships
|
||||
|
||||
**Main → Task Mapping**:
|
||||
- `build.yml` → calls `task-build.yml` (also contains inline documentation job)
|
||||
- `lint.yml` → calls `task-lint.yml`
|
||||
- `build_and_docs_to_dev.yml` → calls `task-build.yml` + `task-docs.yml` (with prepare/deploy jobs)
|
||||
- `release.yml` → calls `task-build.yml` + `task-docs.yml` (with prepare/deploy jobs)
|
||||
- `manual_docs.yml` → calls `task-docs.yml`
|
||||
- `stale.yml` → standalone (no dependencies)
|
||||
|
||||
**Task → CI Script Mapping**:
|
||||
- `task-build.yml` → `ci.sh build <env> --version --mode --deploy-ready`
|
||||
- Routes to: `ci_build.sh` → `ci_set_version.sh`, `ci_build_firmware.sh`, `ci_prepare_artifacts.sh`
|
||||
- Output: `generated/artifacts/` (default, can be overridden with `--output`)
|
||||
- `task-docs.yml` → `ci.sh site --mode --version-source --url-prefix --webuploader-args`
|
||||
- Routes to: `ci_site.sh` → `generate_board_docs.py`, `gen_wu.py`, VuePress
|
||||
- Output: `generated/site/`
|
||||
- `task-lint.yml` → `ci.sh qa --check --source --extensions --clang-format-version`
|
||||
- Routes to: `ci_qa.sh` → `clang-format`
|
||||
|
||||
**Job Dependencies**:
|
||||
- `build_and_docs_to_dev.yml`: prepare → build (task) → deploy & documentation (task)
|
||||
- `release.yml`: prepare → build (task) → deploy → documentation (task)
|
||||
|
||||
**Script Execution Flow**:
|
||||
```
|
||||
GitHub Action (task-*.yml)
|
||||
↓
|
||||
./scripts/ci.sh <command> [OPTIONS] ← Main dispatcher
|
||||
↓
|
||||
./scripts/ci_<command>.sh ← Command orchestrator
|
||||
↓
|
||||
./scripts/ci_*.sh / *.py ← Worker scripts
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Environment Configuration
|
||||
|
||||
### Centralized Environment Management
|
||||
|
||||
All build environments are defined in `.github/workflows/environments.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"environments": {
|
||||
"all": [ ...83 environments ],
|
||||
"metadata": {
|
||||
"totalCount": 83,
|
||||
"lastUpdated": "2024-12-25",
|
||||
"categories": {
|
||||
"esp32": 50,
|
||||
"esp8266": 20,
|
||||
"specialized": 13
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Benefits**:
|
||||
- ✅ Single source of truth
|
||||
- ✅ Eliminates duplication across workflows
|
||||
- ✅ Easier to maintain and update
|
||||
- ✅ Consistent builds across CI/dev/release
|
||||
|
||||
### Environment Categories
|
||||
|
||||
**ESP32 Family** (~50 environments):
|
||||
- Standard: `esp32dev-*` variants
|
||||
- ESP32-S3: `esp32s3-*` variants
|
||||
- ESP32-C3: `esp32c3-*` variants
|
||||
- Specialized boards: M5Stack, Heltec, LilyGO, Theengs
|
||||
|
||||
**ESP8266 Family** (~20 environments):
|
||||
- NodeMCU: `nodemcuv2-*` variants
|
||||
- Sonoff: `sonoff-*` variants
|
||||
- Generic: `esp8266-*` variants
|
||||
|
||||
**Specialized Boards** (~13 environments):
|
||||
- Theengs Plug
|
||||
- Theengs Bridge
|
||||
- RF Bridge variants
|
||||
- Custom board configurations
|
||||
|
||||
---
|
||||
|
||||
## Configuration Variables
|
||||
|
||||
### Repository Restrictions
|
||||
|
||||
**Development Builds** (`build_and_docs_to_dev.yml`):
|
||||
- Hardcoded restriction: `github.repository_owner == '1technophile'`
|
||||
- Only runs for the main repository owner
|
||||
- Prevents accidental deployments from forks
|
||||
- No configuration variable needed
|
||||
|
||||
**Release Builds** (`release.yml`):
|
||||
- No repository restrictions
|
||||
- Runs on any fork when a release is published
|
||||
- Deploy step requires proper GitHub token permissions
|
||||
|
||||
**Documentation** (`manual_docs.yml`):
|
||||
- No repository restrictions
|
||||
- Can be triggered manually from any fork
|
||||
- Requires GitHub Pages to be configured
|
||||
|
||||
---
|
||||
|
||||
## Glossary
|
||||
|
||||
- **Environment**: A specific hardware board + gateway combination (e.g., `esp32dev-ble`)
|
||||
- **Matrix Build**: Parallel execution of builds across multiple environments
|
||||
- **Artifact**: Build output stored temporarily for download (firmware binaries)
|
||||
- **workflow_call**: GitHub Actions feature for calling one workflow from another
|
||||
- **workflow_dispatch**: Manual trigger button for workflows
|
||||
- **Task Workflow**: Reusable workflow component with parameterized inputs
|
||||
- **Main Workflow**: Entry point workflow triggered by events or schedules
|
||||
- **CNAME**: Custom domain configuration for GitHub Pages
|
||||
- **OTA**: Over-The-Air firmware update capability
|
||||
- **SHA**: Git commit hash used for version identification in dev builds
|
||||
|
||||
---
|
||||
|
||||
## Maintenance Notes
|
||||
|
||||
### CI/CD Script Architecture
|
||||
|
||||
**Main Entry Point**: `ci.sh` (unified interface)
|
||||
- Commands: `build`, `site`, `qa`, `all`
|
||||
- Routes to specialized orchestrators
|
||||
- Provides consistent CLI across all operations
|
||||
|
||||
**Build System** (`ci.sh build`):
|
||||
- PlatformIO 6.1.18 from custom fork: `pioarduino/platformio-core`
|
||||
- Python package manager: `uv` for fast dependency installation
|
||||
- Orchestrator: `ci_build.sh`
|
||||
- Worker: `ci_set_version.sh` (version injection)
|
||||
- Worker: `ci_build_firmware.sh` (PlatformIO compilation)
|
||||
- Worker: `ci_prepare_artifacts.sh` (artifact packaging)
|
||||
|
||||
**Documentation System** (`ci.sh site`):
|
||||
- Documentation framework: VuePress
|
||||
- Orchestrator: `ci_site.sh`
|
||||
- Worker: `generate_board_docs.py` (auto-generate board pages)
|
||||
- Worker: `gen_wu.py` (WebUpdater manifest)
|
||||
- External: Common config from theengs.io
|
||||
|
||||
**Code Quality** (`ci.sh qa`):
|
||||
- Orchestrator: `ci_qa.sh`
|
||||
- Worker: `clang-format` version 9
|
||||
- Default scope: `main` directory, `.h` and `.ino` files
|
||||
|
||||
**Configuration**:
|
||||
- Environment list: `.github/workflows/environments.json` (83 environments)
|
||||
- Task workflows: `task-*.yml` (reusable GitHub Actions components)
|
||||
- Repository owner restriction: Hardcoded to `1technophile` for dev deployments
|
||||
- All scripts located in: `./scripts/`
|
||||
|
||||
**Local Development**:
|
||||
```bash
|
||||
# Build firmware locally
|
||||
./scripts/ci.sh build esp32dev-ble --mode dev --version test
|
||||
|
||||
# Build documentation locally
|
||||
./scripts/ci.sh site --mode dev --preview
|
||||
|
||||
# Check code format
|
||||
./scripts/ci.sh qa --check
|
||||
|
||||
# Run complete pipeline
|
||||
./scripts/ci.sh all esp32dev-ble --version v1.8.0
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Document Version**: 2.1
|
||||
**Last Updated**: December 29, 2025
|
||||
**Maintainer**: OpenMQTTGateway Development Team
|
||||
+8
-116
@@ -4,125 +4,17 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
environments:
|
||||
- "rfbridge"
|
||||
- "rfbridge-direct"
|
||||
- "esp32dev-all-test"
|
||||
- "esp32dev-rf"
|
||||
- "esp32dev-pilight-cc1101"
|
||||
- "esp32dev-somfy-cc1101"
|
||||
- "esp32dev-pilight-somfy-cc1101"
|
||||
- "esp32dev-weatherstation"
|
||||
- "esp32dev-gf-sun-inverter"
|
||||
- "esp32dev-ir"
|
||||
- "esp32dev-ble"
|
||||
- "esp32dev-ble-mqtt-undecoded"
|
||||
- "esp32dev-ble-aws"
|
||||
- "esp32feather-ble"
|
||||
- "esp32-lolin32lite-ble"
|
||||
- "esp32-olimex-gtw-ble-eth"
|
||||
- "esp32-olimex-gtw-ble-poe"
|
||||
- "esp32-olimex-gtw-ble-poe-iso"
|
||||
- "esp32-wt32-eth01-ble-eth"
|
||||
- "esp32-olimex-gtw-ble-wifi"
|
||||
- "esp32-m5stick-ble"
|
||||
- "esp32-m5stack-ble"
|
||||
- "esp32-m5tough-ble"
|
||||
- "esp32-m5stick-c-ble"
|
||||
- "esp32-m5stick-cp-ble"
|
||||
- "esp32s3-atomS3U"
|
||||
- "esp32-m5atom-matrix"
|
||||
- "esp32-m5atom-lite"
|
||||
- "esp32dev-rtl_433"
|
||||
- "esp32dev-rtl_433-fsk"
|
||||
- "esp32doitv1-aithinker-r01-sx1278"
|
||||
- "heltec-rtl_433"
|
||||
- "heltec-rtl_433-fsk"
|
||||
- "heltec-ble"
|
||||
- "lilygo-rtl_433"
|
||||
- "lilygo-rtl_433-fsk"
|
||||
- "lilygo-ble"
|
||||
- "esp32dev-multi_receiver"
|
||||
- "esp32dev-multi_receiver-pilight"
|
||||
- "tinypico-ble"
|
||||
- "ttgo-lora32-v1"
|
||||
- "ttgo-lora32-v21"
|
||||
- "ttgo-t-beam"
|
||||
- "heltec-wifi-lora-32"
|
||||
- "shelly-plus1"
|
||||
- "nodemcuv2-all-test"
|
||||
- "nodemcuv2-fastled-test"
|
||||
- "nodemcuv2-2g"
|
||||
- "nodemcuv2-ir"
|
||||
- "nodemcuv2-serial"
|
||||
- "avatto-bakeey-ir"
|
||||
- "nodemcuv2-rf"
|
||||
- "nodemcuv2-rf-cc1101"
|
||||
- "nodemcuv2-somfy-cc1101"
|
||||
- "manual-wifi-test"
|
||||
- "rf-wifi-gateway"
|
||||
- "nodemcuv2-rf2"
|
||||
- "nodemcuv2-rf2-cc1101"
|
||||
- "nodemcuv2-pilight"
|
||||
- "nodemcuv2-weatherstation"
|
||||
- "sonoff-basic"
|
||||
- "sonoff-basic-rfr3"
|
||||
- "esp32dev-ble-datatest"
|
||||
- "esp32s3-dev-c1-ble"
|
||||
- "esp32c3-dev-m1-ble"
|
||||
- "airm2m_core_esp32c3"
|
||||
- "esp32c3_lolin_mini"
|
||||
- "esp32c3-m5stamp"
|
||||
- "thingpulse-espgateway"
|
||||
- "theengs-bridge"
|
||||
- "esp32dev-ble-idf"
|
||||
- "theengs-bridge-v11"
|
||||
- "theengs-plug"
|
||||
- "esp32dev-ble-broker"
|
||||
- "esp32s3-m5stack-stamps3"
|
||||
- "esp32c3u-m5stamp"
|
||||
- "lilygo-t3-s3-rtl_433"
|
||||
- "lilygo-t3-s3-rtl_433-fsk"
|
||||
runs-on: ubuntu-latest
|
||||
name: Build with PlatformIO
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.13'
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v6
|
||||
with:
|
||||
version: "latest"
|
||||
enable-cache: false
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
uv pip install --system -U https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.18.zip
|
||||
- name: Extract ESP32 platform version from platformio.ini
|
||||
run: |
|
||||
ESP32_VERSION=$(grep 'esp32_platform\s*=' platformio.ini | cut -d'@' -f2 | tr -d '[:space:]')
|
||||
echo "ESP32_PLATFORM_VERSION=${ESP32_VERSION}" >> $GITHUB_ENV
|
||||
- name: Run PlatformIO
|
||||
env:
|
||||
PYTHONIOENCODING: utf-8
|
||||
PYTHONUTF8: '1'
|
||||
run: platformio run -e ${{ matrix.environments }}
|
||||
- name: Upload Assets
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.environments }}
|
||||
path: |
|
||||
.pio/build/*/firmware.bin
|
||||
.pio/build/*/partitions.bin
|
||||
retention-days: 7
|
||||
name: Build firmware
|
||||
uses: ./.github/workflows/task-build.yml
|
||||
with:
|
||||
python-version: '3.13'
|
||||
enable-dev-ota: false
|
||||
artifact-retention-days: 7
|
||||
prepare-for-deploy: false
|
||||
|
||||
documentation:
|
||||
name: Build documentation
|
||||
runs-on: ubuntu-latest
|
||||
name: Create the documentation
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Node.js
|
||||
|
||||
@@ -1,173 +1,65 @@
|
||||
name: Build binaries, docs and publish to dev folder
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
environments:
|
||||
- "rfbridge"
|
||||
- "rfbridge-direct"
|
||||
- "theengs-bridge"
|
||||
- "theengs-bridge-v11"
|
||||
- "theengs-plug"
|
||||
- "esp32dev-all-test"
|
||||
- "esp32dev-rf"
|
||||
- "esp32dev-pilight"
|
||||
- "esp32dev-pilight-cc1101"
|
||||
- "esp32dev-somfy-cc1101"
|
||||
- "esp32dev-pilight-somfy-cc1101"
|
||||
- "esp32dev-weatherstation"
|
||||
- "esp32dev-gf-sun-inverter"
|
||||
- "esp32dev-ir"
|
||||
- "esp32dev-ble"
|
||||
- "esp32dev-ble-broker"
|
||||
- "esp32dev-ble-mqtt-undecoded"
|
||||
- "esp32dev-ble-aws"
|
||||
- "esp32feather-ble"
|
||||
- "esp32-lolin32lite-ble"
|
||||
- "esp32-olimex-gtw-ble-eth"
|
||||
- "esp32-olimex-gtw-ble-poe"
|
||||
- "esp32-olimex-gtw-ble-poe-iso"
|
||||
- "esp32-wt32-eth01-ble-eth"
|
||||
- "esp32-olimex-gtw-ble-wifi"
|
||||
- "esp32-m5stick-ble"
|
||||
- "esp32-m5stack-ble"
|
||||
- "esp32-m5tough-ble"
|
||||
- "esp32-m5stick-c-ble"
|
||||
- "esp32-m5stick-cp-ble"
|
||||
- "esp32-m5atom-matrix"
|
||||
- "esp32-m5atom-lite"
|
||||
- "esp32doitv1-aithinker-r01-sx1278"
|
||||
- "esp32dev-rtl_433"
|
||||
- "esp32dev-rtl_433-fsk"
|
||||
- "heltec-rtl_433"
|
||||
- "heltec-rtl_433-fsk"
|
||||
- "heltec-ble"
|
||||
- "lilygo-rtl_433"
|
||||
- "lilygo-rtl_433-fsk"
|
||||
- "lilygo-t3-s3-rtl_433"
|
||||
- "lilygo-t3-s3-rtl_433-fsk"
|
||||
- "lilygo-ble"
|
||||
- "esp32dev-multi_receiver"
|
||||
- "esp32dev-multi_receiver-pilight"
|
||||
- "tinypico-ble"
|
||||
- "ttgo-lora32-v1"
|
||||
- "ttgo-lora32-v21"
|
||||
- "ttgo-t-beam"
|
||||
- "heltec-wifi-lora-32"
|
||||
- "shelly-plus1"
|
||||
- "nodemcuv2-all-test"
|
||||
- "nodemcuv2-fastled-test"
|
||||
- "nodemcuv2-2g"
|
||||
- "nodemcuv2-ir"
|
||||
- "nodemcuv2-serial"
|
||||
- "avatto-bakeey-ir"
|
||||
- "nodemcuv2-rf"
|
||||
- "nodemcuv2-rf-cc1101"
|
||||
- "nodemcuv2-somfy-cc1101"
|
||||
- "manual-wifi-test"
|
||||
- "rf-wifi-gateway"
|
||||
- "nodemcuv2-rf2"
|
||||
- "nodemcuv2-rf2-cc1101"
|
||||
- "nodemcuv2-pilight"
|
||||
- "nodemcuv2-weatherstation"
|
||||
- "sonoff-basic"
|
||||
- "sonoff-basic-rfr3"
|
||||
- "esp32dev-ble-datatest"
|
||||
- "esp32s3-dev-c1-ble"
|
||||
- "esp32s3-m5stack-stamps3"
|
||||
- "esp32s3-atomS3U"
|
||||
- "esp32c3-dev-m1-ble"
|
||||
- "airm2m_core_esp32c3"
|
||||
- "esp32c3-dev-c2-ble"
|
||||
- "esp32c3-dev-c2-ble-no-serial"
|
||||
- "esp32c3_lolin_mini"
|
||||
- "esp32c3_lolin_mini_with_serial"
|
||||
- "esp32c3-m5stamp"
|
||||
- "esp32c3u-m5stamp"
|
||||
- "thingpulse-espgateway"
|
||||
- "esp32dev-ble-idf"
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == '1technophile'
|
||||
name: Build ${{ matrix.environments }}
|
||||
outputs:
|
||||
short-sha: ${{ steps.short-sha.outputs.sha }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: benjlevesque/short-sha@v2.1
|
||||
id: short-sha
|
||||
with:
|
||||
length: 6
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.13"
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v6
|
||||
with:
|
||||
version: "latest"
|
||||
enable-cache: false
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
uv pip install --system -U https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.18.zip
|
||||
- name: Set sha tag
|
||||
run: |
|
||||
sed -i "s/version_tag/${{ steps.short-sha.outputs.sha }}/g" main/User_config.h scripts/latest_version_dev.json
|
||||
- name: Run PlatformIO
|
||||
env:
|
||||
PYTHONIOENCODING: utf-8
|
||||
PYTHONUTF8: '1'
|
||||
run: |
|
||||
export PLATFORMIO_BUILD_FLAGS="'-DDEVELOPMENTOTA=true'"
|
||||
platformio run -e ${{ matrix.environments }}
|
||||
- name: Prepare firmware artifacts
|
||||
run: |
|
||||
mkdir -p firmware
|
||||
cp .pio/build/${{ matrix.environments }}/firmware.bin firmware/${{ matrix.environments }}-firmware.bin
|
||||
if [ -f .pio/build/${{ matrix.environments }}/partitions.bin ]; then
|
||||
cp .pio/build/${{ matrix.environments }}/partitions.bin firmware/${{ matrix.environments }}-partitions.bin
|
||||
fi
|
||||
if [ -f .pio/build/${{ matrix.environments }}/bootloader.bin ]; then
|
||||
cp .pio/build/${{ matrix.environments }}/bootloader.bin firmware/${{ matrix.environments }}-bootloader.bin
|
||||
fi
|
||||
- name: Upload firmware
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: firmware-${{ matrix.environments }}
|
||||
path: firmware/
|
||||
retention-days: 1
|
||||
|
||||
build:
|
||||
needs: prepare
|
||||
name: Build development firmware
|
||||
uses: ./.github/workflows/task-build.yml
|
||||
with:
|
||||
python-version: '3.13'
|
||||
enable-dev-ota: true
|
||||
version-tag: ${{ needs.prepare.outputs.short-sha }}
|
||||
artifact-retention-days: 1
|
||||
artifact-name-prefix: 'firmware-'
|
||||
prepare-for-deploy: true
|
||||
|
||||
deploy:
|
||||
needs: build
|
||||
needs: [prepare, build]
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == '1technophile'
|
||||
name: Deploy binaries and docs
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: benjlevesque/short-sha@v2.1
|
||||
id: short-sha
|
||||
with:
|
||||
length: 6
|
||||
|
||||
- name: Download all firmware artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: firmware-*
|
||||
path: toDeploy
|
||||
merge-multiple: true
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v6
|
||||
with:
|
||||
version: "latest"
|
||||
enable-cache: false
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
uv pip install --system -U https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.18.zip
|
||||
|
||||
- name: Create library zips
|
||||
run: |
|
||||
# Install libraries for a representative environment to get libdeps
|
||||
@@ -180,6 +72,7 @@ jobs:
|
||||
zip -r "${i%/}-libraries.zip" "$i"
|
||||
done
|
||||
mv *.zip ../../toDeploy/
|
||||
|
||||
- name: Prepare additional assets
|
||||
run: |
|
||||
cd toDeploy
|
||||
@@ -189,33 +82,22 @@ jobs:
|
||||
# Zip source code
|
||||
zip -r toDeploy/OpenMQTTGateway_sources.zip main LICENSE.txt
|
||||
ls -lA toDeploy/
|
||||
- name: Set sha tag for docs
|
||||
run: |
|
||||
sed -i "s/version_tag/DEVELOPMENT SHA:${{ steps.short-sha.outputs.sha }} TEST ONLY/g" docs/.vuepress/config.js
|
||||
sed -i "s|base: '/'|base: '/dev/'|g" docs/.vuepress/config.js
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "16.x"
|
||||
- name: Download Common Config
|
||||
run: |
|
||||
curl -o docs/.vuepress/public/commonConfig.js https://www.theengs.io/commonConfig.js
|
||||
- name: Build documentation
|
||||
run: |
|
||||
python ./scripts/gen_wu.py --dev
|
||||
npm install
|
||||
npm run docs:build
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./docs/.vuepress/dist
|
||||
destination_dir: dev
|
||||
cname: docs.openmqttgateway.com
|
||||
- name: Running Page Speed Insights
|
||||
uses: jakepartusch/psi-action@v1.3
|
||||
id: psi
|
||||
with:
|
||||
url: "https://docs.openmqttgateway.com/dev/"
|
||||
threshold: 60
|
||||
key: ${{ secrets.APIKEY }}
|
||||
|
||||
documentation:
|
||||
needs: [prepare, build]
|
||||
name: Build and deploy development documentation
|
||||
uses: ./.github/workflows/task-docs.yml
|
||||
with:
|
||||
python-version: '3.11'
|
||||
node-version: '16.x'
|
||||
version-source: 'custom'
|
||||
custom-version: 'DEVELOPMENT SHA:${{ needs.prepare.outputs.short-sha }} TEST ONLY'
|
||||
base-path: '/dev/'
|
||||
destination-dir: 'dev'
|
||||
generate-webuploader: true
|
||||
webuploader-args: '--dev'
|
||||
run-pagespeed: true
|
||||
pagespeed-url: 'https://docs.openmqttgateway.com/dev/'
|
||||
secrets:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
APIKEY: ${{ secrets.APIKEY }}
|
||||
@@ -0,0 +1,106 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft-07/schema",
|
||||
"description": "Centralized list of all PlatformIO build environments for OpenMQTTGateway workflows",
|
||||
"version": "1.0.0",
|
||||
"lastUpdated": "2025-12-24",
|
||||
"environments": {
|
||||
"all": [
|
||||
"rfbridge",
|
||||
"rfbridge-direct",
|
||||
"theengs-bridge",
|
||||
"theengs-bridge-v11",
|
||||
"theengs-plug",
|
||||
"esp32dev-all-test",
|
||||
"esp32dev-rf",
|
||||
"esp32dev-pilight",
|
||||
"esp32dev-pilight-cc1101",
|
||||
"esp32dev-somfy-cc1101",
|
||||
"esp32dev-pilight-somfy-cc1101",
|
||||
"esp32dev-weatherstation",
|
||||
"esp32dev-gf-sun-inverter",
|
||||
"esp32dev-ir",
|
||||
"esp32dev-ble",
|
||||
"esp32dev-ble-broker",
|
||||
"esp32dev-ble-mqtt-undecoded",
|
||||
"esp32dev-ble-aws",
|
||||
"esp32dev-ble-datatest",
|
||||
"esp32dev-ble-idf",
|
||||
"esp32dev-rtl_433",
|
||||
"esp32dev-rtl_433-fsk",
|
||||
"esp32dev-multi_receiver",
|
||||
"esp32dev-multi_receiver-pilight",
|
||||
"esp32feather-ble",
|
||||
"esp32-lolin32lite-ble",
|
||||
"esp32-olimex-gtw-ble-eth",
|
||||
"esp32-olimex-gtw-ble-poe",
|
||||
"esp32-olimex-gtw-ble-poe-iso",
|
||||
"esp32-wt32-eth01-ble-eth",
|
||||
"esp32-olimex-gtw-ble-wifi",
|
||||
"esp32-m5stick-ble",
|
||||
"esp32-m5stack-ble",
|
||||
"esp32-m5tough-ble",
|
||||
"esp32-m5stick-c-ble",
|
||||
"esp32-m5stick-cp-ble",
|
||||
"esp32-m5atom-matrix",
|
||||
"esp32-m5atom-lite",
|
||||
"esp32doitv1-aithinker-r01-sx1278",
|
||||
"esp32s3-dev-c1-ble",
|
||||
"esp32s3-m5stack-stamps3",
|
||||
"esp32s3-atomS3U",
|
||||
"esp32c3-dev-m1-ble",
|
||||
"esp32c3-dev-c2-ble",
|
||||
"esp32c3-dev-c2-ble-no-serial",
|
||||
"esp32c3_lolin_mini",
|
||||
"esp32c3_lolin_mini_with_serial",
|
||||
"esp32c3-m5stamp",
|
||||
"esp32c3u-m5stamp",
|
||||
"airm2m_core_esp32c3",
|
||||
"heltec-rtl_433",
|
||||
"heltec-rtl_433-fsk",
|
||||
"heltec-ble",
|
||||
"heltec-wifi-lora-32",
|
||||
"lilygo-rtl_433",
|
||||
"lilygo-rtl_433-fsk",
|
||||
"lilygo-t3-s3-rtl_433",
|
||||
"lilygo-t3-s3-rtl_433-fsk",
|
||||
"lilygo-ble",
|
||||
"tinypico-ble",
|
||||
"ttgo-lora32-v1",
|
||||
"ttgo-lora32-v21",
|
||||
"ttgo-t-beam",
|
||||
"thingpulse-espgateway",
|
||||
"shelly-plus1",
|
||||
"nodemcuv2-all-test",
|
||||
"nodemcuv2-fastled-test",
|
||||
"nodemcuv2-2g",
|
||||
"nodemcuv2-ir",
|
||||
"nodemcuv2-serial",
|
||||
"nodemcuv2-rf",
|
||||
"nodemcuv2-rf-cc1101",
|
||||
"nodemcuv2-somfy-cc1101",
|
||||
"nodemcuv2-rf2",
|
||||
"nodemcuv2-rf2-cc1101",
|
||||
"nodemcuv2-pilight",
|
||||
"nodemcuv2-weatherstation",
|
||||
"avatto-bakeey-ir",
|
||||
"manual-wifi-test",
|
||||
"rf-wifi-gateway",
|
||||
"sonoff-basic",
|
||||
"sonoff-basic-rfr3"
|
||||
],
|
||||
"metadata": {
|
||||
"totalCount": 83,
|
||||
"categories": {
|
||||
"esp32": 42,
|
||||
"esp8266": 17,
|
||||
"specialized": 24
|
||||
},
|
||||
"notes": [
|
||||
"This unified list contains all environments from both build.yml and build_and_docs_to_dev.yml",
|
||||
"Previously build.yml had 85 environments and build_and_docs_to_dev.yml had 88",
|
||||
"After deduplication and proper ordering, the total is 83 unique environments",
|
||||
"Environments ending in -test or -all-test are typically excluded from production releases"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,9 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Check main format
|
||||
uses: DoozyX/clang-format-lint-action@v0.6
|
||||
with:
|
||||
source: "./main"
|
||||
extensions: "h,ino"
|
||||
clangFormatVersion: 9
|
||||
name: Lint code format
|
||||
uses: ./.github/workflows/task-lint.yml
|
||||
with:
|
||||
source: 'main'
|
||||
extensions: 'h,ino'
|
||||
clang-format-version: '9'
|
||||
@@ -1,45 +1,21 @@
|
||||
name: Create and publish documentation
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
documentation:
|
||||
runs-on: ubuntu-latest
|
||||
name: Create the documentation and deploy it to GitHub Pages
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "14.x"
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.11"
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install requests pandas markdown pytablereader tabulate
|
||||
npm install
|
||||
- name: Download Common Config
|
||||
run: |
|
||||
curl -o docs/.vuepress/public/commonConfig.js https://www.theengs.io/commonConfig.js
|
||||
- name: get lastest release tag
|
||||
id: last_release
|
||||
uses: InsonusK/get-latest-release@v1.0.1
|
||||
with:
|
||||
myToken: ${{ github.token }}
|
||||
view_top: 1
|
||||
- name: Set version tag from git
|
||||
run: sed -i "s/version_tag/${{steps.last_release.outputs.tag_name}}/g" docs/.vuepress/config.js scripts/latest_version.json
|
||||
- name: Build documentation
|
||||
run: |
|
||||
python ./scripts/generate_board_docs.py
|
||||
python ./scripts/gen_wu.py ${GITHUB_REPOSITORY}
|
||||
npm run docs:build
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./docs/.vuepress/dist
|
||||
cname: docs.openmqttgateway.com
|
||||
name: Build and deploy production documentation
|
||||
uses: ./.github/workflows/task-docs.yml
|
||||
with:
|
||||
python-version: '3.11'
|
||||
node-version: '14.x'
|
||||
version-source: 'release'
|
||||
base-path: '/'
|
||||
destination-dir: '.'
|
||||
generate-webuploader: true
|
||||
webuploader-args: '${GITHUB_REPOSITORY}'
|
||||
run-pagespeed: false
|
||||
secrets:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -5,47 +5,107 @@ on:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build-upload:
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
name: Build and upload Assets to Release
|
||||
outputs:
|
||||
version-tag: ${{ steps.extract-tag.outputs.version }}
|
||||
release-id: ${{ steps.extract-release.outputs.id }}
|
||||
upload-url: ${{ steps.extract-release.outputs.upload_url }}
|
||||
steps:
|
||||
- name: Extract version tag
|
||||
id: extract-tag
|
||||
run: |
|
||||
VERSION_TAG=${GITHUB_REF#refs/tags/}
|
||||
echo "version=${VERSION_TAG}" >> $GITHUB_OUTPUT
|
||||
echo "Extracted version: ${VERSION_TAG}"
|
||||
|
||||
- name: Extract release info
|
||||
id: extract-release
|
||||
run: |
|
||||
RELEASE_ID=$(jq --raw-output '.release.id' $GITHUB_EVENT_PATH)
|
||||
UPLOAD_URL="https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets{?name,label}"
|
||||
echo "id=${RELEASE_ID}" >> $GITHUB_OUTPUT
|
||||
echo "upload_url=${UPLOAD_URL}" >> $GITHUB_OUTPUT
|
||||
echo "Release ID: ${RELEASE_ID}"
|
||||
|
||||
build:
|
||||
needs: prepare
|
||||
name: Build release firmware
|
||||
uses: ./.github/workflows/task-build.yml
|
||||
with:
|
||||
python-version: '3.13'
|
||||
enable-dev-ota: false
|
||||
version-tag: ${{ needs.prepare.outputs.version-tag }}
|
||||
artifact-retention-days: 90
|
||||
artifact-name-prefix: 'firmware-'
|
||||
prepare-for-deploy: true
|
||||
|
||||
deploy:
|
||||
needs: [prepare, build]
|
||||
runs-on: ubuntu-latest
|
||||
name: Deploy release assets
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download all firmware artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: firmware-*
|
||||
path: .pio/build
|
||||
merge-multiple: false
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v6
|
||||
with:
|
||||
version: "latest"
|
||||
enable-cache: false
|
||||
|
||||
- name: Install platformio
|
||||
run: |
|
||||
uv pip install --system -U https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.18.zip
|
||||
- name: Set version tag from git
|
||||
run: sed -i "s/version_tag/${GITHUB_REF#refs/tags/}/g" main/User_config.h scripts/latest_version.json
|
||||
- name: Extract ESP32 platform version from platformio.ini
|
||||
|
||||
- name: Reorganize artifacts for prepare_deploy.sh
|
||||
run: |
|
||||
ESP32_VERSION=$(grep 'esp32_platform\s*=' platformio.ini | cut -d'@' -f2 | tr -d '[:space:]')
|
||||
echo "ESP32_PLATFORM_VERSION=${ESP32_VERSION}" >> $GITHUB_ENV
|
||||
- name: Run PlatformIO
|
||||
run: platformio run
|
||||
# Move artifacts from download structure to expected .pio/build structure
|
||||
for env_dir in .pio/build/firmware-*; do
|
||||
if [ -d "$env_dir" ]; then
|
||||
env_name=$(basename "$env_dir" | sed 's/^firmware-//')
|
||||
mkdir -p ".pio/build/${env_name}"
|
||||
mv "$env_dir"/*.bin ".pio/build/${env_name}/" 2>/dev/null || true
|
||||
rm -rf "$env_dir"
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Prepare Release Assets
|
||||
run: |
|
||||
sudo apt install rename
|
||||
./scripts/prepare_deploy.sh
|
||||
- name: Get upload url
|
||||
id: release-id
|
||||
run: |
|
||||
RELEASE_ID=$(jq --raw-output '.release.id' $GITHUB_EVENT_PATH)
|
||||
echo "::set-output name=upload_url::https://uploads.github.com/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets{?name,label}"
|
||||
|
||||
- name: Upload Release Assets
|
||||
uses: bgpat/release-asset-action@03b0c30db1c4031ce3474740b0e4275cd7e126a3
|
||||
with:
|
||||
pattern: "toDeploy/*"
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
release-url: ${{ steps.release-id.outputs.upload_url }}
|
||||
release-url: ${{ needs.prepare.outputs.upload-url }}
|
||||
allow-overwrite: true
|
||||
call-workflow-passing-data:
|
||||
needs: build-upload
|
||||
uses: ./.github/workflows/manual_docs.yml
|
||||
|
||||
documentation:
|
||||
needs: [prepare, deploy]
|
||||
name: Build and deploy release documentation
|
||||
uses: ./.github/workflows/task-docs.yml
|
||||
with:
|
||||
python-version: '3.11'
|
||||
node-version: '18.x'
|
||||
version-source: 'git-tag'
|
||||
base-path: '/'
|
||||
destination-dir: '.'
|
||||
generate-webuploader: true
|
||||
run-pagespeed: false
|
||||
secrets:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
APIKEY: ${{ secrets.APIKEY }}
|
||||
@@ -0,0 +1,104 @@
|
||||
name: Reusable Build Workflow
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
python-version:
|
||||
description: 'Python version to use'
|
||||
required: false
|
||||
type: string
|
||||
default: '3.13'
|
||||
enable-dev-ota:
|
||||
description: 'Enable development OTA builds'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
version-tag:
|
||||
description: 'Version tag to inject into firmware (e.g., SHA or release tag)'
|
||||
required: false
|
||||
type: string
|
||||
default: 'unspecified'
|
||||
artifact-retention-days:
|
||||
description: 'Number of days to retain build artifacts'
|
||||
required: false
|
||||
type: number
|
||||
default: 7
|
||||
artifact-name-prefix:
|
||||
description: 'Prefix for artifact names (e.g., "firmware-" for dev builds)'
|
||||
required: false
|
||||
type: string
|
||||
default: ''
|
||||
prepare-for-deploy:
|
||||
description: 'Prepare firmware files for deployment with specific naming'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
load-environments:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- id: set-matrix
|
||||
run: |
|
||||
ENVIRONMENTS=$(jq -c '.environments.all' .github/workflows/environments.json)
|
||||
echo "matrix=${ENVIRONMENTS}" >> $GITHUB_OUTPUT
|
||||
|
||||
build:
|
||||
needs: load-environments
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
environments: ${{ fromJson(needs.load-environments.outputs.matrix) }}
|
||||
name: Build ${{ matrix.environments }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v6
|
||||
with:
|
||||
version: "latest"
|
||||
enable-cache: false
|
||||
|
||||
- name: Install PlatformIO dependencies
|
||||
run: |
|
||||
uv pip install --system -U https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.18.zip
|
||||
|
||||
- name: Build firmware using ci.sh
|
||||
run: |
|
||||
BUILD_ARGS="${{ matrix.environments }}"
|
||||
|
||||
# Add version tag if specified
|
||||
if [ "${{ inputs.version-tag }}" != "unspecified" ]; then
|
||||
BUILD_ARGS="$BUILD_ARGS --version ${{ inputs.version-tag }}"
|
||||
fi
|
||||
|
||||
# Add mode flag (dev/prod)
|
||||
if [ "${{ inputs.enable-dev-ota }}" = "true" ]; then
|
||||
BUILD_ARGS="$BUILD_ARGS --mode dev"
|
||||
else
|
||||
BUILD_ARGS="$BUILD_ARGS --mode prod"
|
||||
fi
|
||||
|
||||
# Add deploy flag if needed
|
||||
if [ "${{ inputs.prepare-for-deploy }}" = "true" ]; then
|
||||
BUILD_ARGS="$BUILD_ARGS --deploy-ready"
|
||||
fi
|
||||
|
||||
# Execute build (uses default generated/artifacts/ directory)
|
||||
./scripts/ci.sh build $BUILD_ARGS
|
||||
|
||||
- name: Upload firmware artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ inputs.artifact-name-prefix }}${{ matrix.environments }}
|
||||
path: generated/artifacts/
|
||||
retention-days: ${{ inputs.artifact-retention-days }}
|
||||
@@ -0,0 +1,127 @@
|
||||
name: Reusable Documentation Workflow
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
python-version:
|
||||
description: 'Python version to use'
|
||||
required: false
|
||||
type: string
|
||||
default: '3.11'
|
||||
node-version:
|
||||
description: 'Node.js version to use'
|
||||
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'
|
||||
required: false
|
||||
type: boolean
|
||||
default: true
|
||||
webuploader-args:
|
||||
description: 'Additional arguments for gen_wu.py script'
|
||||
required: false
|
||||
type: string
|
||||
default: ''
|
||||
run-pagespeed:
|
||||
description: 'Run PageSpeed Insights after deployment'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
pagespeed-url:
|
||||
description: 'URL to test with PageSpeed Insights'
|
||||
required: false
|
||||
type: string
|
||||
default: 'https://docs.openmqttgateway.com/'
|
||||
secrets:
|
||||
GITHUB_TOKEN:
|
||||
required: true
|
||||
APIKEY:
|
||||
required: false
|
||||
|
||||
jobs:
|
||||
documentation:
|
||||
runs-on: ubuntu-latest
|
||||
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 }}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Build documentation site
|
||||
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"
|
||||
else
|
||||
ARGS="$ARGS --version-source release"
|
||||
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}"
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
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
|
||||
uses: jakepartusch/psi-action@v1.3
|
||||
id: psi
|
||||
with:
|
||||
url: ${{ inputs.pagespeed-url }}
|
||||
threshold: 60
|
||||
key: ${{ secrets.APIKEY }}
|
||||
@@ -0,0 +1,40 @@
|
||||
name: Reusable Lint Workflow
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
source:
|
||||
description: 'Source directory to lint (single directory)'
|
||||
required: false
|
||||
type: string
|
||||
default: 'main'
|
||||
extensions:
|
||||
description: 'File extensions to check (comma-separated)'
|
||||
required: false
|
||||
type: string
|
||||
default: 'h,ino,cpp'
|
||||
clang-format-version:
|
||||
description: 'clang-format version to use'
|
||||
required: false
|
||||
type: string
|
||||
default: '9'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
name: Check code format
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install clang-format
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y clang-format
|
||||
|
||||
- name: Check code format with ci.sh qa
|
||||
run: |
|
||||
./scripts/ci.sh qa \
|
||||
--check \
|
||||
--source "${{ inputs.source }}" \
|
||||
--extensions "${{ inputs.extensions }}" \
|
||||
--clang-format-version "${{ inputs.clang-format-version }}"
|
||||
Reference in new issue
Block a user