Commit Graph
2 Commits
Author SHA1 Message Date
da13271f94 ci: mirror firmware's size-report sidecar (OpenIPC/firmware#2166) (#102)
Firmware PR #2166 added a `size-report` Makefile target + the
`general/scripts/size_report.py` analyser that emits a per-package /
per-kernel-module `sizes.<soc>-<variant>.json` next to the .tgz. Builder
clones firmware fresh on every run and shells to `make BOARD=...`, so the
script + target are already available downstream — this PR adds the CI wiring
and manifest extension so the JSON ships as a release asset and surfaces
through https://openipc.github.io/builder/manifest.json.

Three changes:

* `builder.sh`: best-effort `make size-report` after the main build, and
  copy `sizes.*.json` into the timestamped archive next to `.tgz` /
  `rootfs.squashfs.*`. Failure is swallowed so a legacy `OPENIPC_FW_REV` pin
  to a pre-#2166 firmware ref can't sink the build.

* `.github/workflows/master.yml`: new `Build size report` step after the
  existing `Build firmware`. Mirrors the bimodal rename trick the .tgz path
  already does — compound matrix entries (`<soc>_<variant>_<vendor>-<model>`)
  share `<soc>_<variant>` and would otherwise collide on the firmware-side
  `sizes.<soc>-<variant>.json` filename when uploaded to the same release
  tag. Compound entries get the JSON renamed to `sizes.<NAME>.json`; simple
  entries keep `sizes.<soc>-<variant>.json`. `${{env.SIZES}}` is added to
  all three upload `files:` blocks (dated / nightly / latest).

* `.github/scripts/enrich_manifest.py`: `SIZES_COMPOUND_RE` +
  `SIZES_SIMPLE_RE`, a `parse_sizes()` helper that tries compound first
  (because `[^._-]+` in the simple soc class would otherwise accept the
  compound form too), the sidecar is recorded at the platform level under
  a `"sizes"` key in `manifest.json`, and a new `@sizes <build_id>
  <platform> <size> <url>` line type is emitted in `manifest.flat`
  alongside the existing `@channel` directive.

Schema is unchanged for existing consumers — on-device sysupgrade reads
positional 4-column `manifest.flat` lines and stays inert on unknown
`@`-prefixed directives.

Co-authored-by: John <zekccsripfwrocp-15689@yn.furvionx.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 15:05:05 +03:00
63994266e2 ci/nightly: manifest aggregator + 90-build retention sweep (#92)
PR-Bld-B in the mirror of OpenIPC/firmware's nightly redesign. Adds
the two workflows that turn dated nightly-* releases (from PR-Bld-A)
into a queryable index served via GitHub Pages.

`manifest.yml` — triggers on successful `Build` workflow_run completion
(or manual dispatch). Runs `.github/scripts/enrich_manifest.py` to
enumerate dated releases, keep the 90 newest, parse the body
(sha/short/built_at from PR-Bld-A) and asset list, then emit:
  - `manifest.json` — rich JSON for hosts/agents/CI.
  - `manifest.flat` — whitespace-delimited columns
    `build_id platform flash size url` plus `@channel` records,
    parseable by pure busybox `awk` (no jq, no jsonfilter) for
    on-device sysupgrade in Phase 2.
Both committed to the `gh-pages` branch (already bootstrapped).

`cleanup.yml` — Mondays 06:00 UTC (offset by +1h from firmware's
05:00 UTC cleanup). Deletes dated nightly releases beyond the 90
newest via `gh release delete --cleanup-tag`, then re-triggers
manifest.yml.

`enrich_manifest.py` differs from firmware's only in the asset parser:
builder produces TWO filename forms (per `master.yml`'s COMMON awk
trick that counts underscores in the matrix entry name):
  - **Compound** `<soc>_<variant>_<vendor>-<model>-nor.tgz` →
    platform key = the full string. This is the common case
    (per-device builds).
  - **Simple** `openipc.<soc>-<flash>-<variant>.tgz` (firmware-style,
    when matrix name has one underscore) → platform key =
    `<soc>_<variant>`.

The platform key gets carried into manifest.flat as a single column.
sysupgrade's existing `awk '$2==p'` lookup works unchanged; Phase 3
(model-aware BUILD_PLATFORM field in os-release) will let cameras
filter against the full per-model key.

URLs after merge:
  https://openipc.github.io/builder/manifest.json
  https://openipc.github.io/builder/manifest.flat

(`gh-pages` branch + Pages config already set up; mirrors firmware-
side setup.)

Concurrency-grouped `gh-pages-manifest` so manifest.yml and
cleanup.yml can't race the gh-pages push.

Includes the retry hardening from firmware OpenIPC/firmware#2129
(4-attempt backoff for transient GitHub API 401/5xx, fast-fail on
permanent 404).

First-run behaviour validated locally: empty index emits explicit
placeholder. Parser unit-tested across 7 synthetic filenames covering
compound, simple, and edge cases.

See ~/.claude/plans/mirror-nightly-redesign-to-builder.md.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-23 23:05:36 +03:00