Skip to content

Commit 36c5f0a

Browse files
committed
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.
1 parent ee00e49 commit 36c5f0a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+5485
-1295
lines changed

.github/workflows/README.md

Lines changed: 367 additions & 250 deletions
Large diffs are not rendered by default.

.github/workflows/build.yml

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,65 @@
11
name: Build
2+
# See details in .github/workflows/README.md (workflow docs)
3+
run-name: "CI build for ${{ github.ref_name }}"
24

35
on: [push, pull_request]
46

57
jobs:
8+
determine-build-scope:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
environment-set: ${{ steps.decide.outputs.environment-set }}
12+
steps:
13+
- name: Decide environment set
14+
id: decide
15+
run: |
16+
# Full build for: development, master, edge, stable, release/*, hotfix/*, and all PRs
17+
if [[ "${{ github.event_name }}" == "pull_request" ]] || \
18+
[[ "${{ github.ref }}" == "refs/heads/development" ]] || \
19+
[[ "${{ github.ref }}" == "refs/heads/master" ]] || \
20+
[[ "${{ github.ref }}" == "refs/heads/edge" ]] || \
21+
[[ "${{ github.ref }}" == "refs/heads/stable" ]] || \
22+
[[ "${{ github.ref }}" == refs/heads/release/* ]] || \
23+
[[ "${{ github.ref }}" == refs/heads/hotfix/* ]]; then
24+
echo "environment-set=all" >> $GITHUB_OUTPUT
25+
else
26+
echo "environment-set=ci" >> $GITHUB_OUTPUT
27+
fi
28+
29+
630
build:
31+
needs: determine-build-scope
732
name: Build firmware
833
uses: ./.github/workflows/task-build.yml
934
with:
10-
python-version: '3.13'
11-
enable-dev-ota: false
35+
enable-dev-ota: true
1236
artifact-retention-days: 7
13-
prepare-for-deploy: false
37+
environment-set: ${{ needs.determine-build-scope.outputs.environment-set }}
1438

1539
documentation:
40+
needs: build
1641
name: Build documentation
1742
runs-on: ubuntu-latest
1843
steps:
1944
- uses: actions/checkout@v4
45+
46+
- name: Download all firmware artifacts
47+
uses: actions/download-artifact@v4
48+
with:
49+
pattern: "*"
50+
path: generated/artifacts
51+
merge-multiple: true
52+
2053
- name: Set up Node.js
2154
uses: actions/setup-node@v4
2255
with:
2356
node-version: "14.x"
24-
- name: Download Common Config
25-
run: |
26-
curl -o docs/.vuepress/public/commonConfig.js https://www.theengs.io/commonConfig.js
27-
- name: Install build dependencies
57+
58+
- name: Install docs dependencies
2859
run: npm install
29-
- name: Build documentation
30-
run: npm run docs:build
60+
61+
- name: Build documentation with ci_site.sh
62+
63+
run: |
64+
# Quick build check (dev mode) not used task-docs.yml because is not required the upload of artefacts
65+
./scripts/ci.sh site --mode dev

.github/workflows/build_and_docs_to_dev.yml

Lines changed: 17 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build binaries, docs and publish to dev folder
33
on:
44
workflow_dispatch:
55
schedule:
6-
- cron: '0 0 * * *'
6+
- cron: "0 0 * * *"
77

88
jobs:
99
prepare:
@@ -18,86 +18,33 @@ jobs:
1818
with:
1919
length: 6
2020

21-
build:
21+
handle-firmwares:
2222
needs: prepare
23-
name: Build development firmware
23+
name: Build and deploy development firmwares artefacts
2424
uses: ./.github/workflows/task-build.yml
2525
with:
26-
python-version: '3.13'
2726
enable-dev-ota: true
2827
version-tag: ${{ needs.prepare.outputs.short-sha }}
2928
artifact-retention-days: 1
30-
artifact-name-prefix: 'firmware-'
31-
prepare-for-deploy: true
3229

33-
deploy:
34-
needs: [prepare, build]
30+
handle-documentation:
31+
needs: [prepare, handle-firmwares]
3532
runs-on: ubuntu-latest
36-
if: github.repository_owner == '1technophile'
37-
name: Deploy binaries and docs
3833
steps:
39-
- uses: actions/checkout@v4
40-
4134
- name: Download all firmware artifacts
4235
uses: actions/download-artifact@v4
4336
with:
44-
pattern: firmware-*
45-
path: toDeploy
37+
pattern: "*"
38+
path: generated/artifacts
4639
merge-multiple: true
47-
48-
- name: Set up Python
49-
uses: actions/setup-python@v5
50-
with:
51-
python-version: "3.13"
52-
53-
- name: Install uv
54-
uses: astral-sh/setup-uv@v6
40+
- name: Build and deploy development documentation
41+
uses: ./.github/workflows/task-docs.yml
5542
with:
56-
version: "latest"
57-
enable-cache: false
58-
59-
- name: Install dependencies
60-
run: |
61-
uv pip install --system -U https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.18.zip
62-
63-
- name: Create library zips
64-
run: |
65-
# Install libraries for a representative environment to get libdeps
66-
platformio pkg install -e esp32dev-ble --no-save
67-
cd .pio/libdeps
68-
# Replace spaces with underscores in folder names
69-
find . -type d -name "* *" | while read FNAME; do mv "$FNAME" "${FNAME// /_}"; done
70-
# Zip libraries per board
71-
for i in */; do
72-
zip -r "${i%/}-libraries.zip" "$i"
73-
done
74-
mv *.zip ../../toDeploy/
75-
76-
- name: Prepare additional assets
77-
run: |
78-
cd toDeploy
79-
# Remove binaries for *-all*, *-test* env
80-
rm -f *-all*.bin *-test*.bin *-test*.zip || true
81-
cd ..
82-
# Zip source code
83-
zip -r toDeploy/OpenMQTTGateway_sources.zip main LICENSE.txt
84-
ls -lA toDeploy/
85-
86-
documentation:
87-
needs: [prepare, build]
88-
name: Build and deploy development documentation
89-
uses: ./.github/workflows/task-docs.yml
90-
with:
91-
python-version: '3.11'
92-
node-version: '16.x'
93-
version-source: 'custom'
94-
custom-version: 'DEVELOPMENT SHA:${{ needs.prepare.outputs.short-sha }} TEST ONLY'
95-
base-path: '/dev/'
96-
destination-dir: 'dev'
97-
generate-webuploader: true
98-
webuploader-args: '--dev'
99-
run-pagespeed: true
100-
pagespeed-url: 'https://docs.openmqttgateway.com/dev/'
101-
secrets:
102-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103-
APIKEY: ${{ secrets.APIKEY }}
43+
mode: "dev"
44+
version: ${{ needs.prepare.outputs.short-sha }}
45+
url-prefix: "/dev/"
46+
destination-dir: "dev"
47+
github-token: ${{ secrets.GITHUB_TOKEN }}
48+
run-pagespeed: true
49+
pagespeed-url: 'https://docs.openmqttgateway.com/dev/'
50+
pagespeed-url-apikey: ${{ secrets.APIKEY }}

.github/workflows/environments.json

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,22 @@
8888
"sonoff-basic",
8989
"sonoff-basic-rfr3"
9090
],
91-
"metadata": {
92-
"totalCount": 83,
93-
"categories": {
94-
"esp32": 42,
95-
"esp8266": 17,
96-
"specialized": 24
97-
},
98-
"notes": [
99-
"This unified list contains all environments from both build.yml and build_and_docs_to_dev.yml",
100-
"Previously build.yml had 85 environments and build_and_docs_to_dev.yml had 88",
101-
"After deduplication and proper ordering, the total is 83 unique environments",
102-
"Environments ending in -test or -all-test are typically excluded from production releases"
103-
]
104-
}
91+
"ci": [
92+
"esp32dev-all-test",
93+
"esp32dev-ble",
94+
"esp32dev-ir",
95+
"esp32dev-rf",
96+
"esp32dev-rtl_433",
97+
"esp32s3-dev-c1-ble",
98+
"esp32c3-dev-m1-ble",
99+
"heltec-ble",
100+
"lilygo-ble",
101+
"nodemcuv2-all-test",
102+
"nodemcuv2-ir",
103+
"nodemcuv2-rf",
104+
"theengs-bridge",
105+
"theengs-plug",
106+
"rfbridge"
107+
]
105108
}
106109
}

.github/workflows/lint.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/manual_docs.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,9 @@ jobs:
99
name: Build and deploy production documentation
1010
uses: ./.github/workflows/task-docs.yml
1111
with:
12-
python-version: '3.11'
13-
node-version: '14.x'
14-
version-source: 'release'
15-
base-path: '/'
16-
destination-dir: '.'
17-
generate-webuploader: true
18-
webuploader-args: '${GITHUB_REPOSITORY}'
19-
run-pagespeed: false
12+
mode: "prod"
13+
version: "auto" # Will detect latest git tag
14+
url-prefix: "/"
15+
destination-dir: "."
2016
secrets:
21-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 19 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
VERSION_TAG=${GITHUB_REF#refs/tags/}
1919
echo "version=${VERSION_TAG}" >> $GITHUB_OUTPUT
2020
echo "Extracted version: ${VERSION_TAG}"
21-
21+
2222
- name: Extract release info
2323
id: extract-release
2424
run: |
@@ -33,79 +33,43 @@ jobs:
3333
name: Build release firmware
3434
uses: ./.github/workflows/task-build.yml
3535
with:
36-
python-version: '3.13'
3736
enable-dev-ota: false
3837
version-tag: ${{ needs.prepare.outputs.version-tag }}
3938
artifact-retention-days: 90
40-
artifact-name-prefix: 'firmware-'
41-
prepare-for-deploy: true
4239

4340
deploy:
4441
needs: [prepare, build]
4542
runs-on: ubuntu-latest
4643
name: Deploy release assets
4744
steps:
48-
- uses: actions/checkout@v4
49-
5045
- name: Download all firmware artifacts
5146
uses: actions/download-artifact@v4
5247
with:
53-
pattern: firmware-*
54-
path: .pio/build
55-
merge-multiple: false
56-
57-
- name: Set up Python
58-
uses: actions/setup-python@v5
59-
with:
60-
python-version: "3.13"
61-
62-
- name: Install uv
63-
uses: astral-sh/setup-uv@v6
64-
with:
65-
version: "latest"
66-
enable-cache: false
67-
68-
- name: Install platformio
69-
run: |
70-
uv pip install --system -U https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.18.zip
71-
72-
- name: Reorganize artifacts for prepare_deploy.sh
73-
run: |
74-
# Move artifacts from download structure to expected .pio/build structure
75-
for env_dir in .pio/build/firmware-*; do
76-
if [ -d "$env_dir" ]; then
77-
env_name=$(basename "$env_dir" | sed 's/^firmware-//')
78-
mkdir -p ".pio/build/${env_name}"
79-
mv "$env_dir"/*.bin ".pio/build/${env_name}/" 2>/dev/null || true
80-
rm -rf "$env_dir"
81-
fi
82-
done
83-
84-
- name: Prepare Release Assets
85-
run: |
86-
sudo apt install rename
87-
./scripts/prepare_deploy.sh
48+
pattern: "*"
49+
path: generated/artifacts
50+
merge-multiple: true
8851

8952
- name: Upload Release Assets
9053
uses: bgpat/release-asset-action@03b0c30db1c4031ce3474740b0e4275cd7e126a3
9154
with:
92-
pattern: "toDeploy/*"
55+
pattern: "generated/artifacts/*"
9356
github-token: ${{ secrets.GITHUB_TOKEN }}
9457
release-url: ${{ needs.prepare.outputs.upload-url }}
9558
allow-overwrite: true
9659

9760
documentation:
9861
needs: [prepare, deploy]
99-
name: Build and deploy release documentation
100-
uses: ./.github/workflows/task-docs.yml
101-
with:
102-
python-version: '3.11'
103-
node-version: '18.x'
104-
version-source: 'git-tag'
105-
base-path: '/'
106-
destination-dir: '.'
107-
generate-webuploader: true
108-
run-pagespeed: false
109-
secrets:
110-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111-
APIKEY: ${{ secrets.APIKEY }}
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Download all firmware artifacts
65+
uses: actions/download-artifact@v4
66+
with:
67+
pattern: "*"
68+
- name: Build and deploy release documentation
69+
uses: ./.github/workflows/task-docs.yml
70+
with:
71+
mode: "prod"
72+
version: ${{ needs.prepare.outputs.version-tag }}
73+
url-prefix: "/"
74+
destination-dir: "."
75+
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)