Wefti

Faster CMake in GitHub Actions

GitHub Actions runners can reuse verified compiler probes and configure results from earlier runs.

Add wefti/wefti/actions/setup-wefti@v0.4.0 and configure with wefti -S . -B build. The Node.js 24 action installs a verified Wefti release on Linux, macOS, or Windows. It enables GitHub Actions Cache v2 for later steps by default.

A workflow with setup-wefti

The installer checks the SHA-256 digest of the release archive. The workflow below configures with the native command, and it builds and tests with the usual commands.

steps:
  - uses: actions/checkout@v6
  - uses: wefti/wefti/actions/setup-wefti@v0.4.0
    with:
      version: v0.4.0
      cache-key-suffix: ${{ hashFiles('**/CMakeLists.txt', 'cmake/**') }}
  - run: wefti -S . -B build -G Ninja
  - run: cmake --build build
  - run: ctest --test-dir build --output-on-failure
setup-wefti inputs
InputDefaultWhat it does
versionlatestInstalls the latest release or an exact release such as v0.4.0.
sha256emptySupplies the checksum for the runner archive. The action uses the published checksum by default.
drop-intrueAlso installs cmake, ctest, cpack, and ccmake as aliases for Wefti.
cachetrueSets WEFTI_CACHE_DIR and WEFTI_PROBE_CACHE=on and enables GitHub Actions Cache v2 for later steps.
cache-trustscopedSelects scoped, pinned, or signed. Signed mode uses WEFTI_CACHE_REMOTE_KEY from the configure step.
cache-writeautoAllows writes on branch builds by default. Use false for read-only access or true to allow a pull_request run to save to its merge ref.
cache-key-suffixemptySelects a separate cache scope. Use letters, digits, ., _, and -, up to 128 characters.
install-prefixemptySets the install directory. The default is under the runner tool cache.

The action needs a runner that supports Node.js 24 and has tar. Your workflow supplies the compiler and any build tool that your configure step needs.

How the cache works across runs and systems

A probe is a small compiler check such as try_compile, check_include_file, or check_symbol_exists. The remote cache can also hold configure results such as compiler identification and recorded platform checks. A later configure reuses an entry only when its recorded inputs still match.

Wefti restores a cache pack at configure time. If the configure succeeds and writes new entries, Wefti saves a pack when the write policy allows it. By default, GitHub limits access to the repository and ref scope. The action disables the GitHub Actions cache backend on pull_request_target and workflow_run.

Run wefti cache status after configure to see the restore result. The legacy cache-hit output is always false.

The action sets WEFTI_PROBE_CACHE=on so a cmake configure can reuse probes in compatibility mode. Native wefti also uses incremental replay and the Ninja generation skip. To disable the GitHub Actions cache backend, set cache: "false".

vcpkg and Conan in the same workflow

Replay and the probe cache work with toolchain files, so vcpkg and Conan setups keep their speed. The GitHub-hosted images set VCPKG_INSTALLATION_ROOT.

jobs:
  build:
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v6
      - uses: wefti/wefti/actions/setup-wefti@v0.4.0
        with:
          version: v0.4.0
          cache-key-suffix: ${{ hashFiles('**/CMakeLists.txt', 'vcpkg.json') }}
      - name: Configure with vcpkg
        shell: bash
        run: wefti -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"
      - run: cmake --build build --config Release
      - name: Configure with Conan
        shell: bash
        run: |
          pip install conan
          conan profile detect
          conan install . --output-folder=build --build=missing
          wefti -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=build/conan_toolchain.cmake

Wefti v0.4.0 matched CMake on 1,518 / 1,518 scored vcpkg ports across 64 / 64 shards and passed 2 / 2 Conan scenarios.

Move an existing workflow to setup-wefti

These steps replace a CMake install step and keep the rest of the workflow.

  1. Add the action. Use wefti/wefti/actions/setup-wefti@v0.4.0 after checkout. The default drop-in: true also installs cmake, ctest, cpack, and ccmake aliases.
  2. Configure with wefti. Call wefti -S . -B build. Wefti restores remote cache entries during configure and checks that their inputs match.
  3. Keep your build and test lines. Leave cmake --build and ctest as they are. The aliases run in compatibility mode and use the probe cache when WEFTI_PROBE_CACHE=on is set.
  4. Set an optional cache scope. Use cache-key-suffix to keep separate caches. For example, use a hash of your CMake files to select a new scope when those files change.

Frequently asked questions

Is there a setup-cmake alternative that caches the CMake configure step?

Yes. setup-wefti installs Wefti and enables GitHub Actions Cache v2 by default. Configure with wefti to reuse verified probes and configure results.

How do I make CMake faster in GitHub Actions?

Use setup-wefti and configure with wefti -S . -B build. Use cache-key-suffix if you need a separate cache scope. With a warm probe cache, the v0.4.0 benchmark measured a geometric mean speedup of 2.21 times over CMake 4.5.1 across five large C++ projects.

How do I cache try_compile results in CI?

The native wefti command saves each probe result with its inputs. The setup action enables GitHub Actions Cache v2 for later steps. On other CI systems, use an HTTPS or S3 remote cache, or move probes with wefti cache export and wefti cache import --sha256.

Does the cache work for vcpkg and Conan builds on Linux, macOS, and Windows?

Yes. The action runs on all three systems, and toolchain files keep replay and the probe cache. Each system and CPU architecture has its own cache key.

Does my cmake line use the cache?

Yes, with the default cache setting. The action sets WEFTI_PROBE_CACHE=on so the cmake alias can reuse compiler probes in compatibility mode. Use the native wefti command for incremental replay and the Ninja generation skip.

Which version tag do I use for the action?

Use wefti/wefti/actions/setup-wefti@v0.4.0 for GitHub Actions and rev v0.4.0 for pre-commit.