ci: report image size changes on image PRs - #306
Conversation
On pull requests, each image build matrix now measures the new image's size and compares it against the currently published rolling tag for the same runtime version (e.g. apify/actor-node:22), uploading a per-image report. A new size-report job aggregates those reports and posts/updates a single sticky comment per workflow with a current/new/Δ table. The Markdown is rendered by a TypeScript script run natively on Node.js 24 (type stripping, no build step). Applies to all six image workflows (node, node-playwright, node-puppeteer, python, python-playwright, python-selenium).
📦 Image size reportBuilt images compared against the currently published rolling tag for the same runtime version (e.g.
|
📦 Image size reportBuilt images compared against the currently published rolling tag for the same runtime version (e.g.
|
📦 Image size reportBuilt images compared against the currently published rolling tag for the same runtime version (e.g.
|
The node workflows' measure step now records the slim image alongside the regular one (baseline: the published rolling tag + -slim), and the report renderer surfaces an explicit variant label next to the matrix-derived one. Python workflows are unchanged as they have no slim variants.
📦 Image size reportBuilt images compared against the currently published rolling tag for the same runtime version (e.g.
|
Instead of one sticky comment per workflow (up to 6 on a wide PR), all image workflows now upsert their own marker-delimited <details> section into a single shared comment. The size-report jobs share a repo-wide concurrency group so concurrent read-modify-writes of the comment cannot drop sections. Sections only appear for workflows the PR's changed paths actually triggered, and each is stamped with the head SHA it measured.
📦 Image size reportBuilt images compared against the currently published rolling tag for the same runtime version (e.g.
|
📦 Image size reportBuilt images compared against the currently published rolling tag for the same runtime version (e.g. Node basic images — 6 images (at 1324b28)
Python basic images — 5 images (at 1324b28)
Python + Selenium images — 5 images (at 1324b28)
Node + Puppeteer images — 6 images (at 1324b28)
Python + Playwright images — 25 images (at 1324b28)
Node + Playwright images — 30 images (at 1324b28)
|
📦 Image size reportBuilt images compared against the currently published rolling tag for the same runtime version (e.g.
|
What
On every image PR, each triggered build workflow measures the built images' uncompressed sizes (regular and
-slimvariants for the node images) and compares them against the currently published rolling tags. All workflows report into one shared sticky comment, with a foldable<details>section per workflow.Because the workflows are path-triggered, only image families the PR actually modifies run — so the comment only contains sections for the affected images, and a PR touching a single image dir gets a single-section comment.
How
docker image inspecton the just-built image(s),docker pullof the published baseline (tolerated missing — e.g. brand-new version combos or not-yet-released-slimtags), one JSON report per image variant uploaded as an artifact. Node workflows measure both the regular and theSLIM=1image.format-image-size-report.ts: renders one workflow's<details>section (image count + head SHA in the summary line, table of current/new/Δ inside). Plain TypeScript, executed natively by Node 24 — no build step.upsert-image-size-comment.js(viaactions/github-script): finds the shared comment by a hidden marker and replaces only that workflow's marker-delimited section (or creates the comment / appends the section). Thesize-reportjobs across all 6 workflows share a repo-wideconcurrencygroup keyed on the PR number, so concurrent read-modify-writes are serialized and can't drop each other's sections.if: always()so partial matrix failures still report the successful entries; skipped entirely outside pull requests.Notes
docker image inspect), so they read larger than Docker Hub's compressed download sizes; the comment preamble says so.Verification
feat/central-pm-cachesexperiment branch, where it ran on real PRs across all 6 workflows.-slimbaseline shown as new image until first slim release,slimvariant label).bash -n;needs: [build-main]matches every workflow's job ids.