Helm Docs

Caching

Every build on Helm starts on a clean machine, so it downloads its packages and compiles everything again unless you keep them in Helm's build cache. This page explains how the build cache works, how to use it in your GitHub Actions workflows, and how to read and clear it on the Caching page.

Who this is for: Developers who write the workflows read the first half. The Caching page appears under Build in the sidebar when the project has the Build module and you have access to it. Deleting caches needs the Project Admin role or higher; other members see the button greyed out.

What a build cache is

A build cache keeps files that one build produced or downloaded, such as packages and compiled modules, so that the next build of the same repository can reuse them and finish sooner. Helm keeps these caches at each site: a location with Helm build machines. A job uses the cache at the site where it runs. Everyone who builds a repository on Helm shares its cache.

Your workflow decides what goes into the cache. It names the folders to keep and a key: a name for one saved copy of those folders, usually built from a hash of your lock files so that the key changes when your dependencies change. This works the same way as GitHub's own actions/cache.

How the cache behaves

  • No secret to set up. Each job on Helm receives its own short-lived cache pass automatically, in the environment variables HELM_CACHE_URL and HELM_CACHE_TOKEN. The pass expires when the job's time limit runs out. You never store a cache key or password in GitHub.
  • Branches. A job saves only to its own branch. It restores from its own branch first, and then from the repository's default branch (for example main). A pull request therefore starts from the default branch's cache, and nothing a pull request saves can change the default branch's cache or another repository's.
  • Saved copies do not change. When a key already exists on the branch, the save is skipped, as in actions/cache. Change the key to save a new copy.
  • Pull requests from forks get no cache. Their jobs build normally, without restoring or saving anything.
  • Each copy is checked. Helm records a checksum when a copy is saved, and a restore that does not match it is thrown away.
  • The cache is only on Helm. On GitHub's own runners, or on any runner without the two cache variables, each cache step logs a notice and does nothing, and the job builds without a cache. The same workflow therefore runs anywhere.
  • A cache problem never fails the job. If the cache cannot be reached, the pass is refused, a copy is too large or a download does not match its checksum, the step logs a warning saying what happened and the job carries on without the cache.

Limits and clean-up

  • 20 GiB per GitHub account at each site. For now, all repositories of one GitHub account share one 20 GiB allowance. When a new save would go over it, Helm first deletes that account's least recently used copies. A single copy larger than 20 GiB is refused.
  • Unused copies expire. A copy that nobody has saved or restored for 7 days is deleted.
  • When a site's cache storage runs low, Helm deletes the least recently used copies of any account until there is room again.

Use the cache in a workflow

The GitHub Action Helm-Development/Build-Cache@v1 takes the same inputs as actions/cache, so on a job that already uses actions/cache@v4 you change only the uses: line. Its source and README are at https://github.com/Helm-Development/Build-Cache.

Add a step that uses the action before the step that needs the files:

      - name: Restore and save the Gradle caches
        uses: Helm-Development/Build-Cache@v1
        with:
          path: |
            ~/.gradle/caches
            ~/.gradle/wrapper
          key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }}
          restore-keys: |
            gradle-${{ runner.os }}-

The step restores the newest matching copy at once and checks its checksum. At the end of the job, if the job passed and the step did not restore a copy with exactly this key, it saves the folders under the key. Copies are compressed with zstd when it is installed, and with gzip otherwise.

Inputs

InputRequiredWhat it does
pathYesThe files, folders and wildcard patterns to restore and save, one per line. ~ means the job's home folder, a line starting with ! leaves out what it matches, and a relative path starts from the job's workspace.
keyYesThe name of the copy to restore and save, 1 to 512 bytes, with no tabs or line breaks. Build it from a hash of your lock files with hashFiles(...).
restore-keysNoBeginnings of older keys to fall back on when key itself has no copy, one per line, at most 20. The newest copy whose key starts with the first line wins, then the second line, and so on.
fail-on-cache-missNotrue fails the step when nothing is found for key or any restore key. Default false.
lookup-onlyNotrue only checks whether a copy exists and downloads nothing. Default false.

Outputs

OutputValue
cache-hittrue when a copy was found for exactly key, otherwise false.
cache-primary-keyThe key input.
cache-matched-keyThe key of the copy that was restored, which may have come from a restore key. Empty when nothing was found.

Use it to skip a step when the exact copy was restored:

      - name: Install pods
        if: steps.pods-cache.outputs.cache-hit != 'true'
        run: bundle exec pod install

Saving even when the job fails

The main action saves only when the job passes. To keep a cache after a failed run, for example DerivedData after failing tests, use the separate restore and save actions, which work like actions/cache/restore and actions/cache/save:

      - name: Restore DerivedData
        id: restore-dd
        uses: Helm-Development/Build-Cache/restore@v1
        with:
          path: ${{ runner.temp }}/DerivedData
          key: deriveddata-${{ runner.os }}-${{ github.sha }}
          restore-keys: |
            deriveddata-${{ runner.os }}-

      - name: Run the tests
        run: bundle exec fastlane ios test

      - name: Save DerivedData
        if: always() && steps.restore-dd.outputs.cache-hit != 'true'
        uses: Helm-Development/Build-Cache/save@v1
        with:
          path: ${{ runner.temp }}/DerivedData
          key: ${{ steps.restore-dd.outputs.cache-primary-key }}

Helm-Development/Build-Cache/restore@v1 takes the same inputs and gives the same outputs as the main action and never saves. Helm-Development/Build-Cache/save@v1 takes path and key.

Moving from actions/cache

  • Replace actions/cache@v4 with Helm-Development/Build-Cache@v1, and actions/cache/restore@v4 and actions/cache/save@v4 with Helm-Development/Build-Cache/restore@v1 and Helm-Development/Build-Cache/save@v1. Inputs and outputs keep their names.
  • enableCrossOsArchive and upload-chunk-size do not exist; GitHub warns about them if they are left in.
  • cache-hit is false on a miss, where actions/cache leaves it empty. A test such as steps.x.outputs.cache-hit != 'true' works the same with both.
  • Copies saved by actions/cache on GitHub are not visible to Helm, so the first run on Helm starts without a cache.
  • Linux and macOS runners only. Put runner.os in every key, because copies made on macOS and on Linux cannot be swapped.

How restoring finds a copy

  1. A copy saved under exactly key on this job's branch, then on the default branch.
  2. For each line of restore-keys, in order: the newest copy whose key starts with that line, on this job's branch, then on the default branch.

No other branch, repository or GitHub account is ever searched.

Examples

Each example is one step to add to a job on Helm. Put the cache step after actions/checkout, because hashFiles reads files in the repository.

Gradle (Android)

      - name: Gradle cache
        uses: Helm-Development/Build-Cache@v1
        with:
          path: |
            ~/.gradle/caches
            ~/.gradle/wrapper
          key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/libs.versions.toml') }}
          restore-keys: |
            gradle-${{ runner.os }}-

Stop the Gradle daemon before the job ends (./gradlew --stop) so its lock files are released before the cache is saved.

bundler (fastlane and CocoaPods gems)

      - name: Gem cache
        uses: Helm-Development/Build-Cache@v1
        with:
          path: vendor/bundle
          key: gems-${{ runner.os }}-${{ hashFiles('**/Gemfile.lock') }}
          restore-keys: |
            gems-${{ runner.os }}-

      - name: Install gems
        run: |
          bundle config set --local path vendor/bundle
          bundle install --jobs 4

CocoaPods

      - name: Pods cache
        id: pods-cache
        uses: Helm-Development/Build-Cache@v1
        with:
          path: Pods
          key: pods-${{ runner.os }}-${{ hashFiles('**/Podfile.lock') }}

      - name: Install pods
        if: steps.pods-cache.outputs.cache-hit != 'true'
        run: bundle exec pod install

No restore-keys here: an older Pods folder with a different Podfile.lock would make pod install do more work, not less.

Swift Package Manager

Tell xcodebuild where to keep the packages, and cache that folder:

      - name: Swift package cache
        uses: Helm-Development/Build-Cache@v1
        with:
          path: ${{ runner.temp }}/SourcePackages
          key: spm-${{ runner.os }}-${{ hashFiles('**/Package.resolved') }}
          restore-keys: |
            spm-${{ runner.os }}-

      - name: Resolve packages
        run: |
          xcodebuild -resolvePackageDependencies \
            -workspace MyApp.xcworkspace -scheme MyApp \
            -clonedSourcePackagesDirPath "$RUNNER_TEMP/SourcePackages"

Pass the same -clonedSourcePackagesDirPath to every later xcodebuild command in the job, or to fastlane's build_app and run_tests as cloned_source_packages_path.

Xcode DerivedData

DerivedData holds Xcode's compiled modules and can save the most time, but it is large and changes with every commit. Key it on the Xcode version and the lock files, and keep the newest copy as a fallback:

      - name: DerivedData cache
        uses: Helm-Development/Build-Cache@v1
        with:
          path: ${{ runner.temp }}/DerivedData
          key: deriveddata-${{ runner.os }}-xcode27.1-${{ hashFiles('**/Package.resolved', '**/Podfile.lock') }}-${{ github.sha }}
          restore-keys: |
            deriveddata-${{ runner.os }}-xcode27.1-${{ hashFiles('**/Package.resolved', '**/Podfile.lock') }}-
            deriveddata-${{ runner.os }}-xcode27.1-

Pass -derivedDataPath "$RUNNER_TEMP/DerivedData" to xcodebuild, or derived_data_path to fastlane. Because the key ends with the commit, every passing build saves a new copy, which uses your 20 GiB allowance quickly. If your caches are often evicted, leave DerivedData out and cache only packages.

Docker layers

On Linux jobs, export Docker's build cache to a folder with buildx and cache that folder. Do not push cache layers to a registry for this.

      - name: Docker layer cache
        uses: Helm-Development/Build-Cache@v1
        with:
          path: ${{ runner.temp }}/buildx-cache
          key: buildx-${{ runner.os }}-${{ hashFiles('Dockerfile') }}-${{ github.sha }}
          restore-keys: |
            buildx-${{ runner.os }}-${{ hashFiles('Dockerfile') }}-

      - name: Build the image
        run: |
          docker buildx create --use
          docker buildx build \
            --cache-from type=local,src="$RUNNER_TEMP/buildx-cache" \
            --cache-to type=local,dest="$RUNNER_TEMP/buildx-cache-new",mode=max \
            --load -t myapp:ci .
          rm -rf "$RUNNER_TEMP/buildx-cache"
          mv "$RUNNER_TEMP/buildx-cache-new" "$RUNNER_TEMP/buildx-cache"

Complete workflows that combine these steps are on Example Workflows.

The Caching page

The Caching page lists every repository that Helm builds for your organization, shows how much space its build caches use at each site, and lets you delete a repository's caches so that its next build starts without them.

Reading the page

The boxes at the top name each site and say when that site's build machines last reported how much cache space each repository uses. They report every few minutes.

The table has one row per repository that Helm has built for your organization's linked GitHub accounts:

  • Repository — the GitHub repository, and how long ago Helm last built it.
  • Cache size and Entries — the space and the number of cache entries (saved copies) across all sites.
  • Last used — the last time a build saved or restored one of the repository's cache entries.
  • By site — the same figures for each site. Unknown means the site has not sent a usage report in the last 15 minutes, so Helm cannot say; it does not mean the cache is empty.

The list comes from your organization's GitHub accounts linked in Organization Settings → GitHub. A repository appears after its first build on Helm.

Deleting a repository's caches

Delete a repository's caches when a build keeps failing because of a stale or damaged cache, or when you want to be sure the next build starts from nothing. You can also change the key in the workflow, which leaves the old copies to expire.

Warning: The cache is shared by everyone who builds the repository. After you delete it, the next build by anyone starts without a cache and is slower while it fills the cache again.
  1. Find the repository's row and click Delete caches.
  2. Read the confirmation and click OK.
  3. A panel under the row shows the progress at each site. The build machines at each site carry out the deletion, usually within a few minutes. The button says Deleting… until it finishes; clicking again never starts a second deletion.

  4. When every site has finished, the panel shows how many entries were deleted and how much space was freed, or the reason a site failed.

The result of a deletion is one of:

  • Deleted — every site deleted the caches.
  • Partly deleted — some sites deleted the caches and some failed. Each failed site shows its reason.
  • Failed — no site deleted the caches.

A site shows Expired when none of its build machines finished the deletion within 15 minutes, for example because they were all switched off.

Preview build caches

When Helm builds a PR preview, it saves the Docker layers it built (the saved steps of each image, such as installed packages) in the same build cache, so the next preview of the same repository builds faster. These entries belong to the repository but are kept apart from its CI caches: their keys start with helm-preview-layers-.

A repository whose previews saved layers has a second row under it, Preview builds, with the size, number of entries and last use of those entries, in total and at each site. The repository's own row still counts everything.

Clear the preview build cache when a preview keeps building from a wrong or outdated layer, for example when an image still has an old package after you changed the Dockerfile. The repository's CI caches are not touched.

  1. Find the repository's Preview builds row and click Delete preview builds.
  2. Read the confirmation and click OK.
  3. The panel under the row shows the progress as for Delete caches. Its heading says (Preview builds), and a deletion of the whole repository says (Whole repository), so you can tell them apart.
Warning: After you clear it, the next preview of the repository rebuilds every image from the start, so it takes longer. Delete caches on the repository's own row also deletes the preview build cache.

You can do the same for the project's backend repository with Clear preview build cache on the PR Previews page; see The PR Previews Page. The MCP tools list_build_cache_usage, purge_build_cache and clear_preview_build_cache do the same as this page and need the same roles.

Troubleshooting

The cache step never restores anything (a cache miss)

The common reasons, most likely first:

  • It is the first build of the key. Nothing is saved until a job with that key passes. Run the workflow once on the default branch so pull requests have something to start from.
  • The key changed. A changed lock file, Xcode version or runner.os gives a new key. Add restore-keys so an older copy is used meanwhile.
  • The copy is on another branch. A job restores only from its own branch and the default branch, never from a sibling feature branch.
  • The job ran at another site. Each site has its own cache.
  • The copy was deleted: it was unused for 7 days, the account went over its 20 GiB allowance, the site's storage ran low, or someone used Delete caches.
  • The job came from a fork, or ran on a runner that is not Helm's. These jobs have no cache.
  • The job failed. A failed job does not save.

The cache step logs a notice and does nothing

The job has no cache pass: it ran on a runner that is not Helm's, or it came from a pull request from a fork. This is expected; the job builds without a cache.

The save step says the key already exists

That is expected: a saved copy is never replaced. Change the key, for example by adding a hash of the files that changed, to save a new copy.

The cache step logs a warning about the token, the branch or the size

The job carried on without the cache. A warning about the token (HTTP 401) means the job's cache pass expired, which happens when the job runs past its time limit. A warning about another branch or repository (HTTP 403) means the pass does not match the job. A warning about the size (HTTP 413) means one copy is larger than the whole 20 GiB allowance: cache less. Run the job again. If it keeps happening, contact Helm support with the link to the job.

A preview still uses an old layer after Delete preview builds

Wait until the panel says Deleted at every site before you start the next preview. A preview that started while the deletion was running may still have restored the old layers. Rebuild it once the deletion has finished.

"No GitHub account is linked"

Your organization has no active link to a GitHub account. An Organization Owner or Admin can add one with Connect GitHub in Organization Settings → GitHub.

"No build cache is configured for this site yet"

Helm's build cache is not set up at that site yet, so there is nothing to delete, and jobs there build without a cache. Contact Helm support if you expected it to be.

"Helm cannot reach the Fleet Orchestrator right now"

The service that keeps track of builds and caches did not answer. Wait a few minutes and click Refresh. A deletion that already started carries on without the page.

Sizes stay "Unknown" or a deletion stays "Waiting for the build hosts"

The site's build machines have not reported recently. They might be switched off or busy. If it lasts more than 15 minutes, contact Helm support.