Skip to main content

Advanced Configuration

Running inside a container

A few conditions must be met to use the cache action inside a custom container.

  • wget: the cache action uses wget to download the cache. See our workflow file for an example.
  • zstd: the downloaded cache is uncompressed using zstd.
  • WARPBUILD_RUNNER_VERIFICATION_TOKEN: This environment variable is always present in WarpBuild runners and is used to authenticate the action with the WarpBuild service. To use WarpCache inside a container, pass the WARPBUILD_RUNNER_VERIFICATION_TOKEN environment variable to the container as shown below.
test-proxy-save:
runs-on: warp-ubuntu-latest-x64-16x
container:
image: ubuntu:latest
env:
WARPBUILD_RUNNER_VERIFICATION_TOKEN: ${{ env.WARPBUILD_RUNNER_VERIFICATION_TOKEN }}

Known practices and workarounds

There are a number of community practices/workarounds to fulfill specific requirements. You may choose to use them if they suit your use case. Note these are not necessarily the only solution or even a recommended solution.

Cache Version

Cache version is a hash generated for a combination of compression tool used (Gzip, Zstd, etc. based on the runner OS) and the path of directories being cached. If two caches have different versions, they are identified as unique caches while matching. This, for example, means that a cache created on a warp-macos-14-arm64-6x runner can't be restored on warp-ubuntu-latest-x64-4x as cache versions are different.

Caching Strategies

With the introduction of the restore and save actions, a lot of caching use cases can now be achieved. Please see the caching strategies document for understanding how you can use the actions strategically to achieve the desired goal.

Skipping steps based on cache-hit

Using the cache-hit output, subsequent steps (such as install or build) can be skipped when a cache hit occurs on the key. It is recommended to install missing/updated dependencies in case of a partial key match when the key is dependent on the hash of the package file.

Example:

steps:
- uses: actions/checkout@v3

- uses: WarpBuilds/cache@v1
id: cache
with:
path: path/to/dependencies
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}

- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: /install.sh

Note The id defined in WarpBuilds/cache must match the id in the if statement (i.e. steps.[ID].outputs.cache-hit)