diff --git a/.github/workflows/build-dmc-companion-firmwares.yml b/.github/workflows/build-dmc-companion-firmwares.yml index 354ef1b96e2..feebcb9f65c 100644 --- a/.github/workflows/build-dmc-companion-firmwares.yml +++ b/.github/workflows/build-dmc-companion-firmwares.yml @@ -5,14 +5,11 @@ permissions: on: workflow_dispatch: - push: - tags: - - 'dmc-companion-*' jobs: build: # Build every companion board (usb + ble variants) via the shared matrix - # builder. Draft release on tag push. + # builder. Run by hand only. uses: ./.github/workflows/firmware-builder.yml with: firmware_type: 'companion' diff --git a/.github/workflows/build-dmc-repeater-firmwares.yml b/.github/workflows/build-dmc-repeater-firmwares.yml index 5f849e503e2..53d51bec125 100644 --- a/.github/workflows/build-dmc-repeater-firmwares.yml +++ b/.github/workflows/build-dmc-repeater-firmwares.yml @@ -5,17 +5,11 @@ permissions: on: workflow_dispatch: - push: - tags: - - 'dmc-repeater-*' - # Exclude the observer MQTT repeater tags (they have their own workflow). - # 'dmc-repeater-*' otherwise also matches 'dmc-repeater-mqtt-*'. - - '!dmc-repeater-mqtt-*' jobs: build: # Build every repeater board via the shared matrix builder (was a temporary - # curated subset; DMC now ships the full set). Draft release on tag push. + # curated subset; DMC now ships the full set). Run by hand only. uses: ./.github/workflows/firmware-builder.yml with: firmware_type: 'repeater' diff --git a/.github/workflows/build-dmc-room-server-firmwares.yml b/.github/workflows/build-dmc-room-server-firmwares.yml index fb5cbb3f8e4..70a60f8d121 100644 --- a/.github/workflows/build-dmc-room-server-firmwares.yml +++ b/.github/workflows/build-dmc-room-server-firmwares.yml @@ -5,18 +5,11 @@ permissions: on: workflow_dispatch: - push: - tags: - - 'dmc-room-server-*' - # Exclude the observer MQTT room-server tags (they have their own - # workflow). 'dmc-room-server-*' otherwise also matches - # 'dmc-room-server-mqtt-*'. - - '!dmc-room-server-mqtt-*' jobs: build: - # Build every room-server board via the shared matrix builder. Draft - # release on tag push. + # Build every room-server board via the shared matrix builder. Run + # by hand only. uses: ./.github/workflows/firmware-builder.yml with: firmware_type: 'room-server' diff --git a/.github/workflows/build-observer-firmwares.yml b/.github/workflows/build-observer-firmwares.yml index 36dea47dd22..69722e8c1cd 100644 --- a/.github/workflows/build-observer-firmwares.yml +++ b/.github/workflows/build-observer-firmwares.yml @@ -5,17 +5,9 @@ permissions: on: workflow_dispatch: - push: - tags: - # Trigger only — the embedded version comes from FIRMWARE_VERSION below, - # NOT from the tag. Push e.g. `observer-mqtt-v1.17.0` to kick a rolling - # build from this branch (the Run-workflow button lives on the default - # branch; a tag push works regardless of which branch the file is on). - - 'observer-mqtt-*' env: - # Version embedded in firmware filenames; must match the version key in the - # flasher's config.json. Bump here when the observer version changes. + # Version embedded in firmware filenames. Bump here when the observer version changes. FIRMWARE_VERSION: v1.17.0 # Rolling release tag that hosts the latest observer binaries. RELEASE_TAG: observer-mqtt-latest @@ -90,8 +82,7 @@ jobs: path: out if-no-files-found: error - # Collect all shard outputs, publish the rolling release, then point the - # flasher at the new build by bumping the hash + notes in its config.json. + # Collect all shard outputs and publish the rolling release in this repository. release: needs: build runs-on: ubuntu-latest @@ -110,10 +101,6 @@ jobs: find artifacts -type f -name '*.bin' -exec cp -f {} out/ \; echo "Collected binaries:"; ls -1 out - - name: Compute Short SHA - id: sha - run: echo "short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" - - name: Publish to Rolling Release (tag pinned; assets replaced in place) env: GH_TOKEN: ${{ github.token }} @@ -136,42 +123,3 @@ jobs: | while read -r asset; do grep -qxF "$asset" <<<"$keep" || gh release delete-asset "$RELEASE_TAG" "$asset" --yes || true done - - - name: Checkout Flasher Repo - uses: actions/checkout@v4 - with: - repository: agessaman/flasher.meshcore.io - token: ${{ secrets.FLASHER_DISPATCH_TOKEN }} - path: flasher - - - name: Update Flasher Config - run: | - python3 flasher/scripts/update-firmware.py \ - "${{ steps.sha.outputs.short }}" \ - "$GITHUB_WORKSPACE/firmware-notes.html" - - - name: Sync Docs into Flasher - run: | - # docs.html on the flasher site serves these raw .md files and renders - # them client-side; keep this list in sync with LOCAL_DOCS in - # flasher/docs.html. - for f in MQTT_IMPLEMENTATION.md MQTT_SNMP.md ALERTS.md; do - if [ -f "$f" ]; then - cp -f "$f" "flasher/$f" - echo "synced $f" - else - echo "WARNING: source doc $f not found" >&2 - fi - done - - - name: Commit & Push Flasher Config - working-directory: flasher - run: | - if git diff --quiet; then - echo "No flasher changes to commit." - exit 0 - fi - git config user.name "meshcore-bot" - git config user.email "noreply@gessaman.com" - git commit -am "Update observer firmware to ${{ steps.sha.outputs.short }}" - git push diff --git a/.github/workflows/build-repeater-mqtt-firmwares.yml b/.github/workflows/build-repeater-mqtt-firmwares.yml index 6157acd5222..1a42c1c5aea 100644 --- a/.github/workflows/build-repeater-mqtt-firmwares.yml +++ b/.github/workflows/build-repeater-mqtt-firmwares.yml @@ -10,9 +10,6 @@ on: description: 'Firmware version, e.g. v1.16.0 (used as FIRMWARE_VERSION and release name)' required: true type: string - push: - tags: - - 'dmc-repeater-mqtt-*' jobs: diff --git a/.github/workflows/build-roomserver-mqtt-firmwares.yml b/.github/workflows/build-roomserver-mqtt-firmwares.yml index 0a463bcf281..68767b1e3fc 100644 --- a/.github/workflows/build-roomserver-mqtt-firmwares.yml +++ b/.github/workflows/build-roomserver-mqtt-firmwares.yml @@ -10,9 +10,6 @@ on: description: 'Firmware version, e.g. v1.16.0 (used as FIRMWARE_VERSION and release name)' required: true type: string - push: - tags: - - 'dmc-room-server-mqtt-*' jobs: diff --git a/.github/workflows/dmc-firmware-release.yml b/.github/workflows/dmc-firmware-release.yml index 6fd24100a29..a6770f85223 100644 --- a/.github/workflows/dmc-firmware-release.yml +++ b/.github/workflows/dmc-firmware-release.yml @@ -28,11 +28,17 @@ name: DMC Firmware Release # channel=release creates a DRAFT prerelease dmc-- on the built commit. # Review it on GitHub and publish it by hand. Refuses an existing tag. # -# One runner per board. A board that fails to build is listed in the run summary and -# left out of the release; the rest still publish. - +# Boards are built in batches of up to 12 that share a runner and one toolchain restore, +# and only one release run is active at a time; further runs wait in line. This keeps the +# number of jobs and cache downloads low: Actions was switched off for this repository +# after days with one runner per board (532 jobs on 2026-10-19, 1055 on 2026-11-23). +# A board that fails to build is listed in the run summary and left out of the release; +# the rest still publish. + +# Only the jobs that talk to the Releases API (guard, publish) get write access. The jobs +# that run repository code or third-party libraries do not. permissions: - contents: write + contents: read on: workflow_dispatch: @@ -68,8 +74,11 @@ on: required: false concurrency: - group: dmc-firmware-release-${{ inputs.firmware }}-${{ inputs.channel }} + # One group for every firmware set. queue: max keeps all waiting runs; the default + # would cancel the waiting run whenever another one is started. + group: dmc-firmware-release cancel-in-progress: false + queue: max jobs: @@ -141,19 +150,6 @@ jobs: echo "fw_version=$FW_VERSION"; echo "dmc_channel=$DMC_CHANNEL"; echo "variant_tag=$VARIANT_TAG" } >> "$GITHUB_OUTPUT" - - name: Refuse an existing release tag - if: inputs.channel == 'release' - env: - GH_TOKEN: ${{ github.token }} - TAG: ${{ steps.cfg.outputs.tag }} - run: | - set -euo pipefail - # Drafts have no git tag yet, so check the release list as well as the tags. - hit=$(gh api "repos/$GITHUB_REPOSITORY/releases" --paginate -q ".[] | select(.tag_name == \"$TAG\") | .html_url") - if [ -n "$hit" ] || gh api "repos/$GITHUB_REPOSITORY/git/ref/tags/$TAG" >/dev/null 2>&1; then - echo "::error::release or tag '$TAG' already exists ${hit}"; exit 1 - fi - - name: Clone Repo uses: actions/checkout@v6 with: @@ -205,26 +201,60 @@ jobs: rows.sort(key=lambda r: r["env"].lower()) if not rows: sys.exit("no envs match " + os.environ["PATTERN"]) - if len(rows) > 256: - sys.exit(f"{len(rows)} envs exceeds the 256-job matrix limit") groups = {} for r in rows: groups.setdefault(r["toolchain"], []).append(r["env"]) toolchains = [{"toolchain": k, "envs": " ".join(v)} for k, v in sorted(groups.items())] + # Split each toolchain's envs into even batches of at most BATCH, so a batch + # needs a single toolchain restore. + BATCH = 12 + batches = [] + for k, v in sorted(groups.items()): + n = -(-len(v) // BATCH) + for i in range(n): + part = v[len(v) * i // n : len(v) * (i + 1) // n] + batches.append({"batch": len(batches) + 1, "toolchain": k, "envs": " ".join(part)}) + if len(batches) > 256: + sys.exit(f"{len(batches)} batches exceeds the 256-job matrix limit") with open(os.environ["GITHUB_OUTPUT"], "a") as out: - out.write("matrix=" + json.dumps(rows, separators=(",", ":")) + "\n") + out.write("matrix=" + json.dumps(batches, separators=(",", ":")) + "\n") out.write("envs=" + json.dumps([r["env"] for r in rows], separators=(",", ":")) + "\n") out.write("toolchains=" + json.dumps(toolchains, separators=(",", ":")) + "\n") - print(f"{len(rows)} envs:") + print(f"{len(rows)} envs in {len(batches)} batches:") print("\n".join(r["env"] for r in rows)) PY + # Drafts are only listed for a token with write access, so this check cannot live in + # plan. It runs no repository code. + guard: + needs: plan + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Nothing to check on the dev channel + if: inputs.channel != 'release' + run: echo "rolling release, replaced in place" + + - name: Refuse an existing release tag + if: inputs.channel == 'release' + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ needs.plan.outputs.tag }} + run: | + set -euo pipefail + # Drafts have no git tag yet, so check the release list as well as the tags. + hit=$(gh api "repos/$GITHUB_REPOSITORY/releases" --paginate -q ".[] | select(.tag_name == \"$TAG\") | .html_url") + if [ -n "$hit" ] || gh api "repos/$GITHUB_REPOSITORY/git/ref/tags/$TAG" >/dev/null 2>&1; then + echo "::error::release or tag '$TAG' already exists ${hit}"; exit 1 + fi + # One job per platform/packages combination fills the toolchain cache with the # packages of EVERY env on it (an ESP32 and an ESP32-S3 board share the platform - # but need different compilers), so the per-board jobs only ever restore it. + # but need different compilers), so the build jobs only ever restore it. toolchains: name: toolchain ${{ matrix.toolchain }} - needs: plan + needs: [plan, guard] runs-on: ubuntu-latest strategy: fail-fast: false @@ -236,8 +266,20 @@ jobs: with: ref: ${{ needs.plan.outputs.sha }} - - name: Cache PlatformIO toolchains + # Look only, so an up-to-date cache is not downloaded just to find that out. + - name: Look up the toolchain cache id: cache + uses: actions/cache/restore@v5 + with: + lookup-only: true + path: | + ~/.platformio/packages + ~/.platformio/platforms + ~/.platformio/.cache + key: pio-toolchain-${{ runner.os }}-${{ matrix.toolchain }}-${{ hashFiles('platformio.ini', 'variants/*/platformio.ini') }} + + - name: Cache PlatformIO toolchains + if: steps.cache.outputs.cache-hit != 'true' uses: actions/cache@v5 with: path: | @@ -266,10 +308,10 @@ jobs: pio pkg install "${args[@]}" build: - name: ${{ matrix.env }} + name: batch ${{ matrix.batch }} needs: [plan, toolchains] runs-on: ubuntu-latest - timeout-minutes: 60 + timeout-minutes: 180 strategy: fail-fast: false matrix: @@ -303,39 +345,74 @@ jobs: restore-keys: | pio-toolchain-${{ runner.os }}-${{ matrix.toolchain }}- - # Per-env library downloads. Compiled objects are not cached: build.sh injects a - # changing FIRMWARE_VERSION/BUILD_DATE that invalidates every object anyway. - - name: Cache env libraries + # Library downloads for this batch's envs. Compiled objects are not cached: build.sh + # injects a changing FIRMWARE_VERSION/BUILD_DATE that invalidates every object anyway. + - name: Cache batch libraries uses: actions/cache@v5 with: - path: .pio/libdeps/${{ matrix.env }} - key: pio-libdeps-${{ runner.os }}-${{ matrix.env }}-${{ hashFiles('platformio.ini', 'variants/*/platformio.ini') }} + path: .pio/libdeps + key: pio-libdeps-${{ runner.os }}-${{ inputs.firmware }}-${{ matrix.batch }}-${{ hashFiles('platformio.ini', 'variants/*/platformio.ini') }} restore-keys: | - pio-libdeps-${{ runner.os }}-${{ matrix.env }}- + pio-libdeps-${{ runner.os }}-${{ inputs.firmware }}-${{ matrix.batch }}- - name: Install PlatformIO run: pip install --upgrade platformio - - name: Build ${{ matrix.env }} + # Boards are built one by one: build.sh empties out/ on every call, and a board + # that fails must not take the rest of the batch down with it. Failures are + # reported in the last step, after the upload. + - name: Build boards + id: boards env: FIRMWARE_VERSION: ${{ needs.plan.outputs.fw_version }} DMC_CHANNEL: ${{ needs.plan.outputs.dmc_channel }} - ENV_NAME: ${{ matrix.env }} - run: /usr/bin/env bash build.sh build-firmware "$ENV_NAME" + ENVS: ${{ matrix.envs }} + run: | + failed="" + mkdir -p collected + for env in $ENVS; do + echo "::group::$env" + rc=0 + timeout 30m /usr/bin/env bash build.sh build-firmware "$env" || rc=$? + echo "::endgroup::" + if [ "$rc" -eq 0 ] && [ -n "$(ls -A out 2>/dev/null)" ]; then + mkdir -p "collected/$env" + cp -p out/* "collected/$env/" + echo "$env: ok" + else + failed="$failed $env" + echo "::error title=$env::build failed (exit $rc)" + fi + rm -rf .pio/build + done + echo "failed=${failed# }" >> "$GITHUB_OUTPUT" - name: Upload firmware + if: always() uses: actions/upload-artifact@v7 with: - name: fw-${{ matrix.env }} - path: out - if-no-files-found: error + name: fw-batch-${{ matrix.batch }} + path: collected + if-no-files-found: warn + overwrite: true retention-days: 7 + - name: Fail if a board failed + if: steps.boards.outputs.failed != '' + env: + FAILED: ${{ steps.boards.outputs.failed }} + run: | + echo "::error::failed boards: $FAILED" + exit 1 + publish: - needs: [plan, build] - # Publish whatever built; a single failing board must not block the release. - if: always() && needs.plan.result == 'success' + needs: [plan, guard, build] + # Publish whatever built; a single failing board must not block the release. A run + # that was cancelled by hand publishes nothing. + if: ${{ !cancelled() && needs.plan.result == 'success' && needs.guard.result == 'success' }} runs-on: ubuntu-latest + permissions: + contents: write env: GH_TOKEN: ${{ github.token }} CHANNEL: ${{ inputs.channel }} @@ -353,8 +430,9 @@ jobs: - name: Download firmware uses: actions/download-artifact@v8 with: - pattern: fw-* + pattern: fw-batch-* path: artifacts + merge-multiple: true - name: Collect assets and missing boards id: collect @@ -366,7 +444,7 @@ jobs: envs = json.loads(os.environ["ENVS"]) built, missing = [], [] for env in envs: - d = pathlib.Path("artifacts") / f"fw-{env}" + d = pathlib.Path("artifacts") / env files = [p for p in d.glob("*") if p.is_file()] if d.is_dir() else [] (built if files else missing).append(env) for p in files: diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml deleted file mode 100644 index b01ddc939cd..00000000000 --- a/.github/workflows/github-pages.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Build and deploy Docs site to GitHub Pages - -on: - workflow_dispatch: - push: - branches: - - main - -permissions: - contents: write - -jobs: - github-pages: - runs-on: ubuntu-latest - steps: - - - name: Checkout Repo - uses: actions/checkout@v6 - - - name: Setup Python - uses: actions/setup-python@v6 - with: - python-version: '3.13' - - - name: Build - run: | - pip install mkdocs-material - mkdocs build - - - name: Deploy to GitHub Pages - uses: peaceiris/actions-gh-pages@v4.1.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - cname: docs.meshcore.io - publish_dir: ./site - publish_branch: 'gh-pages' diff --git a/.github/workflows/stale-bot.yml b/.github/workflows/stale-bot.yml deleted file mode 100644 index ec166587563..00000000000 --- a/.github/workflows/stale-bot.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: 'Run Stale Bot' -on: - schedule: - - cron: '30 1 * * *' # daily at 1:30am - workflow_dispatch: {} - -permissions: - actions: write - issues: write - pull-requests: write - -jobs: - close-issues: - # only run on main repo, not forks - if: github.repository == 'meshcore-dev/MeshCore' - runs-on: ubuntu-latest - steps: - - name: Close Stale Issues - uses: actions/stale@v10 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - # auto close issues - days-before-issue-stale: 60 - days-before-issue-close: 7 - exempt-issue-labels: "keep-open" - stale-issue-label: "stale" - stale-issue-message: "This issue is stale because it has been open for 60 days with no activity. Remove the stale label or add a comment if this issue is still relevant, otherwise this issue will automatically close in 7 days." - close-issue-message: "This issue was closed because it has been inactive for 7 days since being marked as stale." - # don't auto close prs - days-before-pr-stale: -1 - days-before-pr-close: -1 - \ No newline at end of file