mirror of
https://github.com/1technophile/OpenMQTTGateway.git
synced 2026-02-20 00:32:04 +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.
104 lines
3.0 KiB
YAML
104 lines
3.0 KiB
YAML
name: Build binaries, docs and publish to dev folder
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: '0 0 * * *'
|
|
|
|
jobs:
|
|
prepare:
|
|
runs-on: ubuntu-latest
|
|
if: github.repository_owner == '1technophile'
|
|
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
|
|
|
|
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: [prepare, build]
|
|
runs-on: ubuntu-latest
|
|
if: github.repository_owner == '1technophile'
|
|
name: Deploy binaries and docs
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- 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
|
|
platformio pkg install -e esp32dev-ble --no-save
|
|
cd .pio/libdeps
|
|
# Replace spaces with underscores in folder names
|
|
find . -type d -name "* *" | while read FNAME; do mv "$FNAME" "${FNAME// /_}"; done
|
|
# Zip libraries per board
|
|
for i in */; do
|
|
zip -r "${i%/}-libraries.zip" "$i"
|
|
done
|
|
mv *.zip ../../toDeploy/
|
|
|
|
- name: Prepare additional assets
|
|
run: |
|
|
cd toDeploy
|
|
# Remove binaries for *-all*, *-test* env
|
|
rm -f *-all*.bin *-test*.bin *-test*.zip || true
|
|
cd ..
|
|
# Zip source code
|
|
zip -r toDeploy/OpenMQTTGateway_sources.zip main LICENSE.txt
|
|
ls -lA toDeploy/
|
|
|
|
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 }}
|