Skip to content

Enable ccache for CI builds with GHCR caching#3960

Open
taalexander wants to merge 36 commits intoNVIDIA:mainfrom
taalexander:feature/ccache-ci-builds
Open

Enable ccache for CI builds with GHCR caching#3960
taalexander wants to merge 36 commits intoNVIDIA:mainfrom
taalexander:feature/ccache-ci-builds

Conversation

@taalexander
Copy link
Collaborator

@taalexander taalexander commented Feb 16, 2026

Description

CI builds currently recompile everything from scratch on every run, even when most source files haven't changed. This PR adds ccache across all CI workflows so that unchanged translation units are served from cache, which should cut build times substantially for most development work.

Cache data is stored in GHCR using ORAS. When a build starts, it looks for a cache in priority order: first the current PR's previous cache, then the PR's target branch, then main. After building, the updated cache is pushed back if the miss rate exceeded 10%. When a PR is closed, its cache artifacts are cleaned up automatically.

The ccache logic is implemented as three reusable composite actions (ccache-setup, ccache-restore, ccache-push) shared across all workflows. For macOS jobs, ccache runs on the host. For Linux jobs, cache data is injected into Docker builds via a BuildKit build-context and extracted afterward for persistence. This should seamlessly fallback to a local cache on the local devcontainer (which conveniently should also implement ccache support where it previously wasn't being used).

ci.yml/macos_ci.yml times (need to run):

Before:

  • Linux: 1h 18m 39s
  • MacOS: 1h 4m 8s

After (hot-cache):

  • Linux:
  • MacOS:

Publishing: (Need to run)

Deployments: (Need to run)

The build cudaq/wheel stages are down to 4-5 mins instead of ~15-20 they were before. Now the big blocker is test times (I've been thinking about some inefficiencies in parallel tests).

@taalexander taalexander requested a review from mitchdz February 16, 2026 00:43
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
…n every commit.

Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
…10% changed.

Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Signed-off-by: Thomas Alexander <talexander@nvidia.com>
@github-actions
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

Signed-off-by: Thomas Alexander <talexander@nvidia.com>
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

@copy-pr-bot
Copy link

copy-pr-bot bot commented Mar 8, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions
Copy link

github-actions bot commented Mar 8, 2026

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Relates to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant