Skip to content

ci: wire ccache into the packaging matrix (skipped on tag builds) - #903

Merged
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:ci/packaging-ccache
Jun 7, 2026
Merged

ci: wire ccache into the packaging matrix (skipped on tag builds)#903
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:ci/packaging-ccache

Conversation

@got3nks

@got3nks got3nks commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Mirrors the pattern @mrjimenez wired into .github/workflows/ccpp.yml recently — install ccache on each compile job, persist its cache dir across runs via actions/cache, zero the stats before build, print them after.

What this covers

Four compile jobs in packaging.yml:

Job Install path Cache path
appimage (x86_64 + aarch64) apt install ccache $CCACHE_DIR (= ${{ github.workspace }}/.ccache)
flatpak (x86_64 + aarch64) apt install ccache + flatpak-builder --ccache (added to packaging/linux/build.sh) $CCACHE_DIR (flatpak-builder honours CCACHE_DIR when absolute — see builder-context.c:213-222)
macos (arm64 + x86_64-via-Rosetta) brew install ccache per matrix prefix $CCACHE_DIR
windows-zip (x64 + arm64) ${pkg_prefix}-ccache via MSYS2 pacman $CCACHE_DIR

windows-installer is intentionally untouched: it bundles the existing portable .zip artifact and runs makensis — no compilation, nothing for ccache to do.

CCACHE_DIR and CCACHE_MAXSIZE live in the top-level env: block. MAXSIZE=1G (up from the 500M used in ccpp.yml — packaging pulls in the full BUILD_EVERYTHING set, so the cache works harder).

Tag-build gate

Every cache-related step (actions/cache/restore, actions/cache/save, ccache --zero-stats, ccache --show-stats) is guarded by if: github.event_name != 'workflow_call'. Tag pushes trigger release.yml which calls packaging.yml as a reusable workflow, so release artifacts are always produced from a cold compile — belt-and-suspenders against any "could ccache be lying to me" concern on a binary that's about to ship.

The install step (apt/brew/pacman install ccache) is unconditional. With no warm cache, cmake's auto-detection still wires ccache as the compiler launcher, but every TU misses → recompile → cache populated locally for that run only. Same wall-clock as today; no harm.

Expected impact

The cmake --build phase is 60–80% of each compile job's wall-clock. Warm cache should skip most of it on a same-branch second run; the first run on each branch + tag builds + cold caches all pay the same cost as today.

Refs

The ccpp.yml ccache PR series this builds on: b18c0b8 / 143424a / a485a76 / ee7145b / 01c39f1.

Test plan

Validated end-to-end on my fork (got3nks/amule).

  • Cold run, all 8 compile jobs succeed and populate the cache.
  • Warm run, all 8 compile jobs restore the cache and use it.
  • No artifact regression — produced .AppImage / .flatpak / .dmg / .zip / .exe match a cache-disabled build modulo timestamp metadata.

Cmake-level hit rates (warm run):

Job Hits / Cacheable
AppImage aarch64 + x86_64 376 / 376 (100%)
macOS arm64 + x86_64 325 / 325 (100%)
Windows zip x64 + arm64 323 / 323 (100%)

Flatpak ccache stats live inside the SDK sandbox and aren't surfaced by the workflow, but the wall-clock drop is the proxy: aarch64 22m55s → 14m49s (-35%), x86_64 30m13s → 16m28s (-46%).

@got3nks
got3nks force-pushed the ci/packaging-ccache branch 3 times, most recently from ed919b7 to cd7d6fe Compare June 7, 2026 15:36
Mirrors the pattern already in .github/workflows/ccpp.yml: install
ccache on each compile job, persist its cache dir across runs via
actions/cache, zero the stats before build, print them after.

Wired across the four compile jobs in packaging.yml:

  * appimage (x86_64 + aarch64) -- apt install ccache; cache key
    keyed on runner.os + matrix.arch + a hash of CMakeLists.txt
    + cmake/.
  * flatpak (x86_64 + aarch64) -- the build runs inside a flatpak-
    builder sandbox that doesn't see the host's CCACHE_DIR.
    flatpak-builder's --ccache option (added to packaging/linux/
    build.sh) sets up ccache inside the sandbox using
    ~/.cache/flatpak-builder/ccache on the host; that's what's
    persisted here.
  * macos (arm64 + x86_64-via-Rosetta) -- brew install ccache;
    cache key keyed on runner.os + matrix.arch + the same hash.
  * windows-zip (x64 + arm64) -- ${pkg_prefix}-ccache via MSYS2
    pacman in the existing setup-msys2 install list.

CCACHE_DIR and CCACHE_MAXSIZE live in the top-level env block (1G,
up from the 500M used in ccpp.yml -- the packaging build pulls in
the full BUILD_EVERYTHING set, so the cache works harder).

Tag-build gate: every cache step (restore / save / zero-stats /
show-stats) is guarded by `if: github.event_name != 'workflow_call'`.
Tag pushes trigger release.yml which invokes packaging.yml as a
reusable workflow, so release artifacts always come from a cold
compile. The install of ccache itself is unconditional, but with
no warm cache the build runs at the same speed as before.

windows-installer is untouched: that job bundles the existing
portable .zip and runs makensis -- no compilation, nothing for
ccache to cache.

Expected wall-clock improvement on warm runs: the cmake --build
phase is 60-80% of each job's total; ccache should skip most of
it on a same-branch second run. Cold runs and tag builds pay the
same cost as today.
@got3nks
got3nks force-pushed the ci/packaging-ccache branch from 8514368 to 147e165 Compare June 7, 2026 16:48
@got3nks
got3nks marked this pull request as ready for review June 7, 2026 18:08
@got3nks

got3nks commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Validated end-to-end on got3nks/amule:

Cold run (all 8 compile jobs): success, every cache step populated its key.

  • AppImage: Linux-appimage-{aarch64,x86_64}-ccache-<run>
  • Flatpak: Linux-flatpak-{aarch64,x86_64}-ccache-<run>
  • macOS: macOS-{arm64,x86_64}-ccache-<run>
  • Windows zip: Windows-windows-zip-{x64,arm64}-ccache-<run>

Warm run (same branch, second invocation): success, every cache step restored its key from the cold run.

Cmake-level hit rates (ccache --show-stats after build):

Job Hits / Cacheable
AppImage aarch64 / x86_64 376 / 376 (100%)
macOS arm64 / x86_64 325 / 325 (100%)
Windows zip x64 / arm64 323 / 323 (100%)

Flatpak doesn't surface ccache --show-stats (the stats live inside the SDK sandbox), so the wall-clock table below is the only signal for that platform.

Wall-clock cold-vs-warm across all platforms:

Job Cold Warm Δ
AppImage aarch64 10m30s 7m05s -33%
AppImage x86_64 13m22s 4m40s -65%
macOS arm64 8m24s 2m35s -69%
macOS x86_64 32m44s 20m04s -39%
Windows zip arm64 15m21s 10m47s -30%
Windows zip x64 14m18s 6m32s -54%
Flatpak aarch64 22m55s 14m49s -35%
Flatpak x86_64 30m13s 16m28s -46%

The longest bar in the pipeline (cold macOS x86_64 + Universal2 merge) drops from ~33 min to ~20 min on the warm path — the full packaging matrix's critical path tightens proportionally.

Behavioural notes:

  • Tag builds (release.yml → packaging.yml via workflow_call) bypass every cache step via if: github.event_name != 'workflow_call', so shipped binaries are always cold-compiled.
  • flatpak-builder --ccache honours CCACHE_DIR when it's an absolute path (see builder-context.c:213-222), which is how Flatpak ends up sharing the same ${workspace}/.ccache path the other jobs use.

@mrjimenez
mrjimenez merged commit 461fccf into amule-project:master Jun 7, 2026
7 checks passed
@mrjimenez

Copy link
Copy Markdown
Contributor

Excellent!

got3nks added a commit to got3nks/amule that referenced this pull request Jun 7, 2026
…ule-project#912)

Extends existing categories (preferring extensions over new lines):
- Performance/Upload: amule-project#898 SlotAllocation default raised.
- Networking & Discovery: wire-parser hardening list extended with
  amule-project#879/amule-project#882/amule-project#890/amule-project#886; new amuleweb security hardening bullet
  consolidating ngosang's amule-project#869-amule-project#874 triage (all landed in amule-project#875);
  amulegui list extended with amule-project#857; shared-folder watcher extended
  with amule-project#858.
- Packaging: Windows installer i18n line extended with amule-project#899.
- Internals & Refactoring: new docs-polish + code-quality bullets
  covering amule-project#851/amule-project#855/amule-project#862/amule-project#888/amule-project#900/amule-project#866/amule-project#867/amule-project#895 and amule-project#909/amule-project#910/amule-project#912.
- Translations: new pre-release final-wave bullet covering amule-project#847/amule-project#856/
  amule-project#891/amule-project#908/amule-project#860/amule-project#904/amule-project#859/amule-project#863/amule-project#861/amule-project#880/amule-project#911/amule-project#901/amule-project#902/amule-project#889/amule-project#868/amule-project#853.
- Bug Fixes & Stability: amule-project#850/amule-project#854/amule-project#878/amule-project#906.
- CI: ccache wiring (amule-project#892, amule-project#903) + CodeQL binutils-dev (amule-project#907).

Contributors footer gains mifritscher and nguyenhoangminhhieu2004-gif
(both first-time contributors).

PR index extended through amule-project#912.
mrjimenez pushed a commit that referenced this pull request Jun 8, 2026
Extends existing categories (preferring extensions over new lines):
- Performance/Upload: #898 SlotAllocation default raised.
- Networking & Discovery: wire-parser hardening list extended with
  #879/#882/#890/#886; new amuleweb security hardening bullet
  consolidating ngosang's #869-#874 triage (all landed in #875);
  amulegui list extended with #857; shared-folder watcher extended
  with #858.
- Packaging: Windows installer i18n line extended with #899.
- Internals & Refactoring: new docs-polish + code-quality bullets
  covering #851/#855/#862/#888/#900/#866/#867/#895 and #909/#910/#912.
- Translations: new pre-release final-wave bullet covering #847/#856/
  #891/#908/#860/#904/#859/#863/#861/#880/#911/#901/#902/#889/#868/#853.
- Bug Fixes & Stability: #850/#854/#878/#906.
- CI: ccache wiring (#892, #903) + CodeQL binutils-dev (#907).

Contributors footer gains mifritscher and nguyenhoangminhhieu2004-gif
(both first-time contributors).

PR index extended through #912.
@got3nks
got3nks deleted the ci/packaging-ccache branch June 8, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants