Skip to content

ci: add apt-cacher-ng caching, concurrency control, and action upgrades to speed up pi-gen builds#61

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/optimize-github-actions-caching
Draft

ci: add apt-cacher-ng caching, concurrency control, and action upgrades to speed up pi-gen builds#61
Copilot wants to merge 2 commits intomainfrom
copilot/optimize-github-actions-caching

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 23, 2026

Every CI run re-downloads the full set of APT packages from scratch, and redundant workflow runs on the same branch waste runner time with no cancellation mechanism.

Caching (pi-gen.yml)

  • Install apt-cacher-ng on the runner before pi-gen starts; pass apt-proxy: http://172.17.0.1:3142 (Docker bridge gateway) to usimd/pi-gen-action so all apt-get calls inside pi-gen's Docker containers route through it
  • Persist /var/cache/apt-cacher-ng via actions/cache@v4, keyed on hashFiles('stages/**/packages', 'stages/**/*-packages') || 'default' — auto-busts when package lists change, hits on repeated runs

Concurrency

  • Added top-level concurrency group (workflow + ref, cancel-in-progress: true) — new pushes to the same branch/PR cancel any still-running build

Hygiene

  • actions/checkout@v2actions/checkout@v4
  • export-last-stage-only: true made explicit; artifact upload path switched from hardcoded stage2.tar.gz to ${{ steps.build_aryaos.outputs.image-path }}
  • Removed ls -alR step

Docs (docs/build.md)

  • Added local apt-cacher-ng usage instructions mirroring what CI does
  • Documented CI cache key logic and how to bust the cache
Original prompt

Goal

Speed up build times and reduce CI runtime for snstac/aryaos by improving GitHub Actions caching, avoiding unnecessary rebuild work, and enabling compilation/link acceleration where applicable.

Repository

  • Repo: snstac/aryaos
  • Base branch: main

Scope of work (make changes in a PR)

  1. Profile and identify CI bottlenecks

    • Inspect existing GitHub Actions workflows under .github/workflows/.
    • Identify long-running steps (toolchain build, dependency installs, full rebuilds, image packaging, tests).
  2. Add effective caching to GitHub Actions

    • Cache dependency downloads (e.g., apt/pacman/homebrew, language package caches) where safe.
    • Add compiler build caching where applicable:
      • Prefer ccache for C/C++ or sccache for Rust/multi-language.
      • Persist cache via actions/cache or native caching actions.
    • Ensure cache keys are stable enough to hit but correctly bust when inputs change (e.g., hashes of lockfiles/toolchain version files).
  3. Improve incremental builds / avoid unnecessary work

    • Ensure builds use parallelism (-j$(nproc) / Ninja job control).
    • Avoid steps that force full rebuilds on every run (e.g., always-touching generated files, timestamps).
    • If the project builds a cross-toolchain or large artifacts, add a CI strategy to reuse/prebuild and cache them (or store as artifacts if caching is unsafe).
  4. Speed up linking/compilation where feasible

    • If using CMake, switch to Ninja generator in CI.
    • If using GCC/Clang, consider enabling faster linkers (lld or mold) in CI/dev builds when compatible.
  5. Add documentation for local + CI build speedups

    • Update README or docs/ with:
      • How to enable ccache/sccache locally.
      • Recommended build commands and environment variables.
      • Notes about CI caching and how to bust caches.

Acceptance criteria

  • CI workflow(s) updated to include caching and parallelization.
  • CI runtime should decrease meaningfully on subsequent runs (cache hits) without breaking builds.
  • Build remains reproducible and correct; caches do not produce stale/incorrect binaries.
  • Documentation updated to explain the changes.

Notes / constraints

  • CI is GitHub Actions.
  • Keep base branch main.
  • Prefer minimal, maintainable changes; avoid introducing unnecessary complexity.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…on upgrades

Co-authored-by: ampledata <91230+ampledata@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve GitHub Actions caching to speed up CI runtime ci: add apt-cacher-ng caching, concurrency control, and action upgrades to speed up pi-gen builds Feb 23, 2026
Copilot AI requested a review from ampledata February 23, 2026 17:51
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